Skip to content
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.

ActiveShipping::ResponseError (ERROR - 691: The PurposeOfShipmentType is null, empty or invalid.): #546

Open
ashvin-chauhan opened this issue Oct 17, 2017 · 0 comments

Comments

@ashvin-chauhan
Copy link

ashvin-chauhan commented Oct 17, 2017

I am using find_rates method of FedEx carrier, and its working fine for international country, but not for domestic.

If origin is US and destination is IN its working fine, but not for IN to IN

Following is my code.

    spree_config = Spree::ActiveShipping::Config

    packages = [
      ActiveShipping::Package.new(7.5 * 16,          # 7.5 lbs, times 16 oz/lb.
                                  [15, 10, 4.5],     # 15x10x4.5 inches
                                  units: :imperial)  # not grams, not centimetres
    ]

    country_data = Geocoder.search(params[:pincode]).first.country_code
    origin = ActiveShipping::Location.new(country: 'IN',
                                           state: 'BR',
                                           city: 'Patna',
                                           zip: '800004')

    # origin = ActiveShipping::Location.new(country: 'US',
    #                                        state: 'CA',
    #                                        city: 'Beverly Hills',
    #                                        zip: '90210')

    destination = ActiveShipping::Location.new(country: country_data,
                                                postal_code: params[:pincode])

    # # fedex = ActiveShipping::FedEx.new(login: '118928725', password: 'kpOChtGJcK3ekRSgVXp6Cc7bi ', key: 'Erzwp7ZsDEFW2tM9', account: '510087100', test: true)
    fedex = ActiveShipping::FedEx.new(login: spree_config[:fedex_login], password: spree_config[:fedex_password], key: spree_config[:fedex_key], account: spree_config[:fedex_account], test: spree_config[:test_mode])

    response = fedex.find_rates(origin, destination, packages)```

And error is `ActiveShipping::ResponseError (ERROR - 691: The PurposeOfShipmentType is null, empty or invalid.):`

I contact to FedEx, and he said that for some country shippingpurpose is mandatory, but I dont know where to pass purspose in this code.
I also check `active_shipping/lib/active_shipping/carriers/fedex.rb` but purpose is not passed in xml.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant