Skip to content

Commit f7cb16d

Browse files
committed
Amazon Pay PHP SDK 3.3.0
1 parent 0b96d1e commit f7cb16d

File tree

4 files changed

+71
-2
lines changed

4 files changed

+71
-2
lines changed

AmazonPay/Client.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
class Client implements ClientInterface, LoggerAwareInterface
2525
{
26-
const SDK_VERSION = '3.2.0';
26+
const SDK_VERSION = '3.3.0';
2727
const MWS_VERSION = '2013-01-01';
2828
const MAX_ERROR_RETRY = 3;
2929

@@ -529,6 +529,26 @@ private function setProviderCreditReversalDetails($parameters, $providerCreditIn
529529
return $parameters;
530530
}
531531

532+
/* GetMerchantAccountStatus API call - Returns the status of the Merchant Account.
533+
* @see TODO
534+
535+
* @param requestParameters['merchant_id'] - [String]
536+
* @optional requestParameters['mws_auth_token'] - [String]
537+
*/
538+
public function getMerchantAccountStatus($requestParameters = array())
539+
{
540+
$parameters = array();
541+
$parameters['Action'] = 'GetMerchantAccountStatus';
542+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
543+
544+
$fieldMappings = array(
545+
'merchant_id' => 'SellerId',
546+
'mws_auth_token' => 'MWSAuthToken'
547+
);
548+
549+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
550+
return ($responseObject);
551+
}
532552

533553
/* GetOrderReferenceDetails API call - Returns details about the Order Reference object and its current state.
534554
* @see https://pay.amazon.com/developer/documentation/apireference/201751970

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,33 @@ $response = $client->getOrderReferenceDetails($requestParameters);
173173
```
174174
See the [API Response](https://github.com/amzn/amazon-pay-sdk-php#api-response) section for information on parsing the API response.
175175

176+
Below is an example on how to make the GetMerchantAccountStatus API call:
177+
178+
```php
179+
180+
$requestParameters = array();
181+
182+
// Optional Parameter
183+
$requestParameters['mws_auth_token'] = 'MWS_AUTH_TOKEN';
184+
185+
$response = $client->getMerchantAccountStatus($requestParameters);
186+
echo $response->toXml() . "\n";
187+
188+
// Sample Response
189+
<GetMerchantAccountStatusResponse xmlns="http://mws.amazonservices.com/schema/OffAmazonPayments/2013-01-01">
190+
<GetMerchantAccountStatusResult>
191+
<AccountStatus>ACTIVE</AccountStatus>
192+
</GetMerchantAccountStatusResult>
193+
<ResponseMetadata>
194+
<RequestId>b0a141f7-712a-4830-8014-2aa0c446b04e</RequestId>
195+
</ResponseMetadata>
196+
</GetMerchantAccountStatusResponse>
197+
198+
199+
```
200+
See the [API Response](https://github.com/amzn/amazon-pay-sdk-php#api-response) section for information on parsing the API response.
201+
202+
176203
### IPN Handling
177204

178205
1. To receive IPN's successfully you will need an valid SSL on your domain.

dist/amazon-pay.phar

2.48 KB
Binary file not shown.

tst/unit/ClientTest.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class ClientTest extends \PHPUnit_Framework_TestCase
2626

2727
public function testConfigArray()
2828
{
29-
3029
// Test that trimmimg isn't converting the Boolean to a string
3130
$client = new Client($this->configParams);
3231
$this->assertTrue((bool)$client->__get('sandbox'));
@@ -544,6 +543,29 @@ public function testGetRefundDetails()
544543
$this->assertEquals($apiParametersString, $expectedStringParams);
545544
}
546545

546+
public function testGetMerchantAccountStatus()
547+
{
548+
$client = new Client($this->configParams);
549+
$fieldMappings = array(
550+
'merchant_id' => 'SellerId',
551+
'mws_auth_token' => 'MWSAuthToken'
552+
);
553+
554+
$action = 'GetMerchantAccountStatus';
555+
556+
$parameters = $this->setParametersAndPost($fieldMappings, $action);
557+
$expectedParameters = $parameters['expectedParameters'];
558+
$apiCallParams = $parameters['apiCallParams'];
559+
560+
$expectedStringParams = $this->callPrivateMethod($client, 'calculateSignatureAndParametersToString', $expectedParameters);
561+
562+
$response = $client->getMerchantAccountStatus($apiCallParams);
563+
564+
$apiParametersString = $client->getParameters();
565+
566+
$this->assertEquals($apiParametersString, $expectedStringParams);
567+
}
568+
547569
public function testGetServiceStatus()
548570
{
549571
$client = new Client($this->configParams);

0 commit comments

Comments
 (0)