From f2dcfa7fe6b3691215515d01585da6fac431ba64 Mon Sep 17 00:00:00 2001 From: Rigel Kent Carbonel Date: Sat, 20 Jan 2018 04:27:15 +0800 Subject: [PATCH 1/3] Update AmazonProductFeeEstimate.php (#147) * Update AmazonProductFeeEstimate.php Edited the option key for the listing prices so the amazon can get the data. Refer to the scratchpad product api labels. * Update AmazonProductFeeEstimateTest.php --- includes/classes/AmazonProductFeeEstimate.php | 4 ++-- .../includes/classes/AmazonProductFeeEstimateTest.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/classes/AmazonProductFeeEstimate.php b/includes/classes/AmazonProductFeeEstimate.php index 5cfa711b..2f52b144 100644 --- a/includes/classes/AmazonProductFeeEstimate.php +++ b/includes/classes/AmazonProductFeeEstimate.php @@ -95,8 +95,8 @@ public function setRequests($a){ $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.MarketplaceId'] = $x['MarketplaceId']; $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.IdType'] = $x['IdType']; $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.IdValue'] = $x['IdValue']; - $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.ListingPrice.CurrencyCode'] = $x['ListingPrice']['CurrencyCode']; - $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.ListingPrice.Value'] = $x['ListingPrice']['Value']; + $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.ListingPrice.CurrencyCode'] = $x['ListingPrice']['CurrencyCode']; + $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.ListingPrice.Amount'] = $x['ListingPrice']['Value']; if (isset($x['Shipping']) && is_array($x['Shipping'])){ $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.Shipping.CurrencyCode'] = $x['Shipping']['CurrencyCode']; $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.Shipping.Value'] = $x['Shipping']['Value']; diff --git a/test-cases/includes/classes/AmazonProductFeeEstimateTest.php b/test-cases/includes/classes/AmazonProductFeeEstimateTest.php index 3c40a593..09c9310f 100644 --- a/test-cases/includes/classes/AmazonProductFeeEstimateTest.php +++ b/test-cases/includes/classes/AmazonProductFeeEstimateTest.php @@ -62,10 +62,10 @@ public function testSetRequest() { $this->assertEquals('ASIN', $o[$pre.'1.IdType']); $this->assertArrayHasKey($pre.'1.IdValue', $o); $this->assertEquals('B00123ASIN', $o[$pre.'1.IdValue']); - $this->assertArrayHasKey($pre.'1.ListingPrice.CurrencyCode', $o); - $this->assertEquals('USD', $o[$pre.'1.ListingPrice.CurrencyCode']); - $this->assertArrayHasKey($pre.'1.ListingPrice.Value', $o); - $this->assertEquals('123', $o[$pre.'1.ListingPrice.Value']); + $this->assertEquals('USD', $o[$pre.'1.PriceToEstimateFees.ListingPrice.CurrencyCode']); + $this->assertArrayHasKey($pre.'1.PriceToEstimateFees.ListingPrice.CurrencyCode', $o); + $this->assertArrayHasKey($pre.'1.PriceToEstimateFees.ListingPrice.Amount', $o); + $this->assertEquals('123', $o[$pre.'1.PriceToEstimateFees.ListingPrice.Amount']); $this->assertArrayHasKey($pre.'1.Identifier', $o); $this->assertEquals('TEST123', $o[$pre.'1.Identifier']); $this->assertArrayHasKey($pre.'1.IsAmazonFulfilled', $o); From 073800c646f28725896f451b7f11263fe05003bc Mon Sep 17 00:00:00 2001 From: Thomas Hernandez Date: Fri, 19 Jan 2018 15:44:35 -0500 Subject: [PATCH 2/3] Fixed shipping and points options for product fee estimates (#150) --- includes/classes/AmazonProductFeeEstimate.php | 6 +++--- .../classes/AmazonProductFeeEstimateTest.php | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/includes/classes/AmazonProductFeeEstimate.php b/includes/classes/AmazonProductFeeEstimate.php index 2f52b144..435e4d44 100644 --- a/includes/classes/AmazonProductFeeEstimate.php +++ b/includes/classes/AmazonProductFeeEstimate.php @@ -98,11 +98,11 @@ public function setRequests($a){ $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.ListingPrice.CurrencyCode'] = $x['ListingPrice']['CurrencyCode']; $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.ListingPrice.Amount'] = $x['ListingPrice']['Value']; if (isset($x['Shipping']) && is_array($x['Shipping'])){ - $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.Shipping.CurrencyCode'] = $x['Shipping']['CurrencyCode']; - $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.Shipping.Value'] = $x['Shipping']['Value']; + $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.Shipping.CurrencyCode'] = $x['Shipping']['CurrencyCode']; + $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.Shipping.Amount'] = $x['Shipping']['Value']; } if (array_key_exists('Points', $x)){ - $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.Points.PointsNumber'] = $x['Points']; + $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.Points.PointsNumber'] = $x['Points']; } $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.Identifier'] = $x['Identifier']; $this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.IsAmazonFulfilled'] = $x['IsAmazonFulfilled']; diff --git a/test-cases/includes/classes/AmazonProductFeeEstimateTest.php b/test-cases/includes/classes/AmazonProductFeeEstimateTest.php index 09c9310f..3a6a4493 100644 --- a/test-cases/includes/classes/AmazonProductFeeEstimateTest.php +++ b/test-cases/includes/classes/AmazonProductFeeEstimateTest.php @@ -62,8 +62,8 @@ public function testSetRequest() { $this->assertEquals('ASIN', $o[$pre.'1.IdType']); $this->assertArrayHasKey($pre.'1.IdValue', $o); $this->assertEquals('B00123ASIN', $o[$pre.'1.IdValue']); - $this->assertEquals('USD', $o[$pre.'1.PriceToEstimateFees.ListingPrice.CurrencyCode']); $this->assertArrayHasKey($pre.'1.PriceToEstimateFees.ListingPrice.CurrencyCode', $o); + $this->assertEquals('USD', $o[$pre.'1.PriceToEstimateFees.ListingPrice.CurrencyCode']); $this->assertArrayHasKey($pre.'1.PriceToEstimateFees.ListingPrice.Amount', $o); $this->assertEquals('123', $o[$pre.'1.PriceToEstimateFees.ListingPrice.Amount']); $this->assertArrayHasKey($pre.'1.Identifier', $o); @@ -72,12 +72,12 @@ public function testSetRequest() { $this->assertEquals('false', $o[$pre.'1.IsAmazonFulfilled']); $this->assertArrayHasKey($pre.'2.MarketplaceId', $o); $this->assertEquals('Mark II', $o[$pre.'2.MarketplaceId']); - $this->assertArrayHasKey($pre.'2.Shipping.CurrencyCode', $o); - $this->assertEquals('USD', $o[$pre.'2.Shipping.CurrencyCode']); - $this->assertArrayHasKey($pre.'2.Shipping.Value', $o); - $this->assertEquals('1.23', $o[$pre.'2.Shipping.Value']); - $this->assertArrayHasKey($pre.'2.Points.PointsNumber', $o); - $this->assertEquals('3', $o[$pre.'2.Points.PointsNumber']); + $this->assertArrayHasKey($pre.'2.PriceToEstimateFees.Shipping.CurrencyCode', $o); + $this->assertEquals('USD', $o[$pre.'2.PriceToEstimateFees.Shipping.CurrencyCode']); + $this->assertArrayHasKey($pre.'2.PriceToEstimateFees.Shipping.Amount', $o); + $this->assertEquals('1.23', $o[$pre.'2.PriceToEstimateFees.Shipping.Amount']); + $this->assertArrayHasKey($pre.'2.PriceToEstimateFees.Points.PointsNumber', $o); + $this->assertEquals('3', $o[$pre.'2.PriceToEstimateFees.Points.PointsNumber']); //setting again should reset $this->assertNull($this->object->setRequests(array($op))); From 674e2650d682f759dab130e0a2e776034c8c843f Mon Sep 17 00:00:00 2001 From: Thomas Hernandez Date: Fri, 19 Jan 2018 15:51:06 -0500 Subject: [PATCH 3/3] Updated change log with 1.4.1 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index becd5e3b..0c11d32e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## 1.4.1 - 2018-01-19 +### Changed + - Fixed parameter names for Product Fees Estimates + ## 1.4.0 - 2017-11-17 ### Added - Travis support for PHP 7.1 and 7.2