|
11 | 11 | use MangoPay\BrowserInfo; |
12 | 12 | use MangoPay\CreateDeposit; |
13 | 13 | use MangoPay\CurrencyIso; |
| 14 | +use MangoPay\IndividualRecipient; |
14 | 15 | use MangoPay\LegalPersonType; |
15 | 16 | use MangoPay\LegalRepresentative; |
16 | 17 | use MangoPay\Libraries\Exception; |
|
21 | 22 | use MangoPay\PayInIntentExternalData; |
22 | 23 | use MangoPay\PayInIntentLineItem; |
23 | 24 | use MangoPay\PayInIntentSeller; |
| 25 | +use MangoPay\Recipient; |
24 | 26 | use MangoPay\ShippingPreference; |
25 | 27 | use MangoPay\Tests\Mocks\MockStorageStrategy; |
26 | 28 | use MangoPay\Ubo; |
@@ -824,29 +826,36 @@ protected function getJohnsPayOutForCardDirect() |
824 | 826 | $payIn = $this->getNewPayInCardDirect(); |
825 | 827 | $account = $this->getJohnsAccount(); |
826 | 828 |
|
827 | | - $payOut = new \MangoPay\PayOut(); |
828 | | - $payOut->Tag = 'DefaultTag'; |
829 | | - $payOut->AuthorId = $payIn->AuthorId; |
830 | | - $payOut->CreditedUserId = $payIn->AuthorId; |
831 | | - $payOut->DebitedFunds = new \MangoPay\Money(); |
832 | | - $payOut->DebitedFunds->Currency = 'EUR'; |
833 | | - $payOut->DebitedFunds->Amount = 10; |
834 | | - $payOut->Fees = new \MangoPay\Money(); |
835 | | - $payOut->Fees->Currency = 'EUR'; |
836 | | - $payOut->Fees->Amount = 5; |
837 | | - |
838 | | - $payOut->DebitedWalletId = $payIn->CreditedWalletId; |
839 | | - $payOut->MeanOfPaymentDetails = new \MangoPay\PayOutPaymentDetailsBankWire(); |
| 829 | + $payOut = $this->getNewPayOutDto($payIn->AuthorId, $payIn->CreditedWalletId); |
840 | 830 | $payOut->MeanOfPaymentDetails->BankAccountId = $account->Id; |
841 | | - $payOut->MeanOfPaymentDetails->BankWireRef = 'Johns payment'; |
842 | | - $payOut->MeanOfPaymentDetails->PayoutModeRequested = 'STANDARD'; |
843 | 831 |
|
844 | 832 | self::$JohnsPayOutForCardDirect = $this->_api->PayOuts->Create($payOut); |
845 | 833 | } |
846 | 834 |
|
847 | 835 | return self::$JohnsPayOutForCardDirect; |
848 | 836 | } |
849 | 837 |
|
| 838 | + protected function getNewPayOutDto($authorId, $walletId) |
| 839 | + { |
| 840 | + $payOut = new \MangoPay\PayOut(); |
| 841 | + $payOut->Tag = 'DefaultTag'; |
| 842 | + $payOut->AuthorId = $authorId; |
| 843 | + $payOut->CreditedUserId = $authorId; |
| 844 | + $payOut->DebitedFunds = new \MangoPay\Money(); |
| 845 | + $payOut->DebitedFunds->Currency = 'EUR'; |
| 846 | + $payOut->DebitedFunds->Amount = 10; |
| 847 | + $payOut->Fees = new \MangoPay\Money(); |
| 848 | + $payOut->Fees->Currency = 'EUR'; |
| 849 | + $payOut->Fees->Amount = 5; |
| 850 | + |
| 851 | + $payOut->DebitedWalletId = $walletId; |
| 852 | + $payOut->MeanOfPaymentDetails = new \MangoPay\PayOutPaymentDetailsBankWire(); |
| 853 | + $payOut->MeanOfPaymentDetails->BankWireRef = 'Johns payment'; |
| 854 | + $payOut->MeanOfPaymentDetails->PayoutModeRequested = 'STANDARD'; |
| 855 | + |
| 856 | + return $payOut; |
| 857 | + } |
| 858 | + |
850 | 859 | /** |
851 | 860 | * Creates Pay-In Card Direct object |
852 | 861 | * @return \MangoPay\PayIn |
@@ -2275,4 +2284,29 @@ protected function getNewPayInIntentAuthorization() |
2275 | 2284 |
|
2276 | 2285 | return $this->_api->PayIns->CreatePayInIntentAuthorization($toCreate); |
2277 | 2286 | } |
| 2287 | + |
| 2288 | + protected function getNewRecipientObject() |
| 2289 | + { |
| 2290 | + $localBankTransfer = []; |
| 2291 | + $gbpDetails = []; |
| 2292 | + $gbpDetails["SortCode"] = "010039"; |
| 2293 | + $gbpDetails["AccountNumber"] = "11696419"; |
| 2294 | + $localBankTransfer["GBP"] = $gbpDetails; |
| 2295 | + |
| 2296 | + $individualRecipient = new IndividualRecipient(); |
| 2297 | + $individualRecipient->FirstName = "Payout"; |
| 2298 | + $individualRecipient->LastName = "Team"; |
| 2299 | + $individualRecipient->Address = $this->getNewAddress(); |
| 2300 | + |
| 2301 | + $recipient = new Recipient(); |
| 2302 | + $recipient->DisplayName = "My GB account"; |
| 2303 | + $recipient->PayoutMethodType = "LocalBankTransfer"; |
| 2304 | + $recipient->RecipientType = "Individual"; |
| 2305 | + $recipient->Currency = CurrencyIso::GBP; |
| 2306 | + $recipient->IndividualRecipient = $individualRecipient; |
| 2307 | + $recipient->LocalBankTransfer = $localBankTransfer; |
| 2308 | + $recipient->Country = "GB"; |
| 2309 | + |
| 2310 | + return $recipient; |
| 2311 | + } |
2278 | 2312 | } |
0 commit comments