Skip to content

Commit

Permalink
Merge pull request #362 from Mangopay/issues/MPSDK-345/missing_endpoi…
Browse files Browse the repository at this point in the history
…nt_for_getting_ubo

Missing method/endpoint for getting UBO declaration
  • Loading branch information
mickaelpois authored Dec 31, 2019
2 parents 642175b + 0bb722b commit 88ad670
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
10 changes: 10 additions & 0 deletions MangoPay/ApiUboDeclarations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
1 change: 1 addition & 0 deletions MangoPay/Libraries/ApiBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
13 changes: 7 additions & 6 deletions tests/cases/PayInsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use MangoPay\AVSResult;
use MangoPay\Libraries\Exception;
use MangoPay\PayInPaymentType;
use MangoPay\PayInStatus;


/**
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 9 additions & 1 deletion tests/cases/UboDeclarationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 88ad670

Please sign in to comment.