-
Notifications
You must be signed in to change notification settings - Fork 11
[ACL-250]: Adds payouts in Poland #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bc8aa16
4df576e
1ac7acc
d00426e
431eb43
5bdc208
2395479
c65d0fd
9d26bd6
f747d41
0cd93ff
d546f0e
46e6c5b
ee381db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.truelayer.java.merchantaccounts.entities.transactions.accountidentifier; | ||
|
|
||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
|
|
||
| @Builder | ||
| @Getter | ||
| public class NrbAccountIdentifier extends AccountIdentifier { | ||
| private final Type type = Type.NRB; | ||
|
|
||
| private String nrb; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.truelayer.java.payouts.entities.accountidentifier; | ||
|
|
||
| import lombok.Builder; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Getter; | ||
|
|
||
| @Builder | ||
| @Getter | ||
| @EqualsAndHashCode(callSuper = false) | ||
| public class NrbAccountIdentifier extends AccountIdentifier { | ||
| private final Type type = Type.NRB; | ||
|
|
||
| private String nrb; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,35 +16,35 @@ | |
| import com.truelayer.java.payouts.entities.submerchants.SubMerchants; | ||
| import java.util.Collections; | ||
| import java.util.concurrent.ThreadLocalRandom; | ||
| import java.util.stream.Stream; | ||
| import lombok.SneakyThrows; | ||
| import org.junit.jupiter.api.DisplayName; | ||
| import org.junit.jupiter.api.Tag; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.Arguments; | ||
| import org.junit.jupiter.params.provider.MethodSource; | ||
|
|
||
| @Tag("acceptance") | ||
| public class PayoutsAcceptanceTests extends AcceptanceTests { | ||
|
|
||
| @Test | ||
| @DisplayName("It should create a payout and get the details") | ||
| @ParameterizedTest(name = "It should create a {0} payout and get the details") | ||
| @MethodSource("providePayoutsArgumentsForDifferentCurrencies") | ||
| @SneakyThrows | ||
| public void shouldCreateAPayoutAndGetPayoutsDetails() { | ||
| public void shouldCreateAPayoutAndGetPayoutsDetails( | ||
| CurrencyCode currencyCode, AccountIdentifier accountIdentifier, SchemeSelection schemeSelection) { | ||
| // find a merchant to execute the payout from | ||
| MerchantAccount merchantAccount = getMerchantAccount(CurrencyCode.GBP); | ||
| MerchantAccount merchantAccount = getMerchantAccount(currencyCode); | ||
|
|
||
| // create the payout | ||
| CreatePayoutRequest createPayoutRequest = CreatePayoutRequest.builder() | ||
| .merchantAccountId(merchantAccount.getId()) | ||
| .amountInMinor(ThreadLocalRandom.current().nextInt(10, 100)) | ||
| .currency(CurrencyCode.GBP) | ||
| .currency(currencyCode) | ||
| .beneficiary(Beneficiary.externalAccount() | ||
| .accountIdentifier(AccountIdentifier.sortCodeAccountNumber() | ||
| .accountNumber("00009650") | ||
| .sortCode("040668") | ||
| .build()) | ||
| .reference("Java SDK payout test") | ||
| .accountIdentifier(accountIdentifier) | ||
| .reference(String.format("Java SDK %s payout test", currencyCode.name())) | ||
| .accountHolderName("LucaB merchant") | ||
| .build()) | ||
| .schemeSelection(SchemeSelection.instantPreferred().build()) | ||
| .schemeSelection(schemeSelection) | ||
| .subMerchants(SubMerchants.builder() | ||
| .ultimateCounterparty(BusinessClient.businessClient() | ||
| .tradingName("A sub merchant trading name") | ||
|
|
@@ -69,4 +69,21 @@ public void shouldCreateAPayoutAndGetPayoutsDetails() { | |
| assertEquals(payoutId, getPayoutResponse.getData().getId()); | ||
| assertEquals(merchantAccount.getId(), getPayoutResponse.getData().getMerchantAccountId()); | ||
| } | ||
|
|
||
| public static Stream<Arguments> providePayoutsArgumentsForDifferentCurrencies() { | ||
| return Stream.of( | ||
| Arguments.of( | ||
| CurrencyCode.GBP, | ||
| AccountIdentifier.sortCodeAccountNumber() | ||
| .accountNumber("00009650") | ||
| .sortCode("040668") | ||
| .build(), | ||
| SchemeSelection.instantPreferred().build()), | ||
| Arguments.of( | ||
| CurrencyCode.PLN, | ||
| AccountIdentifier.iban().iban("GB25CLRB04066800046876").build(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't use the NRB here because the merchant account generated on the console has a GB IBAN, so NRB validation fails on MAP side (more info in this Slack thread) |
||
| SchemeSelection.preselected() | ||
| .schemeId("polish_domestic_express") | ||
| .build())); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, tests tasks were failing with new Junit version