spree_active_shipping icon indicating copy to clipboard operation
spree_active_shipping copied to clipboard

Rails 4.0.3, Spree 2.2-stable & Canadapost not returning results

Open zyferdigital opened this issue 10 years ago • 5 comments

Issue:

When using Canada Post (Regular, xpresspost, etc. does not seem to matter which one) there are no results when you go to checkout. Instead it returns you to the address page with the following message/error:

"We are unable to calculate shipping rates for the selected items."

Steps to Reproduce:

  1. http://0.0.0.0:3000/admin/active_shipping_settings/edit: Add your Canada Post login, origin country: 'CA', origin state: 'ON', origin city: 'Toronto', origin zip: 'M5V1J1', test mode: 'OFF'. Leave all other settings to their default (units: imperial, multiplier: 16, etc.)
  2. Create a zone for Canada - select "country based"
  3. create a shipping method - Calculator: select 'Canada post Regular', zones: select 'Canada', shipping category: select 'default'
  4. Ensure your products belong to the 'default' shipping category
  5. Add product packages to your product - make sure there is weight and dimensions
  6. Go to the front end and add item(s) to cart
  7. checkout with a Canadian address and click continue
  8. You're returned to the address page with the error: "We are unable to calculate shipping rates for the selected items."

Did a fresh install with sample data and fewer extensions (spree, spree_auth_devise, spree_active_shipping). Got the following error:

"Please implement 'compute_package(package)' in your calculator: Spree::Calculator::Shipping::CanadaPost::Regular"

Expected Result

After submitting address, go to the delivery page with rates returned from Canada Post

Spree, Rails & Gems:

Spree: 2.2.2-stable Rails 4.0.3

source 'https://rubygems.org'

gem 'rails', '4.0.3'
gem 'mysql2'

gem 'sass-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'

group :assets do
  gem 'therubyracer', '0.10.2', :platforms => :ruby
  gem 'libv8', '3.3.10.4'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'

group :doc do
  gem 'sdoc', require: false
end

gem 'rvm-capistrano'

gem 'spree', github: 'spree/spree', branch: '2-2-stable'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '2-2-stable'
gem 'spree_active_shipping', :git => "git://github.com/spree/spree_active_shipping", :branch => "2-2-stable"
gem 'spree_paypal_express', :github => "radar/better_spree_paypal_express", :branch => "2-2-stable"
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-2-stable'
gem "spree_comments", github: 'spree/spree_comments', :branch => '2-2-stable'
gem 'spree_static_content', github: 'spree/spree_static_content', branch: '2-2-stable'
gem 'spree_print_invoice' , :git => 'git://github.com/spree/spree_print_invoice.git', branch: '2-2-stable'
gem 'spree_related_products', :git => 'git://github.com/spree/spree_related_products.git', branch: '2-2-stable'

gem 'spree_multi_currency', :github => "spree/spree_multi_currency", branch: '2-2-stable'
gem 'spree_abandoned_cart_email'

zyferdigital avatar Mar 25 '14 15:03 zyferdigital

@zyferdigital I can't work out how to sign up for a Canada Post developer account, so I am not sure how I am going to reproduce this one.

radar avatar Apr 03 '14 23:04 radar

You have to call to create a "sell online" account. But before you do, you need to sign up for a "venture one" account here: https://www.canadapost.ca/cpid/apps/businesssignup?execution=e1s1

Both are free.

zyferdigital avatar Apr 04 '14 00:04 zyferdigital

I think we should probably investigate using Easypost for this, although their CanadaPost endpoint is in beta at this point in time. ActiveShipping is a ghetto.

radar avatar Jun 10 '14 00:06 radar

Hey @zyferdigital . Did you get that to work ?

msevestre avatar Aug 28 '14 13:08 msevestre

One issue is that the new REST API (with key/secret) won't work. You need a CPC merchant ID to use this implementation.

I forked it and added the CanadaPostPWS service to spree-active-shipping. Sorry I have not had time to submit a pull request - also, I have not added all services.

carchrae avatar Sep 18 '14 18:09 carchrae