diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dd42e8..d9fa83b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. ## [Unreleased](https://github.com/xsolla/xsolla-sdk-php/compare/v2.5.0...master) ### Added * Added public user id processing for [User Search](http://developers.xsolla.com/api.html#user-search) webhook method. +* Added support for [Saved Payment Accounts](http://developers.xsolla.com/api.html#direct-payments) API methods to `XsollaClient`. ## [v2.5.0](https://github.com/xsolla/xsolla-sdk-php/compare/v2.4.1...v2.5.0) - 2016-05-18 ### Added diff --git a/src/API/Resources/xsolla-2015-07-23.php b/src/API/Resources/xsolla-2015-07-23.php index 7f202cf..6a609f6 100644 --- a/src/API/Resources/xsolla-2015-07-23.php +++ b/src/API/Resources/xsolla-2015-07-23.php @@ -1889,5 +1889,85 @@ ), ), ), + //Payment Accounts + 'ListPaymentAccounts' => array( + 'httpMethod' => 'GET', + 'uri' => '/merchant/projects/{project_id}/users/{user_id}/payment_accounts', + 'summary' => 'List of the saved payment accounts', + 'parameters' => array( + 'project_id' => array( + 'location' => 'uri', + 'type' => 'integer', + 'required' => true, + ), + 'user_id' => array( + 'location' => 'uri', + 'type' => 'string', + 'required' => true, + ), + ), + ), + 'ChargePaymentAccount' => array( + 'httpMethod' => 'POST', + 'uri' => '/merchant/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}', + 'summary' => 'Charge using the saved payment account', + 'parameters' => array( + 'project_id' => array( + 'location' => 'uri', + 'type' => 'integer', + 'required' => true, + ), + 'user_id' => array( + 'location' => 'uri', + 'type' => 'string', + 'required' => true, + ), + 'type' => array( + 'location' => 'uri', + 'type' => 'string', + 'required' => true, + ), + 'account_id' => array( + 'location' => 'uri', + 'type' => 'integer', + 'required' => true, + ), + 'request' => array( + 'location' => 'body', + 'type' => 'array', + 'required' => true, + 'filters' => array( + '\Xsolla\SDK\API\XsollaClient::jsonEncode', + ), + ), + ), + ), + 'DeletePaymentAccount' => array( + 'httpMethod' => 'DELETE', + 'uri' => '/merchant/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}', + 'summary' => 'Delete the saved payment account', + 'parameters' => array( + 'project_id' => array( + 'location' => 'uri', + 'type' => 'integer', + 'required' => true, + ), + 'user_id' => array( + 'location' => 'uri', + 'type' => 'string', + 'required' => true, + ), + 'type' => array( + 'location' => 'uri', + 'type' => 'string', + 'required' => true, + ), + 'account_id' => array( + 'location' => 'uri', + 'type' => 'integer', + 'required' => true, + ), + ), + ), ), ); diff --git a/src/API/XsollaClient.php b/src/API/XsollaClient.php index e7d5c65..e5a28b5 100644 --- a/src/API/XsollaClient.php +++ b/src/API/XsollaClient.php @@ -107,6 +107,10 @@ * @method array GetProject(array $args = array()) Get a project http://developers.xsolla.com/api.html#get-a-project * @method array UpdateProject(array $args = array()) Update a project http://developers.xsolla.com/api.html#update-a-project * @method array ListProjects(array $args = array()) List all projects http://developers.xsolla.com/api.html#list-all-projects + * + * @method array ListPaymentAccounts(array $args = array()) List of the saved payment accounts http://developers.xsolla.com/api.html#list-saved-payment-accounts + * @method array ChargePaymentAccount(array $args = array()) Charge using the saved payment account http://developers.xsolla.com/api.html#charge-using-saved-payment-account + * @method array DeletePaymentAccount(array $args = array()) Delete the saved payment account http://developers.xsolla.com/api.html#delete-a-saved-payment-account */ class XsollaClient extends Client { diff --git a/tests/Integration/API/PaymentAccountsTest.php b/tests/Integration/API/PaymentAccountsTest.php new file mode 100644 index 0000000..ee04cbb --- /dev/null +++ b/tests/Integration/API/PaymentAccountsTest.php @@ -0,0 +1,38 @@ +xsollaClient->ListPaymentAccounts(array( + 'project_id' => $this->projectId, + 'user_id' => static::$userId, + )); + static::assertInternalType('array', $response); + } + + public function testChargePaymentAccount() + { + static::markTestIncomplete('TODO: 404'); + } + + public function testDeletePaymentAccount() + { + static::markTestIncomplete('TODO: 404'); + } +}