我正在使用Ruby gem' fedex',https://github.com/jazminschroeder/fedex。 我已经为开发模式设置了代码,并且我正在测试发货。
但是,我遇到了以下错误:
C:/Ruby22/lib/ruby/gems/2.2.0/gems/fedex-.10.1/lib/fedex/request/shipment.rb:134:in' failure_response':海关价值是需要。 (Fedex :: RateError)来自C:/Ruby22/lib/ruby/gems/2.2.0/gems/fedex-.10.1/lib/fedex/request/shipment.rb:32:in' process_request'来自C:/Ruby22/lib/ruby/gems/2.2.0/gems/fedex-3.10.1/lib/fedex/shipment.rb:57:in' ship'来自C:/Ruby22/bin/css_fedex_v1.rb:92:in''
似乎我需要解析一个“海关价值”,可能是我的包裹中的一部分'哈希值。但是,我无法找到相关字段供我参与。任何有经验的人并找到了解决方案?
谢谢你, 马丁
我的代码如下:
require 'fedex'
fedex = Fedex::Shipment.new(:key => '***',
:password => '***',
:account_number => '***',
:meter => '***',
:mode => 'development')
shipper = { :name => "***",
:company => "***",
:phone_number => "***",
:address => "***",
:city => "***",
:postal_code => "***",
:country_code => "DK" }
recipient = { :name => "***",
:company => "***",
:phone_number => "***",
:address => "***",
:city => "***",
:postal_code => "***",
:country_code => "GB",
:residential => "false" }
packages = []
packages << {:weight => {:units => "LB", :value => 1}}
shipping_options = {:packaging_type => "YOUR_PACKAGING",
:drop_off_type => "REGULAR_PICKUP"}
rate = fedex.rate(:shipper=>shipper,
:recipient => recipient,
:packages => packages,
:shipping_options => shipping_options)
ship = fedex.ship(:shipper=>shipper,
:recipient => recipient,
:packages => packages,
:service_type => "INTERNATIONAL_PRIORITY",
:shipping_options => shipping_options)
puts ship[:completed_shipment_detail][:operational_detail][:transit_time]
答案 0 :(得分:1)
海关价值在其文件中声明: {{3}}
customs_value = { :currency => "USD",
:amount => "200" }
据我了解,您可以将其传递给商品哈希或将其分开。