rails Active_Shipping Fedex SmartPost Issue

186 views Asked by At

I'm trying to set up a shipping calculator that includes Fedex smart post, but when i run the request, smart post is not included (even though I'm signed up for it). Can anyone tell me what I'm doing wrong? (I don't think I'm including "SmartPostDetail" correctly)

require 'active_shipping'
include ActiveMerchant::Shipping
destination = Location.new(country: 'US',
    state: 'CA',
    city: 'Beverly Hills',
    zip: '90210')
origin = Location.new(country: 'US',
    state: 'NC', 
    city: 'Burlington', 
    zip: '27217')
package = Package.new((16),[5, 4, 5],:units => :imperial)

fedex = FedEx.new(:key => 'KEY',
    :password => 'PASSWORD',
    :account => 'ACCOUNT#',
    :login => 'METER#',
    'SmartPostDetail' => {
        'Indicia' => 'PARCEL_SELECT', 
        'AncillaryEndorsement' => 'CARRIER_LEAVE_IF_NO_RESPONSE', 
        'SpecialServices' => 'USPS_DELIVERY_CONFIRMATION', 
        'HubId' => '5281'})

response_fedex = fedex.find_rates(origin, destination, package)
fedex_rates = response_fedex.rates.sort_by(&:price).collect {|rate| [rate.service_name, rate.price]}

output:

[["FedEx Ground Home Delivery", xxxx], ["FedEx Express Saver", xxxx], ["FedEx 2 Day", xxxx], ["FedEx 2 Day Am", xxxx], ["FedEx Standard Overnight", xxxx], ["FedEx Priority Overnight", xxxx], ["FedEx First Overnight", xxxx]]

0

There are 0 answers