-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #567 from Mangopay/feature/country-authorizations
added Regulatory API
- Loading branch information
Showing
11 changed files
with
181 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace MangoPay; | ||
|
||
/** | ||
* Class to management MangoPay API for regulatory endpoints | ||
*/ | ||
class ApiRegulatory extends Libraries\ApiBase | ||
{ | ||
/** | ||
* Get country authorizations by country code | ||
* @param string $countryCode | ||
* @return \MangoPay\CountryAuthorization | ||
* @throws Libraries\Exception | ||
*/ | ||
public function GetCountryAuthorizations($countryCode) | ||
{ | ||
return $this->GetObject('country_authorization_get', '\MangoPay\CountryAuthorization', $countryCode, null, null, false); | ||
} | ||
|
||
/** | ||
* Get all countries authorizations | ||
* @param \MangoPay\Pagination $pagination | ||
* @param \MangoPay\Sorting $sorting | ||
* @return \MangoPay\CountryAuthorization[] | ||
* @throws Libraries\Exception | ||
*/ | ||
public function GetAllCountryAuthorizations(& $pagination = null, $sorting = null) | ||
{ | ||
return $this->GetList('country_authorization_all', $pagination, 'MangoPay\CountryAuthorization', null, null, $sorting, null, false); | ||
} | ||
} |
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,44 @@ | ||
<?php | ||
|
||
namespace MangoPay; | ||
|
||
/** | ||
* Repudiation entity | ||
*/ | ||
class CountryAuthorization extends Libraries\EntityBase | ||
{ | ||
/** | ||
* The code of the country in the ISO 3166-1 alpha-2 format. | ||
* @var string | ||
*/ | ||
public $CountryCode; | ||
|
||
/** | ||
* Name of the country | ||
* @var string | ||
*/ | ||
public $CountryName; | ||
|
||
/** | ||
* Information about the country’s restrictions. | ||
* @var CountryAuthorizationData | ||
*/ | ||
public $Authorization; | ||
|
||
/** | ||
* Date and time when at least one of the authorizations has been last updated. | ||
* @var string | ||
*/ | ||
public $LastUpdate; | ||
|
||
/** | ||
* Get array with mapping which property is object and what type of object | ||
* @return array | ||
*/ | ||
public function GetSubObjects() | ||
{ | ||
return [ | ||
'Authorization' => '\MangoPay\CountryAuthorizationData' | ||
]; | ||
} | ||
} |
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,27 @@ | ||
<?php | ||
|
||
namespace MangoPay; | ||
|
||
/** | ||
* Repudiation entity | ||
*/ | ||
class CountryAuthorizationData extends Libraries\EntityBase | ||
{ | ||
/** | ||
* Whether or not user creation is possible based on the user’s country of residence. | ||
* @var boolean | ||
*/ | ||
public $BlockUserCreation; | ||
|
||
/** | ||
* Whether or not bank account creation is possible based on the bank’s country of domiciliation. | ||
* @var boolean | ||
*/ | ||
public $BlockBankAccountCreation; | ||
|
||
/** | ||
* Whether or not payout creation is possible based on the bank’s country of domiciliation. | ||
* @var boolean | ||
*/ | ||
public $BlockPayout; | ||
} |
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 |
---|---|---|
|
@@ -13,4 +13,4 @@ class InstantPayout | |
* @var FallbackReason | ||
*/ | ||
public $UnreachableReason; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -50,4 +50,4 @@ class PayOutEligibilityRequest extends Dto | |
* @var string | ||
*/ | ||
public $PayoutModeRequested; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -11,4 +11,3 @@ class PayOutEligibilityResponse extends Dto | |
*/ | ||
public $InstantPayout; | ||
} | ||
|
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,43 @@ | ||
<?php | ||
|
||
namespace MangoPay\Tests\Cases; | ||
|
||
/** | ||
* Tests basic methods for report requests | ||
*/ | ||
class RegulatoryTest extends Base | ||
{ | ||
public function test_getCountryAuthorizations() | ||
{ | ||
$countryAuthorizations = $this->_api->Regulatory->GetCountryAuthorizations("FR"); | ||
|
||
$this->assertNotNull($countryAuthorizations); | ||
$this->assertNotNull($countryAuthorizations->CountryCode); | ||
$this->assertNotNull($countryAuthorizations->CountryName); | ||
$this->assertNotNull($countryAuthorizations->LastUpdate); | ||
$this->assertNotNull($countryAuthorizations->Authorization); | ||
|
||
$this->assertNotNull($countryAuthorizations->Authorization->BlockBankAccountCreation); | ||
$this->assertNotNull($countryAuthorizations->Authorization->BlockPayout); | ||
$this->assertNotNull($countryAuthorizations->Authorization->BlockUserCreation); | ||
} | ||
|
||
public function test_getAllCountriesAuthorizations() | ||
{ | ||
$countryAuthorizations = $this->_api->Regulatory->GetAllCountryAuthorizations(); | ||
|
||
$this->assertNotNull($countryAuthorizations); | ||
$this->assertTrue(count($countryAuthorizations) > 0); | ||
|
||
foreach ($countryAuthorizations as $authorization) { | ||
$this->assertNotNull($authorization->CountryCode); | ||
$this->assertNotNull($authorization->CountryName); | ||
$this->assertNotNull($authorization->LastUpdate); | ||
$this->assertNotNull($authorization->Authorization); | ||
|
||
$this->assertNotNull($authorization->Authorization->BlockBankAccountCreation); | ||
$this->assertNotNull($authorization->Authorization->BlockPayout); | ||
$this->assertNotNull($authorization->Authorization->BlockUserCreation); | ||
} | ||
} | ||
} |