spree-contrib / spree_active_shipping

Spree integration for Shopify's active_shipping gem.
http://guides.spreecommerce.org
134 stars 207 forks source link

Wrong Number of Arguments for USPS Calculator #53

Open iloveitaly opened 11 years ago

iloveitaly commented 11 years ago

I'm getting an exception when calculating shipping costs for USPS: ArgumentError: wrong number of arguments(1 for 0).

The strange part of this is it doesn't happen all of the time. I can calculate shipping with the same address and same order information: sometimes it happens, sometimes it doesn't.

My thought is it has something to do with shipping calculation threading, but I don't have enough knowledge about threading to pick out where things are going wrong.

active_utils-1.0.5/lib/active_utils/common/posts_data.rb:56→ initialize
active_utils-1.0.5/lib/active_utils/common/posts_data.rb:56→ new
active_utils-1.0.5/lib/active_utils/common/posts_data.rb:56→ new_connection
active_utils-1.0.5/lib/active_utils/common/posts_data.rb:36→ raw_ssl_request
active_utils-1.0.5/lib/active_utils/common/posts_data.rb:30→ ssl_request
active_utils-1.0.5/lib/active_utils/common/posts_data.rb:22→ ssl_get
active_shipping-0.9.14/lib/active_shipping/shipping/carriers/usps.rb:425→ commit
active_shipping-0.9.14/lib/active_shipping/shipping/carriers/usps.rb:176→ us_rates
active_shipping-0.9.14/lib/active_shipping/shipping/carriers/usps.rb:156→ find_rates
[GEM_ROOT]/bundler/gems/spree_active_shipping-64219139f9b8/app/models/spree/calculator/active_shipping/base.rb:90→ retrieve_rates
[GEM_ROOT]/bundler/gems/spree_active_shipping-64219139f9b8/app/models/spree/calculator/active_shipping/base.rb:44→ block in compute
activesupport-3.2.10/lib/active_support/cache.rb:297→ block in fetch
activesupport-3.2.10/lib/active_support/cache.rb:520→ instrument
activesupport-3.2.10/lib/active_support/cache.rb:296→ fetch
[GEM_ROOT]/bundler/gems/spree_active_shipping-64219139f9b8/app/models/spree/calculator/active_shipping/base.rb:39→ compute
spree_core-1.2.3/app/models/spree/order.rb:413→ block (2 levels) in rate_hash

Any help would be much appreciated!

iloveitaly commented 11 years ago

I've also gotten this with the ups calculator:


active_utils-1.0.5/lib/active_utils/common/posts_data.rb:56→ initialize
active_utils-1.0.5/lib/active_utils/common/posts_data.rb:56→ new
active_utils-1.0.5/lib/active_utils/common/posts_data.rb:56→ new_connection
active_utils-1.0.5/lib/active_utils/common/posts_data.rb:36→ raw_ssl_request
active_utils-1.0.5/lib/active_utils/common/posts_data.rb:30→ ssl_request
active_utils-1.0.5/lib/active_utils/common/posts_data.rb:26→ ssl_post
active_shipping-0.9.14/lib/active_shipping/shipping/carriers/ups.rb:375→ commit
[GEM_ROOT]/bundler/gems/spree_active_shipping-64219139f9b8/lib/spree/active_shipping/ups_override.rb:197→ find_rates
[GEM_ROOT]/bundler/gems/spree_active_shipping-64219139f9b8/app/models/spree/calculator/active_shipping/base.rb:90→ retrieve_rates
[GEM_ROOT]/bundler/gems/spree_active_shipping-64219139f9b8/app/models/spree/calculator/active_shipping/base.rb:44→ block in compute
activesupport-3.2.10/lib/active_support/cache.rb:297→ block in fetch
activesupport-3.2.10/lib/active_support/cache.rb:520→ instrument
activesupport-3.2.10/lib/active_support/cache.rb:296→ fetch
[GEM_ROOT]/bundler/gems/spree_active_shipping-64219139f9b8/app/models/spree/calculator/active_shipping/base.rb:39→ compute
spree_core-1.2.3/app/models/spree/order.rb:413→ block (2 levels) in rate_hash
jspizziri commented 9 years ago

@iloveitaly, what's the status of this. Was this resolved in the spree project?

iloveitaly commented 9 years ago

@jspizziri Honestly, I don't remember. For us, somehow it was resolved.

The only thing I can think of is ensuring that all of the UPS configuration settings are set:

Spree::ActiveShipping::Config.set(:ups_login => ENV['UPS_LOGIN'])
Spree::ActiveShipping::Config.set(:ups_password => ENV['UPS_PASSWORD'])
Spree::ActiveShipping::Config.set(:ups_key => ENV['UPS_KEY'])
Spree::ActiveShipping::Config.set(:usps_login => ENV['USPS_LOGIN'])