Closed KoulSlou closed 8 years ago
Hi Tamara Thanks for bringing this to our attention. So to summarize , some responses are coming with headers attached and some don't. I am assuming there is no pattern here and it's random as to which responses come with the headers and which don't. The one having headers is failing to be parsed into array. Is that correct?
If so, could you please let me know how often this is occurring.
Hello Shrakuma,
Thank you for response. Yes, you understood it right. The one with headers can not be processed by toArray() function in "ResponseParser" class.
It happens with one set of order items but all the time. If I try to purchase another items everything works as expected - HTTP headers are not attached to the ResponseBody and response is processed correctly.
Tamara.
can you please give me the input you provide to the SetOrderReferenceDetails API call for that one set of order items. I will test it to reproduce the issue
Ok, here are parameters that I pass to setOrderReferenceDetails() in PayWithAmazon/Client class:
array (
'amazon_order_reference_id' => 'P01-7152974-9047150',
'amount' => 99.799999999999997,
'currency_code' => 'USD',
'seller_note' => 'book "Tilde skills: Design and Produce Text Documents, Word 2013" (digital) - 1 item(s);
book "Accelerated Tilde Skills Produce Spreadsheets: Excel 2013" (digital) - 1 item(s);
book "Tilde skills: Produce Desktop Published Documents, Publisher 2013" (digital) - 1 item(s);
book "Tilde skills: Create Electronic Presentations, PowerPoint 2013" (digital) - 1 item(s);
',
'store_name' => 'AuthorCloudware.com',
'seller_order_id' => '579',
)
And here is Parameter String that actually is sent to Amazon server
'AWSAccessKeyId=AKIAIEPJAWY6PLTT5U6A&Action=SetOrderReferenceDetails&AmazonOrderReferenceId=P01-7152974-9047150&OrderReferenceAttributes.OrderTotal.Amount=99.8&OrderReferenceAttributes.OrderTotal.CurrencyCode=USD&OrderReferenceAttributes.SellerNote=book%20%22Tilde%20skills%3A%20Design%20and%20Produce%20Text%20Documents%2C%20Word%202013%22%20%28digital%29%20%20-%201%20item%28s%29%3B%0Abook%20%22Accelerated%20Tilde%20Skills%20Produce%20Spreadsheets%3A%20Excel%202013%22%20%28digital%29%20%20-%201%20item%28s%29%3B%0Abook%20%22Tilde%20skills%3A%20Produce%20Desktop%20Published%20Documents%2C%20Publisher%202013%22%20%28digital%29%20%20-%201%20item%28s%29%3B%0Abook%20%22Tilde%20skills%3A%20Create%20Electronic%20Presentations%2C%20PowerPoint%202013%22%20%28digital%29%20%20-%201%20item%28s%29%3B&OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId=579&OrderReferenceAttributes.SellerOrderAttributes.StoreName=AuthorCloudware.com&SellerId=A1H0QDJ0J9ZUMG&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-11-13T21%3A04%3A27.000Z&Version=2013-01-01&Signature=FR5Auv6MZ8E2Eu0AF6ULYJtygPaYvyRO2vW%2BBAqd8ew%3D'
confirmed it's a bug. The seller note being different is adding headers. Will add logic to check for headers and remove them so that smple_xml_object doesn't crash.
Rather than just code around whether or not headers are present, can we determine why the headers are still present in this case?
On Fri, Nov 13, 2015 at 4:56 PM, shravan notifications@github.com wrote:
confirmed it's a bug. The seller note being different is adding headers. Will add logic to check for headers and remove them so that smple_xml_object doesn't crash.
— Reply to this email directly or view it on GitHub https://github.com/amzn/login-and-pay-with-amazon-sdk-php/issues/19#issuecomment-156601466 .
Matt Neilson (860) 861-1750
Headers are always there The headers are split in this line line : 1468 : // Split the API response into Response Body and the other parts of the response into other list($other, $responseBody) = explode("\r\n\r\n", $response, 2); In the case for when the seller note contains special characters as below: 'book "Tilde skills: Design and Produce Text Documents, Word 2013" (digital) - 1 item(s); book "Accelerated Tilde Skills Produce Spreadsheets: Excel 2013" (digital) - 1 item(s); book "Tilde skills: Produce Desktop Published Documents, Publisher 2013" (digital) - 1 item(s); book "Tilde skills: Create Electronic Presentations, PowerPoint 2013" (digital) - 1 item(s); ' first the HTTP response is moving to response code 100 (continue) and then moving to 200OK. Hence in the response it adds another line saying HTTP 1.1 100 continue which breaks the explode statement above.
I am fixing this code now to not send headers at all by the code curl_setopt($ch, CURLOPT_HEADER, false);
and adding
$info = curl_getinfo($ch); printing/using $info for example will give the HTTP status code as needed.
issue fixed and verified.
Described order has been processed successfully. Thank you for quick turnaround.
Hello everybody,
I'm investigating support case when user receives 500 error during checkout process.
I have found the following message in log file:
I started to dig into this problem. So, the first step in checkout process is send "SetOrderReferenceDetails" request. I do it, I receive response from Amazon and I call toArray() function on the received response in order to check "OrderStatus".
If you check toArray() function in ResponseParser class you will see that it calls private _simpleXmlObject method. And here is a particular line that causes problem:
For the problem order $response['ResponseBody'] contains:
that doesn't look like a valid XML, while for another order (which go through system without any problem) $response['ResponceBody'] looks like:
So, no HTTP headers included in response. My question is why it happens? Why there are different response format for one method? I will appreciate any help.
Regards, Tamara.