此gem将数据发送到亚马逊。但是,它缺少一个我需要发送的数据元素。基本上是项目的declared value
。我试图修补此方法以发送declared value
。
我在这个gem中使用的方法是create_fulfillment_order
here is a link to the method,方法也粘贴在下面。我需要做的是从此更改items
结构:
(:seller_sku, :seller_fulfillment_order_item_id, :quantity)
到此:
(:seller_sku, :seller_fulfillment_order_item_id, :quantity, :per_unit_declared_value)
然后这是方法的完整代码
def create_fulfillment_order(seller_fulfillment_order_id, displayable_order_id, displayable_order_date_time, displayable_order_comment, shipping_speed_category, destination_address, items, opts = {})
if opts.key?(:cod_settings)
opts['CODSettings'] = opts.delete(:cod_settings)
end
operation('CreateFulfillmentOrder')
.add(
opts.merge(
'SellerFulfillmentOrderId' => seller_fulfillment_order_id,
'DisplayableOrderId' => displayable_order_id,
'DisplayableOrderDateTime' => displayable_order_date_time,
'DisplayableOrderComment' => displayable_order_comment,
'ShippingSpeedCategory' => shipping_speed_category,
'DestinationAddress' => destination_address,
'Items' => items
)
)
.structure!('Items', 'member')
.structure!('NotificationEmailList', 'member')
run
end
我这样称呼方法:
client = MWS::FulfillmentOutboundShipment::Client.new(
marketplace_id: "XXXXXX",
merchant_id: "XXXXX",
aws_access_key_id: "XXXX",
aws_secret_access_key: "XXXXX+",
auth_token: "XXXXXX")
Address = Struct.new(:name, :line_1, :line_2, :line_3, :city, :state_or_province_code,
:country_code, :postal_code)
address = Address.new("Todd T", "19712 50th Ave W", "#5", "", "Lynnwood","WA" ,"US" , "98036" )
Value = Struct.new(:currency_code, :value)
value = Value.new("CAD", "10")
Item = Struct.new(:seller_sku, :seller_fulfillment_order_item_id, :quantity, :per_unit_declard_value)
sku = []
first = Item.new("636391317719", "s2", 1, value)
sku << first
begin
client.create_fulfillment_order("z536", "z536", Time.now.getutc, "Thank You", "Standard", address, sku)
rescue Exception => e
pp e.response
end
我得到的错误是The request must contain the parameter PerUnitDeclaredValue.