Skip to content

Commit 7cfb74c

Browse files
committed
Adds VirtualAccount Object, ApiService and Create, Get, GetAll Endpoints
1 parent 21b90ee commit 7cfb74c

13 files changed

+287
-1
lines changed

MangoPay/ApiUsers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public function CreateKycPageFromFile($userId, $kycDocumentId, $filePath, $idemp
337337
* @param string $userId User Id
338338
* @param $year
339339
* @param $month
340-
* @return \MangoPay\EMoney EMoney obhect returned from API
340+
* @return \MangoPay\EMoney EMoney object returned from API
341341
* @throws Libraries\Exception
342342
*/
343343
public function GetEMoney($userId, $year = null, $month = null)

MangoPay/ApiVirtualAccounts.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace MangoPay;
4+
5+
class ApiVirtualAccounts extends Libraries\ApiBase
6+
{
7+
/**
8+
* Create new Virtual Account
9+
* @param String $walletId
10+
* @return \MangoPay\VirtualAccount Wallet object returned from API
11+
*/
12+
public function Create($walletId, $idempotencyKey = null)
13+
{
14+
return $this->CreateObject('virtual_account_create', $walletId, '\MangoPay\VirtualAccount', null, null, $idempotencyKey);
15+
}
16+
17+
/**
18+
* @param string $walletId
19+
* @param string $virtualAccountId
20+
* @return \MangoPay\VirtualAccount
21+
*/
22+
public function Get($walletId, $virtualAccountId)
23+
{
24+
return $this->GetObject('virtual_account_get', '\MangoPay\VirtualAccount', $walletId, $virtualAccountId);
25+
}
26+
27+
/**
28+
* @param \MangoPay\Pagination $pagination Pagination object
29+
* @param string $walletId
30+
* @return \MangoPay\VirtualAccount[]
31+
*/
32+
public function GetAll($walletId)
33+
{
34+
return $this->GetList('virtual_account_get_all', $pagination, '\MangoPay\VirtualAccount', $walletId);
35+
}
36+
37+
public function Deactivate($walletId, $idempotencyKey = null)
38+
{
39+
}
40+
41+
public function GetAvailabilities($walletId, $idempotencyKey = null)
42+
{
43+
}
44+
}

MangoPay/InternationalAccount.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace MangoPay;
4+
5+
class InternationalAccount
6+
{
7+
/**
8+
* @var string
9+
*/
10+
public $Iban;
11+
12+
/**
13+
* @var string
14+
*/
15+
public $Bic;
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace MangoPay;
4+
5+
class InternationalAccountDetails
6+
{
7+
/**
8+
* Information about the address associated with the international IBAN account.
9+
* @var VirtualAccountAddress
10+
*/
11+
public $Address;
12+
13+
/**
14+
* The IBAN and BIC of the account.
15+
* @var InternationalAccount
16+
*/
17+
public $Account;
18+
}

MangoPay/Libraries/ApiBase.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ protected function getLogger()
233233
'get_conversion' => ['/conversions/%s', RequestType::GET],
234234
'create_conversion_quote' => ['/conversions/quote', RequestType::POST],
235235
'get_conversion_quote' => ['/conversions/quote/%s', RequestType::GET],
236+
237+
'virtual_account_create' => ['/wallets/%s/virtual-accounts', RequestType::POST],
238+
'virtual_account_deactivate' => ['/wallets/%s/virtual-accounts/%s', RequestType::PUT],
239+
'virtual_account_get' => ['/wallets/%s/virtual-accounts/%s', RequestType::GET],
240+
'virtual_account_get_all' => ['/wallets/%s/virtual-accounts', RequestType::GET],
241+
'virtual_account_get_availabilities' => ['/virtual-accounts/availability', RequestType::GET]
236242
];
237243

238244
/**
@@ -615,6 +621,7 @@ protected function GetObjectForIdempotencyUrl($url)
615621
'users_createbankaccounts_us' => '\MangoPay\BankAccount',
616622
'users_createbankaccounts_ca' => '\MangoPay\BankAccount',
617623
'users_createbankaccounts_other' => '\MangoPay\BankAccount',
624+
'virtual_accounts_create' => '\MangoPay\VirtualAccount',
618625
'kyc_documents_create' => '\MangoPay\KycDocument',
619626
'kyc_page_create' => '',
620627
'wallets_create' => '\MangoPay\Wallet',

MangoPay/LocalAccount.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace MangoPay;
4+
5+
class LocalAccount
6+
{
7+
/**
8+
* The account number of the account
9+
*/
10+
public $AccountNumber;
11+
12+
/**
13+
* The sort code of the account.
14+
*/
15+
public $SortCode;
16+
}

