diff --git a/MangoPay/ApiUboDeclarations.php b/MangoPay/ApiUboDeclarations.php index 014c93ba..77dd31ad 100644 --- a/MangoPay/ApiUboDeclarations.php +++ b/MangoPay/ApiUboDeclarations.php @@ -92,4 +92,14 @@ public function SubmitForValidation($userId, $uboDeclarationId) $entity->Status = UboDeclarationStatus::ValidationAsked; return $this->SaveObject('ubo_declaration_submit', $entity, '\MangoPay\UboDeclaration', $userId); } + + /** + * Gets an UBO Declaration. + * @param string $uboDeclarationId + * @return UboDeclaration UBO Declaration object returned from API + */ + public function GetUboDeclarationById($uboDeclarationId) + { + return $this->GetObject('ubo_declaration_get_by_id', '\MangoPay\UboDeclaration', $uboDeclarationId); + } } diff --git a/MangoPay/Libraries/ApiBase.php b/MangoPay/Libraries/ApiBase.php index 90c95fe9..27c19b72 100644 --- a/MangoPay/Libraries/ApiBase.php +++ b/MangoPay/Libraries/ApiBase.php @@ -182,6 +182,7 @@ protected function getLogger() 'ubo_create' => array('/users/%s/kyc/ubodeclarations/%s/ubos', RequestType::POST), 'ubo_update' => array('/users/%s/kyc/ubodeclarations/%s/ubos/%s', RequestType::PUT), 'ubo_get' => array('/users/%s/kyc/ubodeclarations/%s/ubos/%s', RequestType::GET), + 'ubo_declaration_get_by_id' => array('/kyc/ubodeclarations/%s', RequestType::GET), 'transactions_get_for_mandate' => array('/mandates/%s/transactions', RequestType::GET), 'transactions_get_for_card' => array('/cards/%s/transactions', RequestType::GET), diff --git a/tests/cases/PayInsTest.php b/tests/cases/PayInsTest.php index 0a522dc4..a06ea568 100644 --- a/tests/cases/PayInsTest.php +++ b/tests/cases/PayInsTest.php @@ -5,6 +5,7 @@ use MangoPay\AVSResult; use MangoPay\Libraries\Exception; use MangoPay\PayInPaymentType; +use MangoPay\PayInStatus; /** @@ -36,7 +37,7 @@ function test_PayIns_Get_CardWeb() $this->assertSame(\MangoPay\PayInExecutionType::Web, $payIn->ExecutionType); $this->assertInstanceOf('\MangoPay\PayInExecutionDetailsWeb', $payIn->ExecutionDetails); $this->assertIdenticalInputProps($payIn, $getPayIn); - $this->assertSame(\MangoPay\PayInStatus::Created, $getPayIn->Status); + $this->assertSame(PayInStatus::Created, $getPayIn->Status); $this->assertNull($getPayIn->ExecutionDate); $this->assertNotNull($getPayIn->ExecutionDetails->RedirectURL); $this->assertNotNull($getPayIn->ExecutionDetails->ReturnURL); @@ -62,7 +63,7 @@ function test_PayIns_Create_CardDirect() $this->assertInstanceOf('\MangoPay\Money', $payIn->Fees); $this->assertEquals($user->Id, $payIn->AuthorId); $this->assertEquals($wallet->Balance->Amount, $beforeWallet->Balance->Amount + $payIn->CreditedFunds->Amount); - $this->assertEquals(\MangoPay\PayInStatus::Succeeded, $payIn->Status); + $this->assertEquals(PayInStatus::Succeeded, $payIn->Status); $this->assertEquals('PAYIN', $payIn->Type); } @@ -135,7 +136,7 @@ function test_PayIns_PreAuthorizedDirect() $this->assertInstanceOf('\MangoPay\Money', $createPayIn->CreditedFunds); $this->assertInstanceOf('\MangoPay\Money', $createPayIn->Fees); $this->assertEquals($user->Id, $createPayIn->AuthorId); - $this->assertEquals(\MangoPay\PayInStatus::Succeeded, $createPayIn->Status); + $this->assertEquals(PayInStatus::Succeeded, $createPayIn->Status); $this->assertEquals('PAYIN', $createPayIn->Type); } @@ -169,7 +170,7 @@ function test_PayIns_BankWireDirect_Create() $this->assertEquals(\MangoPay\PayInExecutionType::Direct, $createPayIn->ExecutionType); $this->assertInstanceOf('\MangoPay\PayInExecutionDetailsDirect', $createPayIn->ExecutionDetails); $this->assertEquals($user->Id, $createPayIn->AuthorId); - $this->assertEquals(\MangoPay\PayInStatus::Created, $createPayIn->Status); + $this->assertEquals(PayInStatus::Created, $createPayIn->Status); $this->assertEquals('PAYIN', $createPayIn->Type); $this->assertNotNull($createPayIn->PaymentDetails->WireReference); $this->assertInstanceOf('\MangoPay\BankAccount', $createPayIn->PaymentDetails->BankAccount); @@ -249,7 +250,7 @@ function test_PayIns_DirectDeDirectDebitWeb_Create() $this->assertInstanceOf('\MangoPay\PayInExecutionDetailsWeb', $createPayIn->ExecutionDetails); $this->assertEquals("FR", $createPayIn->ExecutionDetails->Culture); $this->assertEquals($user->Id, $createPayIn->AuthorId); - $this->assertEquals(\MangoPay\PayInStatus::Created, $createPayIn->Status); + $this->assertEquals(PayInStatus::Created, $createPayIn->Status); $this->assertEquals('PAYIN', $createPayIn->Type); $this->assertInstanceOf('\MangoPay\Money', $createPayIn->DebitedFunds); $this->assertEquals(10000, $createPayIn->DebitedFunds->Amount); @@ -399,7 +400,7 @@ function test_PayIns_Apple_Pay_Create() $this->assertTrue($createPayIn->Id > 0); $this->assertEquals($wallet->Id, $createPayIn->CreditedWalletId); $this->assertEquals($user->Id, $createPayIn->AuthorId); - $this->assertEquals(\MangoPay\PayInStatus::Succeeded, $createPayIn->Status); + $this->assertEquals(PayInStatus::Succeeded, $createPayIn->Status); $this->assertInstanceOf('\MangoPay\Money', $createPayIn->DebitedFunds); $this->assertEquals(199, $createPayIn->DebitedFunds->Amount); $this->assertEquals("EUR", $createPayIn->DebitedFunds->Currency); diff --git a/tests/cases/UboDeclarationsTest.php b/tests/cases/UboDeclarationsTest.php index 10fe69b9..399fe5b5 100644 --- a/tests/cases/UboDeclarationsTest.php +++ b/tests/cases/UboDeclarationsTest.php @@ -47,13 +47,21 @@ function test_GetUboDeclaration() $declaration = $this->getMatrixUboDeclaration(); $matrix = $this->getMatrix(); - $declarationFromApi = $this->_api->UboDeclarations->Get($matrix->Id, $declaration->Id); + $declarationFromApi = $this->_api->UboDeclarations->GET($matrix->Id, $declaration->Id); $this->assertNotNull($declarationFromApi); $this->assertEquals($declaration->Id, $declarationFromApi->Id); } + function test_getUboDeclarationById() + { + $declaration = $this->getMatrixUboDeclaration(); + $declarationFromApi = $this->_api->UboDeclarations->GetUboDeclarationById($declaration->Id); + $this->assertNotNull($declarationFromApi); + $this->assertEquals($declaration->Id, $declarationFromApi->Id); + } + function test_CreateUbo() { $ubo = $this->createNewUboForMatrix();