diff --git a/tests/Resources/BalancePlatform/get-account-holder-additional-attributes.json b/tests/Resources/BalancePlatform/get-account-holder-additional-attributes.json new file mode 100644 index 000000000..e56efe8c0 --- /dev/null +++ b/tests/Resources/BalancePlatform/get-account-holder-additional-attributes.json @@ -0,0 +1,44 @@ +{ + "balancePlatform": "YOUR_BALANCE_PLATFORM", + "description": "Account holder used for international payments and payouts", + "legalEntityId": "LE322JV223222D5GG42KN6869", + "reference": "S.Eller-001", + "additionalAttributes": "something", + "capabilities": { + "receiveFromPlatformPayments": { + "enabled": true, + "requested": true, + "allowed": false, + "verificationStatus": "pending" + }, + "receiveFromBalanceAccount": { + "enabled": true, + "requested": true, + "allowed": false, + "verificationStatus": "pending" + }, + "sendToBalanceAccount": { + "enabled": true, + "requested": true, + "allowed": false, + "verificationStatus": "pending" + }, + "sendToTransferInstrument": { + "enabled": true, + "requested": true, + "allowed": false, + "transferInstruments": [ + { + "enabled": true, + "requested": true, + "allowed": false, + "id": "SE322KH223222F5GXZFNM3BGP", + "verificationStatus": "pending" + } + ], + "verificationStatus": "pending" + } + }, + "id": "AH3227C223222C5GXQXF658WB", + "status": "active" +} \ No newline at end of file diff --git a/tests/Resources/BalancePlatform/get-account-holder-unknown-enum.json b/tests/Resources/BalancePlatform/get-account-holder-unknown-enum.json new file mode 100644 index 000000000..7584c46e6 --- /dev/null +++ b/tests/Resources/BalancePlatform/get-account-holder-unknown-enum.json @@ -0,0 +1,43 @@ +{ + "balancePlatform": "YOUR_BALANCE_PLATFORM", + "description": "Account holder used for international payments and payouts", + "legalEntityId": "LE322JV223222D5GG42KN6869", + "reference": "S.Eller-001", + "capabilities": { + "receiveFromPlatformPayments": { + "enabled": true, + "requested": true, + "allowed": false, + "verificationStatus": "this is unknown" + }, + "receiveFromBalanceAccount": { + "enabled": true, + "requested": true, + "allowed": false, + "verificationStatus": "pending" + }, + "sendToBalanceAccount": { + "enabled": true, + "requested": true, + "allowed": false, + "verificationStatus": "pending" + }, + "sendToTransferInstrument": { + "enabled": true, + "requested": true, + "allowed": false, + "transferInstruments": [ + { + "enabled": true, + "requested": true, + "allowed": false, + "id": "SE322KH223222F5GXZFNM3BGP", + "verificationStatus": "pending" + } + ], + "verificationStatus": "pending" + } + }, + "id": "AH3227C223222C5GXQXF658WB", + "status": "active" +} \ No newline at end of file diff --git a/tests/Resources/BalancePlatform/get-account-holder.json b/tests/Resources/BalancePlatform/get-account-holder.json new file mode 100644 index 000000000..6853ee10a --- /dev/null +++ b/tests/Resources/BalancePlatform/get-account-holder.json @@ -0,0 +1,43 @@ +{ + "balancePlatform": "YOUR_BALANCE_PLATFORM", + "description": "Account holder used for international payments and payouts", + "legalEntityId": "LE322JV223222D5GG42KN6869", + "reference": "S.Eller-001", + "capabilities": { + "receiveFromPlatformPayments": { + "enabled": true, + "requested": true, + "allowed": false, + "verificationStatus": "pending" + }, + "receiveFromBalanceAccount": { + "enabled": true, + "requested": true, + "allowed": false, + "verificationStatus": "pending" + }, + "sendToBalanceAccount": { + "enabled": true, + "requested": true, + "allowed": false, + "verificationStatus": "pending" + }, + "sendToTransferInstrument": { + "enabled": true, + "requested": true, + "allowed": false, + "transferInstruments": [ + { + "enabled": true, + "requested": true, + "allowed": false, + "id": "SE322KH223222F5GXZFNM3BGP", + "verificationStatus": "pending" + } + ], + "verificationStatus": "pending" + } + }, + "id": "AH3227C223222C5GXQXF658WB", + "status": "active" +} \ No newline at end of file diff --git a/tests/Unit/AccountHolderTest.php b/tests/Unit/AccountHolderTest.php index 78088c800..e716faa3f 100644 --- a/tests/Unit/AccountHolderTest.php +++ b/tests/Unit/AccountHolderTest.php @@ -67,6 +67,7 @@ public function testAccountHolderCreateSuccess($jsonFile, $httpStatus) ); } + /** * @return array */ diff --git a/tests/Unit/BalancePlatformTest.php b/tests/Unit/BalancePlatformTest.php index ac8ca69d8..f1d5b39ca 100644 --- a/tests/Unit/BalancePlatformTest.php +++ b/tests/Unit/BalancePlatformTest.php @@ -20,6 +20,61 @@ class BalancePlatformTest extends TestCaseMock { + + public function testGetAccountHolder() + { + $client = $this->createMockClientUrl( + 'tests/Resources/BalancePlatform/get-account-holder.json' + ); + + $service = new AccountHoldersApi($client); + $response = $service->getAccountHolder('AH00AH3227C223222C5GXQXF658WB00000001'); + self::assertEquals('AH3227C223222C5GXQXF658WB', $response->getId()); + self::assertEquals(AccountHolder::STATUS_ACTIVE, $response->getStatus()); + self::assertEquals("pending", $response['capabilities']['receiveFromPlatformPayments']['verificationStatus']); + } + + public function testGetAccountHolderAdditionalAttributesDoesNotThrow() + { + + $client = $this->createMockClientUrl( + 'tests/Resources/BalancePlatform/get-account-holder-additional-attributes.json' + ); + + $service = new AccountHoldersApi($client); + + try { + $response = $service->getAccountHolder('AH00AH3227C223222C5GXQXF658WB00000001'); + + self::assertEquals('AH3227C223222C5GXQXF658WB', $response->getId()); + self::assertEquals(AccountHolder::STATUS_ACTIVE, $response->getStatus()); + self::assertEquals("pending", $response['capabilities']['receiveFromPlatformPayments']['verificationStatus']); + } catch (\Throwable $e) { + $this->fail('An unexpected exception was thrown: ' . $e->getMessage()); + } + } + + public function testGetAccountHolderUnknownEnum() + { + $this->markTestSkipped('This test should be enable when enum parsing is fixed.'); + + $client = $this->createMockClientUrl( + 'tests/Resources/BalancePlatform/get-account-holder-unknown-enum.json' + ); + + $service = new AccountHoldersApi($client); + + try { + $response = $service->getAccountHolder('AH00AH3227C223222C5GXQXF658WB00000001'); + + self::assertEquals('AH3227C223222C5GXQXF658WB', $response->getId()); + self::assertEquals(AccountHolder::STATUS_ACTIVE, $response->getStatus()); + self::assertEquals("pending", $response['capabilities']['receiveFromPlatformPayments']['verificationStatus']); + } catch (\Throwable $e) { + $this->fail('An unexpected exception was thrown: ' . $e->getMessage()); + } + } + /** * @throws AdyenException */