From 19e8c2003ab71c747d06cf2a0c64861cbc18f609 Mon Sep 17 00:00:00 2001 From: Beppe Catanese <1771700+gcatanese@users.noreply.github.com> Date: Wed, 2 Jul 2025 11:25:50 +0000 Subject: [PATCH 1/2] Add tests for unknown enums and attributes --- ...-account-holder-additional-attributes.json | 44 +++++++++++++++ .../get-account-holder-unknown-enum.json | 43 +++++++++++++++ .../BalancePlatform/get-account-holder.json | 43 +++++++++++++++ tests/Unit/AccountHolderTest.php | 1 + tests/Unit/BalancePlatformTest.php | 55 +++++++++++++++++++ 5 files changed, 186 insertions(+) create mode 100644 tests/Resources/BalancePlatform/get-account-holder-additional-attributes.json create mode 100644 tests/Resources/BalancePlatform/get-account-holder-unknown-enum.json create mode 100644 tests/Resources/BalancePlatform/get-account-holder.json 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..d1991e226 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 */ From 6a267569b213be60a130da4806c0c6a60c107b0f Mon Sep 17 00:00:00 2001 From: Beppe Catanese <1771700+gcatanese@users.noreply.github.com> Date: Wed, 2 Jul 2025 11:39:20 +0000 Subject: [PATCH 2/2] Format code --- tests/Unit/BalancePlatformTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Unit/BalancePlatformTest.php b/tests/Unit/BalancePlatformTest.php index d1991e226..f1d5b39ca 100644 --- a/tests/Unit/BalancePlatformTest.php +++ b/tests/Unit/BalancePlatformTest.php @@ -38,7 +38,7 @@ public function testGetAccountHolderAdditionalAttributesDoesNotThrow() { $client = $this->createMockClientUrl( - 'tests/Resources/BalancePlatform/get-account-holder-additional-attributes.json' + 'tests/Resources/BalancePlatform/get-account-holder-additional-attributes.json' ); $service = new AccountHoldersApi($client);