MangoPay/LocalAccountDetails.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace MangoPay;
4+
5+
class LocalAccountDetails
6+
{
7+
/**
8+
* Information about the address associated with the local IBAN account.
9+
* @var VirtualAccountAddress
10+
*/
11+
public $Address;
12+
13+
/**
14+
* Information about the address associated with the local IBAN account.
15+
* @var LocalAccount
16+
*/
17+
public $Account;
18+
}

MangoPay/VirtualAccount.php

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
3+
namespace MangoPay;
4+
5+
/**
6+
* Virtual Account entity
7+
*/
8+
class VirtualAccount extends Libraries\EntityBase
9+
{
10+
/**
11+
* The ID of the wallet
12+
* @var string
13+
*/
14+
public $WalletId;
15+
16+
/**
17+
* The credited user ID
18+
* @var string
19+
*/
20+
public $CreditedUserId;
21+
22+
/**
23+
* The type of the virtual account
24+
* Allowed values: `COLLECTION`, `USER_OWNED`
25+
* @var string
26+
* @see \MangoPay\VirtualAccountPurpose
27+
*/
28+
public $VirtualAccountPurpose;
29+
30+
/**
31+
* The country of the IBAN. The country must correspond to the currency of the wallet
32+
* ISO 3166-1 alpha-2 format is expected
33+
* @var string
34+
*/
35+
public $Country;
36+
37+
/**
38+
* The status of the virtual account creation
39+
* Allowed values: `COLLECTION`, `USER_OWNED`
40+
* @var string
41+
* @see \MangoPay\VirtualAccountStatus
42+
*/
43+
public $Status;
44+
45+
/**
46+
* Whether the banking alias is active or not
47+
* @var bool
48+
*/
49+
public $Active;
50+
51+
/**
52+
* The current Status of the Virtual Account
53+
* Allowed values: `COLLECTION`, `USER_OWNED`
54+
* @var string
55+
* @see \MangoPay\VirtualAccountOwner
56+
*/
57+
public $AccountOwner;
58+
59+
/**
60+
* The current Status of the Virtual Account
61+
* @var \MangoPay\LocalAccountDetails
62+
*/
63+
public $LocalAccountsDetails;
64+
65+
/**
66+
* The current Status of the Virtual Account
67+
* @var \MangoPay\InternationalAccountDetails
68+
*/
69+
public $InternationalAccountDetails;
70+
71+
/**
72+
* The current Status of the Virtual Account
73+
* @var \MangoPay\VirtualAccountCapabilities
74+
*/
75+
public $Capabilities;
76+
77+
78+
}

MangoPay/VirtualAccountAddress.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace MangoPay;
4+
5+
class VirtualAccountAddress
6+
{
7+
/**
8+
* @var string
9+
*/
10+
public $StreetName;
11+
12+
/**
13+
* @var string
14+
*/
15+
public $PostCode;
16+
17+
/**
18+
* @var string
19+
*/
20+
public $TownName;
21+
22+
/**
23+
* @var string
24+
*/
25+
public $CountrySubDivision;
26+
27+
/**
28+
* @var string
29+
*/
30+
public $Country;
31+
32+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace MangoPay;
4+
5+
class VirtualAccountCapabilities
6+
{
7+
/**
8+
* Whether local bank wires can be made to this account.
9+
* @var Boolean
10+
*/
11+
public $LocalPayInAvailable;
12+
13+
/**
14+
* Whether international bank wires can be made to this account
15+
* @var Boolean
16+
*/
17+
public $InternationalPayInAvailable;
18+
19+
/**
20+
* List of currencies supported by the account
21+
* @var CurrencyIso[]
22+
*/
23+
public $Currencies;
24+
}

0 commit comments

Comments
 (0)