我正在尝试使用Peddler gem在MWS中创建出站实现。我得到的唯一反馈是Excon::Error::BadRequest (Expected(200) <=> Actual(400 Bad Request),因此很难找出哪里出了问题。下面是调用API的代码行(解析后的值):
@client.create_fulfillment_order("186", "186", 2016-08-01T07:35:48Z, "Test shipment number: 186", "Standard", {"Name"=>"Bert the Destroyer", "Line1"=>"Teststreet", "Line2"=>"123", "Line3"=>"", "DistrictOrCounty"=>"", "City"=>"Testcity", "StateOrProvinceCode"=>"CO", "CountryCode"=>"US", "PostalCode"=>"60401", "PhoneNumber"=>"12345678"}, [{"SellerSKU"=>"4785000045", "SellerFulfillmentOrderItemId"=>"4785000045", "Quantity"=>15}], {:fulfillment_policy=>"FillAll", :notification_email_list=>["bertthedestroyer@gmail.com"]})我好像想不出怎么才能拿回200块钱。有人能帮上忙吗?
实际代码:
address = {
"Name" => shipment.order.ship_to_name.to_s,
"Line1" => shipment.order.ship_to_address_1.to_s,
"Line2" => shipment.order.ship_to_address_2.to_s,
"Line3" => "",
"DistrictOrCounty" => "",
"City" => shipment.order.ship_to_city.to_s,
"StateOrProvinceCode" => shipment.order.ship_to_state_code.to_s,
"CountryCode" => shipment.order.ship_to_country_code.to_s,
"PostalCode" => shipment.order.ship_to_zipcode.to_s,
"PhoneNumber" => shipment.order.ship_to_phonenumber.to_s
}
items = []
shipment.m2m_line_item_shipments.each do |m2m|
items << {"SellerSKU" => m2m.vendor_sku.name.to_s, "SellerFulfillmentOrderItemId" => m2m.vendor_sku.name.to_s, "Quantity" => m2m.line_item.actual_quantity }
end
order_comment = "#{shipment.order.store.name} shipment number: " + shipment.id.to_s
opts = {:fulfillment_policy => "FillAll", :notification_email_list => [shipment.order.ship_to_email.to_s] }
created_at = shipment.order.created_at.iso8601
response = @client.create_fulfillment_order(shipment.id.to_s, shipment.id.to_s, created_at, order_comment.to_s, 'Standard', address, items, opts)
order = response.parse
logger.debug "order.inspect: #{order.inspect}"编辑:经过进一步的挖掘,我发现了这个。我尝试以整数和字符串的形式发送项目数量,但仍然出现相同的错误:
<Error>
<Type>Sender</Type>
<Code>InvalidRequestException</Code>
<Message>Value AllQuantityZero for parameter is invalid.</Message>
</Error>发布于 2016-08-01 17:06:12
经过进一步的搜索,我找到了答案。事实证明,此错误意味着SKU脱销。亚马逊的错误信息!来源:https://sellercentral.amazon.com/forums/message.jspa?messageID=2745103
https://stackoverflow.com/questions/38693380
复制相似问题