diff --git a/AmazonPay/Client.php b/AmazonPay/Client.php index 5b1d2d7..09b57eb 100644 --- a/AmazonPay/Client.php +++ b/AmazonPay/Client.php @@ -23,7 +23,7 @@ class Client implements ClientInterface, LoggerAwareInterface { - const SDK_VERSION = '3.3.2'; + const SDK_VERSION = '3.4.0'; const MWS_VERSION = '2013-01-01'; const MAX_ERROR_RETRY = 3; @@ -431,7 +431,7 @@ private function setDefaultValues($parameters, $fieldMappings, $requestParameter if (array_key_exists('currency_code', $fieldMappings)) { if (!empty($requestParameters['currency_code'])) { $parameters[$fieldMappings['currency_code']] = strtoupper($requestParameters['currency_code']); - } else if (!(array_key_exists('Action', $parameters) && $parameters['Action'] === 'SetOrderAttributes')) { + } else if (!(array_key_exists('Action', $parameters) && ( $parameters['Action'] === 'SetOrderAttributes' || $parameters['Action'] === 'ConfirmOrderReference'))) { // Only supply a default CurrencyCode parameter if not using SetOrderAttributes API $parameters[$fieldMappings['currency_code']] = strtoupper($this->config['currency_code']); } @@ -757,6 +757,10 @@ public function setOrderAttributes($requestParameters = array()) * @param requestParameters['merchant_id'] - [String] * @param requestParameters['amazon_order_reference_id'] - [String] + * @optional requestParameters['success_url'] - [String]' + * @optional requestParameters['failure_url'] - [String] + * @optional requestParameters['authorization_amount'] - [String] + * @optional requestParameters['currency_code'] - [String] * @optional requestParameters['mws_auth_token'] - [String] */ public function confirmOrderReference($requestParameters = array()) @@ -766,12 +770,21 @@ public function confirmOrderReference($requestParameters = array()) $requestParameters = array_change_key_case($requestParameters, CASE_LOWER); $fieldMappings = array( - 'merchant_id' => 'SellerId', + 'merchant_id' => 'SellerId', 'amazon_order_reference_id' => 'AmazonOrderReferenceId', - 'mws_auth_token' => 'MWSAuthToken' + 'success_url' => 'SuccessUrl', + 'failure_url' => 'FailureUrl', + 'authorization_amount' => 'AuthorizationAmount.Amount', + 'currency_code' => 'AuthorizationAmount.CurrencyCode', + 'mws_auth_token' => 'MWSAuthToken' ); + if ($requestParameters['authorization_amount'] && !$requestParameters['currency_code']) { + $requestParameters['currency_code'] = strtoupper($this->config['currency_code']); + } + $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters); + return ($responseObject); } @@ -1083,6 +1096,7 @@ public function getServiceStatus($requestParameters = array()) * @optional requestParameters['seller_note'] - [String] * @optional requestParameters['seller_order_id'] - [String] * @optional requestParameters['store_name'] - [String] + * @optional requestParameters['supplementary_data'] - [String] * @optional requestParameters['custom_information'] - [String] * @optional requestParameters['mws_auth_token'] - [String] */ @@ -1104,6 +1118,7 @@ public function createOrderReferenceForId($requestParameters = array()) 'seller_note' => 'OrderReferenceAttributes.SellerNote', 'seller_order_id' => 'OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId', 'store_name' => 'OrderReferenceAttributes.SellerOrderAttributes.StoreName', + 'supplementary_data' => 'OrderReferenceAttributes.SupplementaryData', 'custom_information' => 'OrderReferenceAttributes.SellerOrderAttributes.CustomInformation', 'mws_auth_token' => 'MWSAuthToken' ); @@ -1245,6 +1260,7 @@ public function validateBillingAgreement($requestParameters = array()) * @optional requestParameters['custom_information'] - [String] * @optional requestParameters['seller_order_id'] - [String] * @optional requestParameters['store_name'] - [String] + * @optional requestParameters['supplementary_data'] - [String] * @optional requestParameters['inherit_shipping_address'] [Boolean] - Defaults to true * @optional requestParameters['mws_auth_token'] - [String] */ @@ -1269,6 +1285,7 @@ public function authorizeOnBillingAgreement($requestParameters = array()) 'custom_information' => 'SellerOrderAttributes.CustomInformation', 'seller_order_id' => 'SellerOrderAttributes.SellerOrderId', 'store_name' => 'SellerOrderAttributes.StoreName', + 'supplementary_data' => 'SellerOrderAttributes.SupplementaryData', 'inherit_shipping_address' => 'InheritShippingAddress', 'mws_auth_token' => 'MWSAuthToken' ); diff --git a/CHANGES.txt b/CHANGES.txt index 703ea98..31be701 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +3.4.0 - January 2019 +- Added new supplementary_data attribute for AuthorizeOnBillingAgreement and CreateOrderReferenceForId. +- Added additional attributes (success_url, failure_url, authorization_amount, currency_code) to ConfirmOrderReference. Amazon Pay Strong Customer Authentication (SCA) Upgrade Integration Guide + 3.3.2 - August 2018 - Added method for listOrderReference API call - Added method for listOrderReferenceByNextToken API call diff --git a/NOTICE.txt b/NOTICE.txt index bd763d8..3c15e1a 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,6 +1,6 @@ *-*-**-***-*****-********-************* Amazon Pay SDK (PHP) -Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +Copyright 2013-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); *-*-**-***-*****-********-************* diff --git a/composer.json b/composer.json index 7be1be7..e1c951f 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "amzn/amazon-pay-sdk-php", "type": "library", "description": "Amazon Pay SDK (PHP)", - "version": "3.3.2", + "version": "3.4.0", "keywords": [ "amazon", "pay", diff --git a/dist/amazon-pay.phar b/dist/amazon-pay.phar deleted file mode 100644 index 4a900c1..0000000 Binary files a/dist/amazon-pay.phar and /dev/null differ diff --git a/tst/unit/ClientTest.php b/tst/unit/ClientTest.php index dcbe7e4..5b0703b 100644 --- a/tst/unit/ClientTest.php +++ b/tst/unit/ClientTest.php @@ -8,20 +8,20 @@ class ClientTest extends \PHPUnit_Framework_TestCase { private $configParams = array( - 'merchant_id' => 'MERCHANT1234567', - 'access_key' => 'ABCDEFGHI1JKLMN2O7', - 'secret_key' => "abc123Def456gHi789jKLmpQ987rstu6vWxyz", - 'currency_code' => 'usd', - 'client_id' => 'amzn1.application-oa2-client.45789c45a8f34927830be1d9e029f480', - 'region' => 'us', - 'sandbox' => true, - 'platform_id' => 'test', - 'application_name' => 'sdk testing', - 'application_version' => '1.0', - 'proxy_host' => null, - 'proxy_port' => -1, - 'proxy_username' => null, - 'proxy_Password' => null + 'merchant_id' => 'MERCHANT1234567', + 'access_key' => 'ABCDEFGHI1JKLMN2O7', + 'secret_key' => "abc123Def456gHi789jKLmpQ987rstu6vWxyz", + 'currency_code' => 'usd', + 'client_id' => 'amzn1.application-oa2-client.45789c45a8f34927830be1d9e029f480', + 'region' => 'us', + 'sandbox' => true, + 'platform_id' => 'test', + 'application_name' => 'sdk testing', + 'application_version' => '1.0', + 'proxy_host' => null, + 'proxy_port' => -1, + 'proxy_username' => null, + 'proxy_Password' => null ); public function testConfigArray() @@ -358,7 +358,11 @@ public function testConfirmOrderReference() $fieldMappings = array( 'merchant_id' => 'SellerId', 'amazon_order_reference_id' => 'AmazonOrderReferenceId', - 'mws_auth_token' => 'MWSAuthToken' + 'mws_auth_token' => 'MWSAuthToken', + 'success_url' => 'SuccessUrl', + 'failure_url' => 'FailureUrl', + 'authorization_amount' => 'AuthorizationAmount.Amount', + 'currency_code' => 'AuthorizationAmount.CurrencyCode' ); $action = 'ConfirmOrderReference';