Skip to content

Commit 073800c

Browse files
authored
Fixed shipping and points options for product fee estimates (#150)
1 parent f2dcfa7 commit 073800c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

includes/classes/AmazonProductFeeEstimate.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ public function setRequests($a){
9898
$this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.ListingPrice.CurrencyCode'] = $x['ListingPrice']['CurrencyCode'];
9999
$this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.ListingPrice.Amount'] = $x['ListingPrice']['Value'];
100100
if (isset($x['Shipping']) && is_array($x['Shipping'])){
101-
$this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.Shipping.CurrencyCode'] = $x['Shipping']['CurrencyCode'];
102-
$this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.Shipping.Value'] = $x['Shipping']['Value'];
101+
$this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.Shipping.CurrencyCode'] = $x['Shipping']['CurrencyCode'];
102+
$this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.Shipping.Amount'] = $x['Shipping']['Value'];
103103
}
104104
if (array_key_exists('Points', $x)){
105-
$this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.Points.PointsNumber'] = $x['Points'];
105+
$this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.PriceToEstimateFees.Points.PointsNumber'] = $x['Points'];
106106
}
107107
$this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.Identifier'] = $x['Identifier'];
108108
$this->options['FeesEstimateRequestList.FeesEstimateRequest.'.$i.'.IsAmazonFulfilled'] = $x['IsAmazonFulfilled'];

test-cases/includes/classes/AmazonProductFeeEstimateTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public function testSetRequest() {
6262
$this->assertEquals('ASIN', $o[$pre.'1.IdType']);
6363
$this->assertArrayHasKey($pre.'1.IdValue', $o);
6464
$this->assertEquals('B00123ASIN', $o[$pre.'1.IdValue']);
65-
$this->assertEquals('USD', $o[$pre.'1.PriceToEstimateFees.ListingPrice.CurrencyCode']);
6665
$this->assertArrayHasKey($pre.'1.PriceToEstimateFees.ListingPrice.CurrencyCode', $o);
66+
$this->assertEquals('USD', $o[$pre.'1.PriceToEstimateFees.ListingPrice.CurrencyCode']);
6767
$this->assertArrayHasKey($pre.'1.PriceToEstimateFees.ListingPrice.Amount', $o);
6868
$this->assertEquals('123', $o[$pre.'1.PriceToEstimateFees.ListingPrice.Amount']);
6969
$this->assertArrayHasKey($pre.'1.Identifier', $o);
@@ -72,12 +72,12 @@ public function testSetRequest() {
7272
$this->assertEquals('false', $o[$pre.'1.IsAmazonFulfilled']);
7373
$this->assertArrayHasKey($pre.'2.MarketplaceId', $o);
7474
$this->assertEquals('Mark II', $o[$pre.'2.MarketplaceId']);
75-
$this->assertArrayHasKey($pre.'2.Shipping.CurrencyCode', $o);
76-
$this->assertEquals('USD', $o[$pre.'2.Shipping.CurrencyCode']);
77-
$this->assertArrayHasKey($pre.'2.Shipping.Value', $o);
78-
$this->assertEquals('1.23', $o[$pre.'2.Shipping.Value']);
79-
$this->assertArrayHasKey($pre.'2.Points.PointsNumber', $o);
80-
$this->assertEquals('3', $o[$pre.'2.Points.PointsNumber']);
75+
$this->assertArrayHasKey($pre.'2.PriceToEstimateFees.Shipping.CurrencyCode', $o);
76+
$this->assertEquals('USD', $o[$pre.'2.PriceToEstimateFees.Shipping.CurrencyCode']);
77+
$this->assertArrayHasKey($pre.'2.PriceToEstimateFees.Shipping.Amount', $o);
78+
$this->assertEquals('1.23', $o[$pre.'2.PriceToEstimateFees.Shipping.Amount']);
79+
$this->assertArrayHasKey($pre.'2.PriceToEstimateFees.Points.PointsNumber', $o);
80+
$this->assertEquals('3', $o[$pre.'2.PriceToEstimateFees.Points.PointsNumber']);
8181

8282
//setting again should reset
8383
$this->assertNull($this->object->setRequests(array($op)));

0 commit comments

Comments
 (0)