Skip to content

Commit aff849d

Browse files
committed
Amazon Pay PHP SDK 3.4.1
1 parent 4abae04 commit aff849d

File tree

5 files changed

+83
-4
lines changed

5 files changed

+83
-4
lines changed

AmazonPay/Client.php

Lines changed: 1 addition & 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.4.0';
26+
const SDK_VERSION = '3.4.1';
2727
const MWS_VERSION = '2013-01-01';
2828
const MAX_ERROR_RETRY = 3;
2929

AmazonPay/IpnHandler.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ private function validateUrl($url)
255255
/* Verify that the signature is correct for the given data and
256256
* public key
257257
*
258-
* @param string $data data to validate
259258
* @param string $signature decoded signature to compare against
260259
* @param string $certificatePath path to certificate, can be file or url
261260
*

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
3.4.1 - February 2019
2+
- Fix undefined index message in ConfirmOrderReference
3+
14
3.4.0 - January 2019
25
- Added new supplementary_data attribute for AuthorizeOnBillingAgreement and CreateOrderReferenceForId.
36
- Added additional attributes (success_url, failure_url, authorization_amount, currency_code) to ConfirmOrderReference. Amazon Pay Strong Customer Authentication (SCA) Upgrade Integration Guide

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "amzn/amazon-pay-sdk-php",
33
"type": "library",
44
"description": "Amazon Pay SDK (PHP)",
5-
"version": "3.4.0",
5+
"version": "3.4.1",
66
"keywords": [
77
"amazon",
88
"pay",

tst/unit/ClientTest.php

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public function testSetOrderAttributesAfterConfirm()
352352
$this->assertEquals($apiParametersString, $expectedStringParams);
353353
}
354354

355-
public function testConfirmOrderReference()
355+
public function testConfirmOrderReferenceWithAllSCA()
356356
{
357357
$client = new Client($this->configParams);
358358
$fieldMappings = array(
@@ -380,6 +380,83 @@ public function testConfirmOrderReference()
380380
$this->assertEquals($apiParametersString, $expectedStringParams);
381381
}
382382

383+
public function testConfirmOrderReferenceWithAllButCurrencyCodeSCA()
384+
{
385+
$client = new Client($this->configParams);
386+
$fieldMappings = array(
387+
'merchant_id' => 'SellerId',
388+
'amazon_order_reference_id' => 'AmazonOrderReferenceId',
389+
'mws_auth_token' => 'MWSAuthToken',
390+
'success_url' => 'SuccessUrl',
391+
'failure_url' => 'FailureUrl',
392+
'authorization_amount' => 'AuthorizationAmount.Amount'
393+
);
394+
395+
$action = 'ConfirmOrderReference';
396+
397+
$parameters = $this->setParametersAndPost($fieldMappings, $action);
398+
$expectedParameters = $parameters['expectedParameters'];
399+
$apiCallParams = $parameters['apiCallParams'];
400+
401+
$expectedParameters['AuthorizationAmount.CurrencyCode'] = 'USD'; # default from client
402+
$expectedStringParams = $this->callPrivateMethod($client, 'calculateSignatureAndParametersToString', $expectedParameters);
403+
404+
$response = $client->confirmOrderReference($apiCallParams);
405+
406+
$apiParametersString = $client->getParameters();
407+
$this->assertEquals($apiParametersString, $expectedStringParams);
408+
}
409+
410+
public function testConfirmOrderReferenceWithUrlSCA()
411+
{
412+
$client = new Client($this->configParams);
413+
$fieldMappings = array(
414+
'merchant_id' => 'SellerId',
415+
'amazon_order_reference_id' => 'AmazonOrderReferenceId',
416+
'mws_auth_token' => 'MWSAuthToken',
417+
'success_url' => 'SuccessUrl',
418+
'failure_url' => 'FailureUrl'
419+
);
420+
421+
$action = 'ConfirmOrderReference';
422+
423+
$parameters = $this->setParametersAndPost($fieldMappings, $action);
424+
$expectedParameters = $parameters['expectedParameters'];
425+
$apiCallParams = $parameters['apiCallParams'];
426+
427+
$expectedStringParams = $this->callPrivateMethod($client, 'calculateSignatureAndParametersToString', $expectedParameters);
428+
429+
$response = $client->confirmOrderReference($apiCallParams);
430+
431+
$apiParametersString = $client->getParameters();
432+
433+
$this->assertEquals($apiParametersString, $expectedStringParams);
434+
}
435+
436+
public function testConfirmOrderReferenceWithoutSCA()
437+
{
438+
$client = new Client($this->configParams);
439+
$fieldMappings = array(
440+
'merchant_id' => 'SellerId',
441+
'amazon_order_reference_id' => 'AmazonOrderReferenceId',
442+
'mws_auth_token' => 'MWSAuthToken'
443+
);
444+
445+
$action = 'ConfirmOrderReference';
446+
447+
$parameters = $this->setParametersAndPost($fieldMappings, $action);
448+
$expectedParameters = $parameters['expectedParameters'];
449+
$apiCallParams = $parameters['apiCallParams'];
450+
451+
$expectedStringParams = $this->callPrivateMethod($client, 'calculateSignatureAndParametersToString', $expectedParameters);
452+
453+
$response = $client->confirmOrderReference($apiCallParams);
454+
455+
$apiParametersString = $client->getParameters();
456+
457+
$this->assertEquals($apiParametersString, $expectedStringParams);
458+
}
459+
383460
public function testCancelOrderReference()
384461
{
385462
$client = new Client($this->configParams);

0 commit comments

Comments
 (0)