nebulab / cangaroo

Connect Any App to Any Service
https://github.com/nebulab/cangaroo
MIT License
107 stars 18 forks source link

Getting error_code 500 - "wrong json schema" #22

Closed rohitnick closed 8 years ago

rohitnick commented 8 years ago

Please help me with the following issue.

I am using cangaroo to integrate "wombat/amazon_integration" into my spree app. Everything seems to working as expected but I am getting the below error in attached in the "Interactor::Context" json. {message="wrong json schema", error_code=500}

The problem seems to be with the Schema of the json "ValidateJsonSchema" is expecting, but my response from the "wombat/amazon_integration" is as expected and as per the guidelines given by wombat. Please find the "req.parsed_response" below.

{"request_id"=>"c5824270-beda-4c79-8248-2bebda3ede31", "summary"=>"Successfully received 7 order(s) and 0 shipment(s) from Amazon MWS.", "parameters"=>{"amazon_orders_last_polling_datetime"=>"2016-04-18T16:09:12Z"}, "orders"=> [{"id"=>"404-1821001-3722760", "number"=>"404-1821001-3722760", "channel"=>"Amazon.in", "fulfillment_channel"=>"MFN", "currency"=>"INR", "status"=>"Unshipped", "placed_on"=>"2016-04-13T14:15:48Z", "updated_at"=>"2016-04-13T14:46:05Z", "email"=>"7qx1c2fn6d1rcje@marketplace.amazon.in", "totals"=> {"item"=>14999.0, "adjustment"=>0.0, "tax"=>0.0, "shipping"=>0.0, "order"=>14999.0, "payment"=>14999.0}, "adjustments"=> [{"name"=>"Shipping Discount", "value"=>0.0}, {"name"=>"Promotion Discount", "value"=>0.0}, {"name"=>"Amazon Tax", "value"=>0.0}, {"name"=>"Gift Wrap Price", "value"=>0.0}, {"name"=>"Gift Wrap Tax", "value"=>0.0}], "line_items"=> [{"name"=>"Prague Coffee Table - Mahogany", "price"=>14999.0, "product_id"=>"FRTBCF11MH10001", "quantity"=>1, "asin"=>"B0188P7GP0", "options"=>{}}], "payments"=>[{"amount"=>14999.0, "payment_method"=>"Amazon", "status"=>"complete"}], "shipping_address"=> {"firstname"=>"Rohit", "lastname"=>"Agarwal", "address1"=>"Salasar Aangan, Nr. Prathmesh Ashish,", "address2"=>"Off Kanakia Road, Mira Road EAST", "city"=>"THANE", "zipcode"=>"401107", "phone"=>"9876543210", "country"=>"IN", "state"=>"MAHARASHTRA"}, "billing_address"=> {"firstname"=>"Rohit", "lastname"=>"Agarwal", "address1"=>"Salasar Aangan, Nr. Prathmesh Ashish,", "address2"=>"Off Kanakia Road, Mira Road EAST", "city"=>"THANE", "zipcode"=>"401107", "phone"=>"9876543210", "country"=>"IN", "state"=>"MAHARASHTRA"}, "amazon_shipping_method"=>"Expedited"}] }

Please let me know what am I doing wrong ?

rohitnick commented 8 years ago

After looking at the code of ValidateJsonSchema's "prepare_context" code, I was able to find the problem.

My 'context.json_body' also includes 'parameters' in addition to 'request_id' and 'summary'.

AlessioRocco commented 8 years ago

What endpoint are you using?

rohitnick commented 8 years ago

Amazon integration - https://github.com/wombat/amazon_integration

AlessioRocco commented 8 years ago

@rohitnick thanks for your feedback, finally it's fixed.