0
我从Shopify API获得了一些非常奇怪的结果,我希望有人能帮助我。Shopify订单API - 传递折扣
我试图创建一个订单,打折。它实际上保存订单,与折扣信息...但数额总是错
order_params = {
:browser_ip => webhook[:browser_ip],
:buyer_accepts_marketing => webhook[:buyer_accepts_marketing],
:currency => webhook[:currency],
:email => webhook[:email],
:financial_status => webhook[:financial_status],
:landing_site => webhook[:landing_site],
:note => webhook[:note],
:referring_site => webhook[:referring_site],
:line_items => line_items,
:tag => tags,
:transactions => transactions,
:discount_codes => webhook[:discount_codes],
:total_discounts => webhook[:total_discounts],
:shipping_address => webhook[:shipping_address],
:shipping_lines => webhook[:shipping_lines],
:customer_id => @options[:customer_id],
:billing_address => webhook[:billing_address]
}
@shopify_order = ShopifyAPI::Order.create(order_params)
正如你可以看到它从webhook数据创建。这是给我回来......(截)
"reference"=>nil,
"user_id"=>nil,
"subtotal_price"=>"55.00",
"total_discounts"=>"55.00",
"location_id"=>nil,
"source_identifier"=>nil,
"source_url"=>nil,
"processed_at"=>"2017-05-31T15:53:03-04:00",
"device_id"=>nil,
"phone"=>nil,
"browser_ip"=>nil,
"landing_site_ref"=>nil,
"order_number"=>1140,
"discount_codes"=>
[#<ShopifyAPI::Order::DiscountCode:0x007ffbec42ccb0
@attributes={"code"=>"50% OFF", "amount"=>"55.00", "type"=>""},
@persisted=true,
@prefix_options={}>]
到目前为止,那么好所有的数据是正确的..然后我保存这个情况..贴现金额不正确...它应该是£55 。