Skip to content

Commit 328065d

Browse files
committed
RT-5582: added support MerchantAchBankAccount
1 parent 07f4ed5 commit 328065d

4 files changed

Lines changed: 70 additions & 3 deletions

File tree

source/Paysafe/AccountManagement/MerchantAccount.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* @property integer $averageTransactionAmount
2121
* @property \Paysafe\AccountManagement\MerchantDescriptor $merchantDescriptor
2222
* @property \Paysafe\AccountManagement\CaAccountDetails $caAccountDetails
23+
* @property \Paysafe\AccountManagement\UsAccountDetails $usAccountDetails
2324
*/
2425
class MerchantAccount extends \Paysafe\JSONObject implements \Paysafe\Pageable {
2526

@@ -42,5 +43,6 @@ public static function getPageableArrayKey() {
4243
'averageTransactionAmount' => 'int',
4344
'merchantDescriptor' => '\Paysafe\AccountManagement\MerchantDescriptor',
4445
'caAccountDetails' => '\Paysafe\AccountManagement\CaAccountDetails',
46+
'usAccountDetails' => '\Paysafe\AccountManagement\UsAccountDetails',
4547
);
4648
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Paysafe\AccountManagement;
4+
5+
/**
6+
* @package Paysafe\AccountManagement
7+
*
8+
* @property \Paysafe\Link[] $links
9+
* @property string $id
10+
* @property string $accountNumber
11+
* @property string $routingNumber
12+
* @property string $merchantId
13+
*/
14+
class MerchantAchBankAccount extends \Paysafe\JSONObject implements \Paysafe\Pageable {
15+
16+
public static function getPageableArrayKey() {
17+
return "merchantAchBankAccount";
18+
}
19+
20+
protected static $fieldTypes = array(
21+
'links' => 'array:\Paysafe\Link',
22+
'id' => 'string',
23+
'accountNumber' => 'string',
24+
'routingNumber' => 'string',
25+
'merchantId' => 'string'
26+
);
27+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace Paysafe\AccountManagement;
4+
5+
/**
6+
* @package Paysafe\AccountManagement
7+
*
8+
* @property string $type
9+
* @property string $description
10+
*/
11+
class UsAccountDetails extends CaAccountDetails {
12+
}

source/Paysafe/MerchantAccountService.php

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Paysafe\AccountManagement\MerchantAccountBusinessOwner;
99
use Paysafe\AccountManagement\MerchantAccountBusinessOwnerAddress;
1010
use Paysafe\AccountManagement\MerchantAccountBusinessOwnerIdentityDocument;
11+
use Paysafe\AccountManagement\MerchantAchBankAccount;
1112
use Paysafe\AccountManagement\MerchantEftBankAccount;
1213
use Paysafe\AccountManagement\MerchantSubAccount;
1314
use Paysafe\AccountManagement\RecoveryQuestion;
@@ -76,11 +77,12 @@ public function createMerchantAccount(MerchantAccount $merchantAccount)
7677
'phone',
7778
'yearlyVolumeRange',
7879
'averageTransactionAmount',
79-
'merchantDescriptor',
80-
'caAccountDetails'
80+
'merchantDescriptor'
8181
));
8282
$merchantAccount->setOptionalFields(array(
8383
'merchantId',
84+
'caAccountDetails',
85+
'usAccountDetails',
8486
));
8587

8688
$request = new Request(array(
@@ -323,6 +325,29 @@ function addSubMerchantEftBankAccount(MerchantEftBankAccount $bankAccount)
323325
return new MerchantEftBankAccount($response);
324326
}
325327

328+
/**
329+
* Add Merchant Ach Bank Account
330+
*
331+
* @param MerchantEftBankAccount $bankAccount
332+
* @return MerchantEftBankAccount
333+
* @throws PaysafeException
334+
*/
335+
function addSubMerchantAchBankAccount(MerchantAchBankAccount $bankAccount)
336+
{
337+
$bankAccount->setRequiredFields(array(
338+
'accountNumber',
339+
'routingNumber'
340+
));
341+
$request = new Request(array(
342+
'method' => Request::POST,
343+
'uri' => $this->prepareURI('/merchants/' . $bankAccount->merchantId . '/achbankaccounts'),
344+
'body' => $bankAccount
345+
));
346+
$response = $this->client->processRequest($request);
347+
348+
return new MerchantAchBankAccount($response);
349+
}
350+
326351
/**
327352
* Add Sub Merchant Eft Bank Account
328353
*
@@ -401,7 +426,8 @@ function createMerchantSubAccount(MerchantSubAccount $subAccount)
401426
'name'
402427
));
403428
$subAccount->setOptionalFields(array(
404-
'eftId'
429+
'eftId',
430+
'achId'
405431
));
406432
$request = new Request(array(
407433
'method' => Request::POST,

0 commit comments

Comments
 (0)