-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds tests and fixes issues in ApiMethods
- Loading branch information
1 parent
7cfb74c
commit 5b065f2
Showing
7 changed files
with
135 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace MangoPay; | ||
|
||
class VirtualAccountAvailabilities | ||
{ | ||
/** | ||
* * @var VirtualAccountAvailability[] | ||
*/ | ||
public $Collection; | ||
|
||
/** | ||
* * @var VirtualAccountAvailability[] | ||
*/ | ||
public $UserOwned; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace MangoPay; | ||
|
||
class VirtualAccountAvailability | ||
{ | ||
/** | ||
* ISO 3166-1 alpha-2 format is expected | ||
* * @var string | ||
*/ | ||
public $Country; | ||
|
||
/** | ||
* Whether international bank wires can be made to this account | ||
* @var Boolean | ||
*/ | ||
public $Available; | ||
|
||
/** | ||
* List of currencies supported by the account | ||
* @var CurrencyIso[] | ||
* */ | ||
public $Currencies; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace MangoPay\Tests\Cases; | ||
|
||
use MangoPay\VirtualAccount; | ||
use MangoPay\Wallet; | ||
use function PHPUnit\Framework\assertNotTrue; | ||
|
||
/** | ||
* Tests basic methods for Virtual Accounts | ||
*/ | ||
class VirtualAccountsTest extends Base | ||
{ | ||
/** | ||
* @var \MangoPay\VirtualAccount | ||
*/ | ||
public static $johnsVirtualAccount; | ||
public function test_VirtualAccount_Create() | ||
{ | ||
$wallet = $this->getJohnsWallet(); | ||
$virtualAccount = new VirtualAccount(); | ||
$virtualAccount->Country = "FR"; | ||
$virtualAccount->VirtualAccountPurpose = "Collection"; | ||
$virtualAccount->Tag = "create virtual account tag"; | ||
|
||
self::$johnsVirtualAccount = $this->_api->VirtualAccounts->Create($virtualAccount, $wallet->Id); | ||
|
||
$this->assertNotNull(self::$johnsVirtualAccount); | ||
$this->assertEquals(self::$johnsVirtualAccount->WalletId, $wallet->Id); | ||
} | ||
|
||
public function test_VirtualAccount_Get() | ||
{ | ||
$wallet = $this->getJohnsWallet(); | ||
|
||
$virtualAccounts = $this->_api->VirtualAccounts->GetAll($wallet->Id); | ||
|
||
$this->assertNotNull($virtualAccounts); | ||
$this->assertTrue(is_array($virtualAccounts), 'Expected an array'); | ||
} | ||
|
||
public function test_VirtualAccount_GetAll() | ||
{ | ||
$wallet = $this->getJohnsWallet(); | ||
|
||
$virtualAccounts = $this->_api->VirtualAccounts->GetAll($wallet->Id); | ||
|
||
$this->assertNotNull($virtualAccounts); | ||
$this->assertTrue(is_array($virtualAccounts), 'Expected an array'); | ||
} | ||
|
||
public function test_VirtualAccount_Get_Availabilities() | ||
{ | ||
$virtualAccountAvailabilities = $this->_api->VirtualAccounts->GetAvailabilities(); | ||
|
||
$this->assertNotNull($virtualAccountAvailabilities); | ||
$this->assertTrue(is_array($virtualAccountAvailabilities->Collection), 'Expected an array'); | ||
$this->assertTrue(is_array($virtualAccountAvailabilities->UserOwned), 'Expected an array'); | ||
} | ||
|
||
public function test_VirtualAccount_Deactivate() | ||
{ | ||
$wallet = $this->getJohnsWallet(); | ||
self::$johnsVirtualAccount->Active = false; | ||
$deactivatedVirtualAccount = $this->_api->VirtualAccounts->Deactivate(self::$johnsVirtualAccount, $wallet->Id, self::$johnsVirtualAccount->Id); | ||
|
||
$this->assertNotTrue($deactivatedVirtualAccount->Active); | ||
} | ||
} |