-
-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getOrderItems() response throws exception #799
Comments
Using version 5.10.1 - getting the same response since yesterday. |
same issue here even after upgrading to 5.10.2. Have also tried: 5.8.3 and same issue. |
@adamtoms A more elegant solution ;-) |
so I can see the payload contains an empty string. Going to look at the amazon docs to see whats required.
UPDATE: Looks like it's optional: https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference#taxcollection So just need the enforecement check removed from setResponsibleParty. |
As quick fix, based on adamtoms' solution, I simply modify TaxCollection.php (selling-partner-api\lib\Model\Orders\TaxCollection.php) by adding false&& in the condition of the public function setResponsibleParty like this: |
Manu thanks for your issue, I investigate also yesterday and find your solutions. |
Any solution to a problem is better than none, especially when you really need it badly. There are more elegant solutions than mine, but the important thing was that it worked and helped to find better solutions by people who have more experience with coding than me. We all know how Amazon Support works :-D |
My understanding is that this is an optional field so I went with skipping validation if the value is an empty string for now. edit: raised a draft PR for it here: #802 if (
// Amazon may send this optional field as an empty string so we have to cater for that scenario here
// @see https://github.com/jlevers/selling-partner-api/issues/799
$responsible_party !== ''
&& !is_null($responsible_party)
&& !in_array(strtoupper($responsible_party), $allowedValues, true)
) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'responsible_party', must be one of '%s'",
$responsible_party,
implode("', '", $allowedValues)
)
);
} |
Thanks @tkasa! It works for me |
Same issue waiting for a new release in order to include our system. |
yes :) we can. Thanks for help and professional response. |
Amazon made a small unannounced change in SP API yesterday and the 'getOrderItems' function. The called function returns incomplete data, namely 'ResponsibleParty' which is sometimes empty and end up as throws exception. In this case I recommend to just disable validation in '/vendor/jlevers/selling-partner-api/lib/Model/OrdersV0/TaxCollection.php
Fatal error: Uncaught InvalidArgumentException: Invalid value '' for 'responsible_party', must be one of 'AMAZON SERVICES, INC.', 'AMAZON COMMERCIAL SERVICES PTY LTD' in ..../vendor/jlevers/selling-partner-api/lib/Model/OrdersV0/TaxCollection.php:265 Stack trace: #0 ..../vendor/jlevers/selling-partner-api/lib/ObjectSerializer.php(385): SellingPartnerApi\Model\OrdersV0\TaxCollection->setResponsibleParty('') #1 ..../vendor/jlevers/selling-partner-api/lib/ObjectSerializer.php(385): SellingPartnerApi\ObjectSerializer::deserialize(Object(stdClass), '\SellingPartner...', NULL) #2 ..../vendor/jlevers/selling-partner-api/lib/ObjectSerializer.php(276): SellingPartnerApi\ObjectSerializer::deserialize(Object(stdClass), '\SellingPartner...', NULL) #3 ..../vendor/jlevers/selling-partner-api/lib/ObjectSerializer.php(385): SellingPartnerApi\ObjectSerializer::deserialize(Array, '\SellingPartner...', NULL) #4 ..../vendor/jlevers/selling-partner-api/lib/ObjectSerializer.php(385): SellingPartnerApi\ObjectSerializer::deserialize(Object(stdClass), '\SellingPartner...', NULL) #5 ..../vendor/jlevers/selling-partner-api/lib/Api/OrdersV0Api.php(1543): SellingPartnerApi\ObjectSerializer::deserialize(Object(stdClass), '\SellingPartner...', Array) #6 ..../vendor/jlevers/selling-partner-api/lib/Api/OrdersV0Api.php(1472): SellingPartnerApi\Api\OrdersV0Api->getOrderItemsWithHttpInfo('171-7392580-949...', '', Array) #7 ..../servers/Amazons/GetOrders.php(438): SellingPartnerApi\Api\OrdersV0Api->getOrderItems('171-7392580-949...', '', Array) #8 {main} thrown in ..../vendor/jlevers/selling-partner-api/lib/Model/OrdersV0/TaxCollection.php on line 265
Solution:
The text was updated successfully, but these errors were encountered: