|
4 | 4 |
|
5 | 5 | use Ramsey\Uuid\Uuid;
|
6 | 6 | use TrueLayer\Constants\Currencies;
|
| 7 | +use TrueLayer\Constants\PayoutCurrencies; |
| 8 | +use TrueLayer\Constants\SchemeIds; |
7 | 9 | use TrueLayer\Interfaces\MerchantAccount\MerchantAccountInterface;
|
8 | 10 | use TrueLayer\Interfaces\Payment\AuthorizationFlow\Action\RedirectActionInterface;
|
9 | 11 | use TrueLayer\Interfaces\Payment\PaymentSettledInterface;
|
|
18 | 20 |
|
19 | 21 | $account = Arr::first(
|
20 | 22 | $helper->client()->getMerchantAccounts(),
|
21 |
| - fn (MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
| 23 | + fn(MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
22 | 24 | );
|
23 | 25 |
|
24 | 26 | $merchantBeneficiary = $helper->merchantBeneficiary($account);
|
|
76 | 78 |
|
77 | 79 | $account = Arr::first(
|
78 | 80 | $client->getMerchantAccounts(),
|
79 |
| - fn (MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
| 81 | + fn(MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
80 | 82 | );
|
81 | 83 |
|
82 | 84 | $payoutBeneficiary = $client->payoutBeneficiary()->externalAccount()
|
|
116 | 118 |
|
117 | 119 | $account = Arr::first(
|
118 | 120 | $helper->client()->getMerchantAccounts(),
|
119 |
| - fn (MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
| 121 | + fn(MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
120 | 122 | );
|
121 | 123 |
|
122 | 124 | $merchantBeneficiary = $helper->merchantBeneficiary($account);
|
|
174 | 176 |
|
175 | 177 | $account = Arr::first(
|
176 | 178 | $client->getMerchantAccounts(),
|
177 |
| - fn (MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
| 179 | + fn(MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
178 | 180 | );
|
179 | 181 |
|
180 | 182 | $payoutBeneficiary = $client->payoutBeneficiary()->externalAccount()
|
|
221 | 223 |
|
222 | 224 | $account = Arr::first(
|
223 | 225 | $helper->client()->getMerchantAccounts(),
|
224 |
| - fn (MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
| 226 | + fn(MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
225 | 227 | );
|
226 | 228 |
|
227 | 229 | $merchantBeneficiary = $helper->merchantBeneficiary($account);
|
|
275 | 277 |
|
276 | 278 | $account = Arr::first(
|
277 | 279 | $client->getMerchantAccounts(),
|
278 |
| - fn (MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
| 280 | + fn(MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
279 | 281 | );
|
280 | 282 |
|
281 | 283 | $payoutBeneficiary = $client->payoutBeneficiary()->externalAccount()
|
|
318 | 320 |
|
319 | 321 | $account = Arr::first(
|
320 | 322 | $client->getMerchantAccounts(),
|
321 |
| - fn (MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
| 323 | + fn(MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
322 | 324 | );
|
323 | 325 |
|
324 | 326 | $payoutBeneficiary = $client->payoutBeneficiary()->externalAccount()
|
|
354 | 356 |
|
355 | 357 | $account = Arr::first(
|
356 | 358 | $client->getMerchantAccounts(),
|
357 |
| - fn (MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
| 359 | + fn(MerchantAccountInterface $account) => $account->getCurrency() === 'GBP' |
358 | 360 | );
|
359 | 361 |
|
360 | 362 | $payoutBeneficiary = $client->payoutBeneficiary()->externalAccount()
|
|
376 | 378 |
|
377 | 379 | \expect($response->getId())->toBeString();
|
378 | 380 |
|
379 |
| - /** @var PayoutRetrievedInterface $payout */ |
| 381 | + $payout = $client->getPayout($response->getId()); |
| 382 | + |
| 383 | + \expect($payout)->toBeInstanceOf(PayoutRetrievedInterface::class); |
| 384 | +}); |
| 385 | + |
| 386 | +\it('creates PLN payout', function () { |
| 387 | + $client = \client(); |
| 388 | + |
| 389 | + $account = Arr::first( |
| 390 | + $client->getMerchantAccounts(), |
| 391 | + fn(MerchantAccountInterface $account) => $account->getCurrency() === PayoutCurrencies::PLN |
| 392 | + ); |
| 393 | + |
| 394 | + $payoutBeneficiary = $client->payoutBeneficiary()->externalAccount() |
| 395 | + ->accountIdentifier( |
| 396 | + $client->accountIdentifier()->iban()->iban('GB29NWBK60161331926819') |
| 397 | + ) |
| 398 | + ->accountHolderName('Test name') |
| 399 | + ->reference('Test reference'); |
| 400 | + |
| 401 | + $schemeSelection = $client->payoutSchemeSelection()->preselected()->schemeId(SchemeIds::POLISH_DOMESTIC_EXPRESS); |
| 402 | + |
| 403 | + $response = $client->payout() |
| 404 | + ->amountInMinor(1) |
| 405 | + ->currency(PayoutCurrencies::PLN) |
| 406 | + ->merchantAccountId($account->getId()) |
| 407 | + ->beneficiary($payoutBeneficiary) |
| 408 | + ->schemeSelection($schemeSelection) |
| 409 | + ->create(); |
| 410 | + |
| 411 | + \expect($response->getId())->toBeString(); |
| 412 | + |
380 | 413 | $payout = $client->getPayout($response->getId());
|
381 | 414 |
|
382 | 415 | \expect($payout)->toBeInstanceOf(PayoutRetrievedInterface::class);
|
|
0 commit comments