lineofflight / peddler

Amazon Selling Partner API (SP-API) in Ruby
MIT License
307 stars 130 forks source link

parser returns only "ProcessingReport" for get_feed_submission_result #86

Closed omensinger closed 7 years ago

omensinger commented 7 years ago

The parser returns only "ProcessingReport" for get_feed_submission_result. Example:

client = MWS::Feeds::Client.new(...) 
result = client.get_feed_submission_result("...")
p result.parse
=> "ProcessingReport"

The result.body contains the really interesting data. Why is this not parsed, as - for example - when using client.submit_feed(...)?

I am sure that I miss something here, do I? Thank you in advance!

hakanensari commented 7 years ago

Odd. Could you paste the response body? Please sanitise if there's anything sensitive.

omensinger commented 7 years ago

Here we go:

  1. I use MWS::Feeds::Client to submit_feed with _POST_INVENTORY_AVAILABILITY_DATA_, I get back the FeedSubmissionId (50018017212)
  2. I use get_feed_submission_list with the FeedSubmissionId until I get "FeedProcessingStatus"=>"_DONE_"
  3. Now I use get_feed_submission_result with my FeedSubmissionId

This is the returned object (result):

#<Excon::Response:0x00000004173848 @data={:body=>"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<AmazonEnvelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"amzn-envelope.xsd\">\n\t<Header>\n\t\t<DocumentVersion>1.02</DocumentVersion>\n\t\t<MerchantIdentifier>MY_ID</MerchantIdentifier>\n\t</Header>\n\t<MessageType>ProcessingReport</MessageType>\n\t<Message>\n\t\t<MessageID>1</MessageID>\n\t\t<ProcessingReport>\n\t\t\t<DocumentTransactionID>50018017212</DocumentTransactionID>\n\t\t\t<StatusCode>Complete</StatusCode>\n\t\t\t<ProcessingSummary>\n\t\t\t\t<MessagesProcessed>1</MessagesProcessed>\n\t\t\t\t<MessagesSuccessful>1</MessagesSuccessful>\n\t\t\t\t<MessagesWithError>0</MessagesWithError>\n\t\t\t\t<MessagesWithWarning>0</MessagesWithWarning>\n\t\t\t</ProcessingSummary>\n\t\t</ProcessingReport>\n\t</Message>\n</AmazonEnvelope>", :cookies=>[], :host=>"mws-eu.amazonservices.com", :headers=>{"Server"=>"Server", "Date"=>"Wed, 15 Feb 2017 09:21:19 GMT", "Content-Type"=>"text/xml;charset=UTF-8", "Content-Length"=>"768", "Connection"=>"keep-alive", "x-mws-quota-max"=>"60.0", "x-mws-quota-remaining"=>"59.0", "x-mws-quota-resetsOn"=>"2017-02-15T10:11:00.000Z", "Content-MD5"=>"KOFTHPTUBQt6YHjp0Wi+9g==", "x-mws-response-context"=>"luYTulPxM5UPgBW2HL6j37xxmzjT8cyKKMNc0lVKUrf7gT9aUEOYnf+Nond1CwzWSw5ZLt9DUAs=, elG8G2DVLgNM9LciJGYTEwpN/fAWFPFW+Ur1zbD+AEYhi3+f2se0JBJ2uQ2oazJNceOPLiIui3g=", "x-amz-request-id"=>"61fc70c7-74b6-40a7-af50-1f01139d439a", "x-mws-request-id"=>"61fc70c7-74b6-40a7-af50-1f01139d439a", "x-mws-timestamp"=>"2017-02-15T09:21:19.423Z", "Vary"=>"Accept-Encoding,User-Agent"}, :path=>"/", :port=>443, :status=>200, :status_line=>"HTTP/1.1 200 OK\r\n", :reason_phrase=>"OK", :remote_ip=>"xxx", :local_port=>53623, :local_address=>"yyy"}, @body="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<AmazonEnvelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"amzn-envelope.xsd\">\n\t<Header>\n\t\t<DocumentVersion>1.02</DocumentVersion>\n\t\t<MerchantIdentifier>MY_ID</MerchantIdentifier>\n\t</Header>\n\t<MessageType>ProcessingReport</MessageType>\n\t<Message>\n\t\t<MessageID>1</MessageID>\n\t\t<ProcessingReport>\n\t\t\t<DocumentTransactionID>50018017212</DocumentTransactionID>\n\t\t\t<StatusCode>Complete</StatusCode>\n\t\t\t<ProcessingSummary>\n\t\t\t\t<MessagesProcessed>1</MessagesProcessed>\n\t\t\t\t<MessagesSuccessful>1</MessagesSuccessful>\n\t\t\t\t<MessagesWithError>0</MessagesWithError>\n\t\t\t\t<MessagesWithWarning>0</MessagesWithWarning>\n\t\t\t</ProcessingSummary>\n\t\t</ProcessingReport>\n\t</Message>\n</AmazonEnvelope>", @headers={"Server"=>"Server", "Date"=>"Wed, 15 Feb 2017 09:21:19 GMT", "Content-Type"=>"text/xml;charset=UTF-8", "Content-Length"=>"768", "Connection"=>"keep-alive", "x-mws-quota-max"=>"60.0", "x-mws-quota-remaining"=>"59.0", "x-mws-quota-resetsOn"=>"2017-02-15T10:11:00.000Z", "Content-MD5"=>"KOFTHPTUBQt6YHjp0Wi+9g==", "x-mws-response-context"=>"luYTulPxM5UPgBW2HL6j37xxmzjT8cyKKMNc0lVKUrf7gT9aUEOYnf+Nond1CwzWSw5ZLt9DUAs=, elG8G2DVLgNM9LciJGYTEwpN/fAWFPFW+Ur1zbD+AEYhi3+f2se0JBJ2uQ2oazJNceOPLiIui3g=", "x-amz-request-id"=>"61fc70c7-74b6-40a7-af50-1f01139d439a", "x-mws-request-id"=>"61fc70c7-74b6-40a7-af50-1f01139d439a", "x-mws-timestamp"=>"2017-02-15T09:21:19.423Z", "Vary"=>"Accept-Encoding,User-Agent"}, @status=200, @remote_ip="xxx", @local_port=53623, @local_address="yyy">

This is the result.body:

<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<AmazonEnvelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"amzn-envelope.xsd\">\n\t<Header>\n\t\t<DocumentVersion>1.02</DocumentVersion>\n\t\t<MerchantIdentifier>MY_ID</MerchantIdentifier>\n\t</Header>\n\t<MessageType>ProcessingReport</MessageType>\n\t<Message>\n\t\t<MessageID>1</MessageID>\n\t\t<ProcessingReport>\n\t\t\t<DocumentTransactionID>50018017212</DocumentTransactionID>\n\t\t\t<StatusCode>Complete</StatusCode>\n\t\t\t<ProcessingSummary>\n\t\t\t\t<MessagesProcessed>1</MessagesProcessed>\n\t\t\t\t<MessagesSuccessful>1</MessagesSuccessful>\n\t\t\t\t<MessagesWithError>0</MessagesWithError>\n\t\t\t\t<MessagesWithWarning>0</MessagesWithWarning>\n\t\t\t</ProcessingSummary>\n\t\t</ProcessingReport>\n\t</Message>\n</AmazonEnvelope>

And this is the result of result.parse:

"ProcessingReport"

Thank you in advance!

hakanensari commented 7 years ago

@omensinger, thanks for reporting. It was a regression.

omensinger commented 7 years ago

@hakanensari Thank you very much for your great library!