spree-contrib / spree_active_shipping Goto Github PK
View Code? Open in Web Editor NEWSpree integration for Shopify's active_shipping gem.
Home Page: http://guides.spreecommerce.org
Spree integration for Shopify's active_shipping gem.
Home Page: http://guides.spreecommerce.org
Not quite an issue that can be immediately acted on, but I figured I should list it here to put it on people's radar:
In May 2011, USPS will turn off their old apis and force everyone to move to their latest versions (http://creloaded.org/component/jmrphpbb/topic/30075.html?f=82&start=0). Here's the relevant part:
Rate, RateV2, RateV3 and IntlRate will be retired in May 2011, requiring all integrators to migrate to the latest versions
active_shipping will need to be brought up to date with this change. There's an issue logged against it here: https://github.com/Shopify/active_shipping/issues#issue/14
Once active_shipping is updated, spree_active_shipping will need to be updated to use the new active_shipping.
I'm beginning to lose hope here. Seems just about anything in any condition is getting passed into these compute methods. I call again on @cmar @BDQ @LBRapid @radar
Is it really normal behavior to have all of these different object types, some with stock_location, some without, some with shipment, some without? Just doesn't feel right to me and leads me to think there is a bigger problem upstream.
regarding this comment e537fa3
When using the 1-3-stable branch of this extension with Spree 1-3-stable the search_admin_products (get) route shows up after admin_product (get). This prevents the product promotion rules from being used because the json search always fails.
Without spree_active_shipping in the Gemfile of a fresh Spree 1-3-stable install for Rails 3.2.13:
~ bundle exec rake routes | grep admin_product
search_admin_products GET /admin/products/search(.:format) spree/admin/products#search
[19 routes removed for brevity]
admin_product GET /admin/products/:id(.:format) spree/admin/products#show
With spree_active_shipping:
~ bundle exec rake routes | grep admin_product
[8 routes removed]
admin_product GET /admin/products/:id(.:format) spree/admin/products#show
search_admin_products GET /admin/products/search(.:format) spree/admin/products#search
Here is the Gemfile I used to test this:
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'sqlite3'
group :assets do
gem 'sass-rails', '> 3.2.3'> 3.2.1'
gem 'coffee-rails', '
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'spree', :github => 'spree/spree', :branch => '1-3-stable'
gem 'spree_gateway', :github => 'spree/spree_gateway', :branch => '1-3-stable'
gem 'spree_auth_devise', :github => 'spree/spree_auth_devise', :branch => '1-3-stable'
gem 'spree_active_shipping', github: 'spree/spree_active_shipping', branch: '1-3-stable'
The symptoms of this route order mixup were referenced in this post that I made to the spree user group:
https://groups.google.com/forum/?fromgroups=#!topic/spree-user/nvIGBhTe-z4
Not so much an issue with existing codebase, but this seems like a reasonable place to start the discussion:
In our scenario, we have UPS and USPS. How hard would it be to only allow USPS shipping on addresses with PO Boxes? I will gladly provide a pull request if I have a clear to path to work on.
I am not entirely sure how to do this correctly.
I'd like to make FedEx Ground shipments via Spree. The :compute
method in our base class here generates ActiveShipping Location objects without specifying an :address_type, which means that ActiveShipping eventually treats them as Residential shipments ๐ก. FedEx only delivers Ground shipments to businesses, reserving a separate "Ground Home Delivery" for residential destinations. We'd really like to be able to send appropriate B2B shipments ๐ญ.
spree_active_shipping
generates Location
objects without specifying :address_type
From the Base calculator:
def compute(object)
...
origin= Location.new(:country => Spree::ActiveShipping::Config[:origin_country],
:city => Spree::ActiveShipping::Config[:origin_city],
:state => Spree::ActiveShipping::Config[:origin_state],
:zip => Spree::ActiveShipping::Config[:origin_zip])
...
destination = Location.new(:country => addr.country.iso,
:state => (addr.state ? addr.state.abbr : addr.state_name),
:city => addr.city,
:zip => addr.zipcode)
nil
for an :address_type
, which means it will never be :commercial?
From ActiveMerchant::Shipping::Location
def initialize(options = {})
...
self.address_type = options[:address_type]
end
...
def commercial?; @address_type == 'commercial' end
:commercial?
:address_type
From ActiveMerchant::Shipping::Fedex:
address_node << XmlNode.new("Residential", true) unless location.commercial?
... and FedEx only returns residential shipping options as per their docs linked above.
origin
object, pass an address_type: 'commercial
to ActiveShipping. Spree stores are inherently commmercial.destination
object, set addres_type
to 'commercial'
or 'residential'
as appropriate. This leads to...Thanks everyone! ๐
cc @jdugan
I was getting this error:
Mysql2::Error: Table 'vop_store_prod_snapshot.spree_product_packages' doesn't exist: SHOW FULL FIELDS FROM `spree_product_packages`
after I updated my Gemfile to point to:
gem 'spree_active_shipping', github: 'spree/spree_active_shipping', branch: '1-3-stable'
I expected that this command would pull in any missing migrations from all engine gems (including spree_active_shipping):
bundle exec rake railties:install:migrations db:migrate
but it did not. I assume that would work if the migrations were moved to db/migrate
though...
Tried deploying an app in development to production on both Heroku and a clean install CentOS and I'm getting the same issue.
Using RVM, Ruby 1.9.2p318, Rails 2.3.2. The Spree version is the 1.1 beta. Replication is fairly simple check project into github and then try to deploy on Heroku. The push to Heroku works, its when you try to run rake to create or migrate the DB is where it error out.
Here's the error:
rake aborted!
uninitialized constant ActiveShipping::Base
No very helpful.
Does this provide fedex integration as well?
I noticed that find_time_in_transit for UPS seems to return an empty hash for certain zip codes.
Heres an example:
i have an address with the zip code 96862. Here are some outputs of me calling certain methods:
retrieve_rates(origin, destination, order_packages) =>
{"UPS Ground"=>3061, "UPS Second Day Air"=>4862, "UPS Next Day Air"=>8419}
find_time_in_transit(origin, destination, order_packages) => {}
If I call these two methods on a zip code such as 06001, i get this:
retrieve_rates(origin, destination, order_packages) =>
{"UPS Ground"=>1220, "UPS Three-Day Select"=>2919, "UPS Second Day Air"=>3824, "UPS Next Day Air Saver"=>7509, "UPS Next Day Air Early A.M."=>11544, "UPS Next Day Air"=>8214}
find_time_in_transit(origin, destination, order_packages) =>
{"UPS Next Day Air Early A.M."=>{:service_code=>"1DM", :service_code_2=>"14", :service_desc=>"UPS Next Day Air Early A.M.", :guaranteed_code=>"Y", :business_transit_days=>"1", :date=>"2013-01-18"}, "UPS Next Day Air"=>{:service_code=>"1DA", :service_code_2=>"01", :service_desc=>"UPS Next Day Air", :guaranteed_code=>"Y", :business_transit_days=>"1", :date=>"2013-01-18"}, "UPS Next Day Air Saver"=>{:service_code=>"1DP", :service_code_2=>"13", :service_desc=>"UPS Next Day Air Saver", :guaranteed_code=>"Y", :business_transit_days=>"1", :date=>"2013-01-18"}, nil=>{:service_code=>"2DAS", :service_code_2=>nil, :service_desc=>"UPS 2nd Day Air (Saturday Delivery)", :guaranteed_code=>"Y", :business_transit_days=>"2", :date=>"2013-01-19"}, "UPS Second Day Air A.M."=>{:service_code=>"2DM", :service_code_2=>"59", :service_desc=>"UPS 2nd Day Air A.M.", :guaranteed_code=>"Y", :business_transit_days=>"2", :date=>"2013-01-21"}, "UPS Second Day Air"=>{:service_code=>"2DA", :service_code_2=>"02", :service_desc=>"UPS 2nd Day Air", :guaranteed_code=>"Y", :business_transit_days=>"2", :date=>"2013-01-21"}, "UPS Three-Day Select"=>{:service_code=>"3DS", :service_code_2=>"12", :service_desc=>"UPS 3 Day Select", :guaranteed_code=>"Y", :business_transit_days=>"3", :date=>"2013-01-22"}, "UPS Ground"=>{:service_code=>"GND", :service_code_2=>"03", :service_desc=>"UPS Ground", :guaranteed_code=>"Y", :business_transit_days=>"5", :date=>"2013-01-24"}}
This is a pure guess, but it seems to exist only for some addresses with isolated zip codes where UPS doesn't offer all available shipping methods. I have no idea how many zip codes exist where this happens, but I just encountered it for 96862.
I'm using the 1-3-stable branch, and I'm seeing warnings every time I run be rspec spec
:
/bundler/gems/spree_active_shipping-06ef8f6064d1/app/models/spree/calculator/usps/express_mail_international.rb:8: warning: already initialized constant WEIGHT_LIMITS
/bundler/gems/spree_active_shipping-06ef8f6064d1/app/models/spree/calculator/usps/priority_mail_international.rb:8: warning: already initialized constant WEIGHT_LIMITS
/bundler/gems/spree_active_shipping-06ef8f6064d1/app/models/spree/calculator/usps/priority_mail_international_large_flat_rate_box.rb:8: warning: already initialized constant AVAILABLE_COUNTRIES
/bundler/gems/spree_active_shipping-06ef8f6064d1/app/models/spree/calculator/usps/priority_mail_international_medium_flat_rate_box.rb:8: warning: already initialized constant AVAILABLE_COUNTRIES
/bundler/gems/spree_active_shipping-06ef8f6064d1/app/models/spree/calculator/usps/priority_mail_international_small_flat_rate_box.rb:8: warning: already initialized constant AVAILABLE_COUNTRIES
Any idea what's up?
Am I missing something, but is a full ordering only being sent in one package? The reason I ask is that I'm hitting a 70kg limit with UPS.
Thanks
John
Far as I understand, the whole spree_active_merchant
gem deals with ounces, such as when you're specifying weight in the product packages section, but snuck in the code is a warning that variants will by default be considered pounds. Why was it ever built this way? Even if I wanted to unify them by setting the unit multiplier to 1 (so that everything's considered pounds), it'd mean i wouldn't be able to have items weigh less than 1 or have some non-integer value, since the weight is stored as an integer. This just seems like a giant headache to dance around and explain to the client. Can this be improved? Or was this done by design for some reason?
I was talking to somebody about this at Spreeconf, they ship from locations in both US and Mexico, and they have to use a different UPS account for each.
We should store this at the StockLocation level but make it easy to simply clone the config from one to another for stores that don't have this need.
Hi, We have cloned the master branch to the spree application version 1.0.1, on checkout page we are getting an error as
undefined method `ignore_http_status=' for ActiveMerchant::Connection
Also tried following solution,
ActiveMerchant::Connection.instance_eval do
attr_accessor :ignore_http_status
end
from Google Groups http://groups.google.com/group/spree-user/browse_thread/thread/f7512e5a50feb753
Still getting same issue.
Any help is highly appreciated!!
I noticed that there are not any shipping calculators for any of the USPS First-Class services
(https://github.com/spree/spree_active_shipping/tree/master/app/models/spree/calculator/usps)
Our store would like to add these as shipping methods so I plan to create calculators for them. Should I attach a pull request here?
On a talk with @GeekOnCoffee at spreeconf we talked about how with the addition of warehouses, it is not unlikely for people to try and use it for warehouses in different countries, problem is that the current implementation only allows for 1 FedEx key (or any other carrier) and at least for FedEx, you need a different key for the other country.
The options we discussed where...
1- Have a section to define carriers and set their keys and then on the shipping method, select which carrier to use.
2- Just have the credentials with the shipping method, although less DRY, easier to implement
Just leaving this here for discussion.
This looks similar to issue #26
Using Spree 1-1-stable, ruby 1.9.3-p194, rails 3.2.9
/home/jet/.rvm/gems/[email protected]/gems/active_shipping-0.9.3/lib/vendor/quantified/lib/quantified/attribute.rb:107:in <class:A ttribute>': undefined method
class_inheritable_accessor' for Quantified::Attribute:Class (NoMethodError)
from /home/jet/.rvm/gems/[email protected]/gems/active_shipping-0.9.3/lib/vendor/quantified/lib/quantified/attribute.rb:2:i
n <module:Quantified>' from /home/jet/.rvm/gems/[email protected]/gems/active_shipping-0.9.3/lib/vendor/quantified/lib/quantified/attribute.rb:1:i n
<top (required)>'
from /home/jet/.rvm/gems/[email protected]/gems/polyglot-0.3.3/lib/polyglot.rb:63:in require' from /home/jet/.rvm/gems/[email protected]/gems/polyglot-0.3.3/lib/polyglot.rb:63:in
require'
from /home/jet/.rvm/gems/[email protected]/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in block in require' from /home/jet/.rvm/gems/[email protected]/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in
load_dependency'
from /home/jet/.rvm/gems/[email protected]/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in require' from /home/jet/.rvm/gems/[email protected]/gems/active_shipping-0.9.3/lib/vendor/quantified/lib/quantified.rb:6:in
<top (required)>'
from /home/jet/.rvm/gems/[email protected]/gems/active_shipping-0.9.3/lib/active_shipping/shipping/package.rb:4:in <class:Package>' from /home/jet/.rvm/gems/[email protected]/gems/active_shipping-0.9.3/lib/active_shipping/shipping/package.rb:3:in
module:Shipping'
from /home/jet/.rvm/gems/[email protected]/gems/active_shipping-0.9.3/lib/active_shipping/shipping/package.rb:2:in <module:ActiveMerchant>' from /home/jet/.rvm/gems/[email protected]/gems/active_shipping-0.9.3/lib/active_shipping/shipping/package.rb:1:in
<top (required)>'
from /home/jet/.rvm/gems/[email protected]/gems/polyglot-0.3.3/lib/polyglot.rb:63:in require' from /home/jet/.rvm/gems/[email protected]/gems/polyglot-0.3.3/lib/polyglot.rb:63:in
require'
Not clear to me what is happening here or should be happening. Seems that this should be redirecting back to display a flash error message. From the backtrace, seems that we failed to cache the error response.
This is easily repeatable on Spree 2.0 by simply putting in an invalid zip code in the checkout process.
It appears that if we fail in active_shipping/base.rb to find a workable rate, the return of nil somehow is preventing other shipping_methods from being offered. Results in flash error with empty string.
This is what I get now:
This calculator throws an error whenever it's called by the Spree 2.0 Estimator because it is designed around an expectation of an Order rather than the Package it's now given.
calling code:
# https://github.com/spree/spree/blob/a2d07bd057785f291118801a7514ce4d427c7af1/core/app/models/spree/stock/estimator.rb#L36
def calculate_cost(shipping_method, package)
shipping_method.calculator.compute(package)
end
Incompatible code:
# https://github.com/spree/spree_active_shipping/blob/b8d85d0a596a50b02cb7bd489b6fe152a4f0f5f1/app/models/spree/calculator/shipping/usps/first_class_mail_parcels.rb#L12
def available?(order)
multiplier = Spree::ActiveShipping::Config[:unit_multiplier]
weight = order.line_items.inject(0) do |weight, line_item|
The package payload coming in still contains the relevant information for summing up line item weights, e.g. package.map(&:variant).map(&:weight).reduce(&:+)
.
cc: @jdugan
In the base class, an empty cache entry is created in the rescue block to prevent constant re-lookups
but this seems to create an important issue : when I resubmit my form I do not always get the error again and I get an empty list of shipping options.
Am I missing something? It also allows customer without shipping option due to an error to complete checkout & payment without any shipping fee.
Migration fails at CreateDefaultStock. I tracked down the commit that was causing the issue:
Hi,
Is there a reason packages are not created with the variant's dimensions (see this code)?
I'm thinking of implementing it but I'd like to have some background on the initial decision to see if I am missing something.
Thanks!
Working on 2-0-stable.
Add two items to cart, each sourced from different stock locations.
Remove one of the items.
Shipping costs still displayed for both items.
Hi everyone, Im having a problem with Spree_active_shipping. I get a โShipping Error: ERROR - 1000: Authentication Failedโ error when checking out. Im using fedex, I added my Fedex credentials to lib/active_shipping_configuration.rb. I cant seem to get it to work, Iโve tried for about 2 weeks. Anyone have this issue or know how to configure spree_active_shipping? Thank you for your guidance in advance.
It appears that the response from USPS does not match with the rate codes in the calculators. For example the first class calculator shows the rate code as 0:
The response from USPS is:
{7=>480, 6=>506, 16=>1120, 40=>1120, 42=>1120, 38=>1120, 1=>1140, 4=>1140, 44=>1150, 28=>1160, 29=>1190, 17=>2470, 22=>3370, 63=>3990, 62=>3990, 31=>3990, 30=>3990, 27=>3990, 13=>3990, 3=>4435, 2=>4435, 55=>7990, 56=>7990}
If I modify first_class_mail_parcels.rb to have a rate code of 7 then the shipping is reflected properly in the application. This is something I can easily fix by updating the spree shipping models, but wanted to open an issue to make sure I wasn't overlooking some other obvious reason why these are not matching.
I am working with the master branch.
I receive this error when I attempt to visit a Product -> Product Packages page after having set a product package.
The page works correctly for the initial update (no product package exists, browse to product package page, complete form, update) but errors when I attempt to revisit that page.
ActionView::Template::Error (undefined method `admin_product_package_path' for #<#Class:0x000000065e0258:0x00000006726108>):
31: <%= pp_form.text_field :weight %>
32:
33:
34: <%= link_to_remove_fields t(:remove), pp_form %>
35:
36:
37: <% end %>
If i remove the link_to_remove_fields helper call the error goes away.
I believe the path should be admin_product_product_package_path, no?
looking to pass residential address is true - to get proper shipping costs through fedex
In shopify version Shopify/active_shipping#31
I believe this commit:
94dedd1#spree_active_shipping.gemspec
May have caused
bundle exec rake test_app
to stop working.
It currently fails with:
rake aborted!
cannot load such file -- active_shipping
Do we need to add the gem dependency back in with a newer version of active shipping?
Shipping Error: The postal code 77401 is invalid for MD United States.
~/.rvm/gems/ruby-1.9.2-p290@deepchange/bundler/gems/spree _active_shipping-a85128c2ddd9/app/models/calculator/active_shipping/base.rb:87:in `rescue in retrieve_rates'
~/.rvm/gems/ruby-1.9.2-p290@deepchange/bundler/gems/spree_active_shipping-a85128c2ddd9/app/models/calculator/active_shipping/base.rb:67:in `retrieve_rates'
~/.rvm/gems/ruby-1.9.2-p290@deepchange/bundler/gems/spree_active_shipping-a85128c2ddd9/app/models/calculator/active_shipping/base.rb:33:in `block in compute'
activesupport (3.1.3) lib/active_support/cache.rb:297:in `block in fetch'
activesupport (3.1.3) lib/active_support/cache.rb:520:in `instrument'
activesupport (3.1.3) lib/active_support/cache.rb:296:in `fetch'
~/.rvm/gems/ruby-1.9.2-p290@deepchange/bundler/gems/spree_active_shipping-a85128c2ddd9/app/models/calculator/active_shipping/base.rb:32:in `compute'
spree_core (0.70.3) app/models/order.rb:342:in `block in rate_hash'
spree_core (0.70.3) app/models/order.rb:341:in `collect'
spree_core (0.70.3) app/models/order.rb:341:in `rate_hash'
spree_core (0.70.3) app/controllers/checkout_controller.rb:87:in `before_delivery'
spree_core (0.70.3) app/controllers/checkout_controller.rb:77:in `state_callback'
spree_core (0.70.3) app/controllers/checkout_controller.rb:67:in `load_order'
activesupport (3.1.3) lib/active_support/callbacks.rb:448:in `_run__64289423__process_action__626393581__callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `block in instrument'
activesupport (3.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `instrument'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/params_wrapper.rb:201:in `process_action'
activerecord (3.1.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.1.3) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.1.3) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.1.3) lib/action_controller/metal.rb:193:in `dispatch'
actionpack (3.1.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.1.3) lib/action_controller/metal.rb:236:in `block in action'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in `call'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in `dispatch'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:29:in `call'
rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:in `block in call'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:96:in `block in recognize'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:75:in `optimized_each'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:95:in `recognize'
rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:in `call'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:532:in `call'
spree_core (0.70.3) lib/redirect_legacy_product_url.rb:10:in `call'
spree_core (0.70.3) lib/middleware/seo_assist.rb:23:in `call'
warden (1.0.6) lib/warden/manager.rb:35:in `block in call'
warden (1.0.6) lib/warden/manager.rb:34:in `catch'
warden (1.0.6) lib/warden/manager.rb:34:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.3.5) lib/rack/etag.rb:23:in `call'
rack (1.3.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/flash.rb:247:in `call'
rack (1.3.5) lib/rack/session/abstract/id.rb:195:in `context'
rack (1.3.5) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/cookies.rb:331:in `call'
activerecord (3.1.3) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (3.1.3) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
rails-dev-tweaks (0.5.2) lib/rails_dev_tweaks/granular_autoload/middleware.rb:34:in `call'
rack (1.3.5) lib/rack/sendfile.rb:101:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.3) lib/rails/rack/logger.rb:13:in `call'
rack (1.3.5) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.5) lib/rack/lock.rb:15:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.1.3) lib/rails/engine.rb:456:in `call'
rack (1.3.5) lib/rack/content_length.rb:14:in `call'
railties (3.1.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.3.5) lib/rack/handler/webrick.rb:59:in `service'
~/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
~/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
~/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Lets say you are shipping to Russia (from US) here is an address:
Snezhinsk, 456770, Russian Federation
My defined shipping providers are: USPS and FedEx ( all services from both )
When I call @order.rate_hash
it raises the following ShippingError
Spree::ShippingError (Shipping Error: WARNING - 556: There are no valid services available. ):
the error comes from:
raise rates_result if rates_result.kind_of?(Spree::ShippingError)
models/spree/calculator/shipping/active_shipping/base.rb#L58
The problem is that FedEx does not ship to that location in Russia (confirmed with FedEx over the phone), USPS does, but @order.rate_hash
never gets a chance to get the rates from USPS because raise error halts the operation sending the error back to you.
What is the best recommended way to deal with this situation?
I found that there are 2 missing services from USPS first class,
The cache_key used for caching quotes has no upper bound in length, dependent on the number of line items. Anyone using the filesystem for caching is going to have issues when there are a lot of line items, causing the filename size to overflow the maximum supported by the system.
Perhaps a SHA1 of the current cache key would be better, or at least a SHA1 of the line items would put an upper bound on the length.
I'm having a hard time getting active shipping installed. Rake fails when trying to migrate the database after a successful bundle install. I have just done a brand new install of Spree on a production server. All of the install went cleanly and it can be viewed at http://new.brushesandtools.com. I did not install the demo products.
Rails = 3.2.14
Spree = 2.0.4
After the new installation was working correctly I added spree_active_shipping (using the stable 2.0 version) to my gemfile. Then ran the following commands:
bundle install
bundle exec rake railties:install:migrations
bundle exec rake db:migrate
That should install the bundle and I should then have config options that show in the admin area for active shipping. Instead it gives me the error below. Full stack trace:
$ bundle exec rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant Spree::OrdersController
/home/page1/webapps/railsforspree/gems/bundler/gems/spree_active_shipping-e3cad1251706/app/controllers/spree/orders_controller_decorator.rb:2:in `<top (required)>'
/home/page1/webapps/railsforspree/gems/bundler/gems/spree_active_shipping-e3cad1251706/lib/spree_active_shipping/engine.rb:16:in `block in activate'
/home/page1/webapps/railsforspree/gems/bundler/gems/spree_active_shipping-e3cad1251706/lib/spree_active_shipping/engine.rb:15:in `glob'
/home/page1/webapps/railsforspree/gems/bundler/gems/spree_active_shipping-e3cad1251706/lib/spree_active_shipping/engine.rb:15:in `activate'
/home/page1/webapps/railsforspree/gems/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:429:in `_run__848123239978303829__prepare__2208846442150177112__callbacks'
/home/page1/webapps/railsforspree/gems/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/page1/webapps/railsforspree/gems/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
/home/page1/webapps/railsforspree/gems/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/page1/webapps/railsforspree/gems/gems/actionpack-3.2.14/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
/home/page1/webapps/railsforspree/gems/gems/actionpack-3.2.14/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
/home/page1/webapps/railsforspree/gems/gems/railties-3.2.14/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
/home/page1/webapps/railsforspree/gems/gems/railties-3.2.14/lib/rails/initializable.rb:30:in `instance_exec'
/home/page1/webapps/railsforspree/gems/gems/railties-3.2.14/lib/rails/initializable.rb:30:in `run'
/home/page1/webapps/railsforspree/gems/gems/railties-3.2.14/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/page1/webapps/railsforspree/gems/gems/railties-3.2.14/lib/rails/initializable.rb:54:in `each'
/home/page1/webapps/railsforspree/gems/gems/railties-3.2.14/lib/rails/initializable.rb:54:in `run_initializers'
/home/page1/webapps/railsforspree/gems/gems/railties-3.2.14/lib/rails/application.rb:136:in `initialize!'
/home/page1/webapps/railsforspree/gems/gems/railties-3.2.14/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/page1/webapps/railsforspree/brushesandtools/config/environment.rb:5:in `<top (required)>'
/home/page1/webapps/railsforspree/gems/gems/railties-3.2.14/lib/rails/application.rb:103:in `require_environment!'
/home/page1/webapps/railsforspree/gems/gems/railties-3.2.14/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/usr/local/lib/ruby20/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/usr/local/lib/ruby20/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/home/page1/webapps/railsforspree/gems/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/home/page1/webapps/railsforspree/gems/bin/rake:23:in `load'
/home/page1/webapps/railsforspree/gems/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate => environment
Here is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.14'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'pg'
gem 'therubyracer'
gem 'spree_active_shipping', :git => "git://github.com/spree/spree_active_shipping", :branch => '2-0-stable'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
Thanks!
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!
Here's a quote sheet from the USPS api as of this morning for a domestic shipment:
{"USPS First-Class Mail Postcards"=>33,
"USPS First-Class Mail Large Postcards"=>46,
"USPS First-Class Mail Letter"=>86,
"USPS First-Class Mail Parcel"=>207,
"USPS Library Mail"=>240,
"USPS Media Mail"=>253,
"USPS Priority Mail 1-Day Gift Card Flat Rate Envelope"=>560,
"USPS Priority Mail 1-Day Window Flat Rate Envelope"=>560,
"USPS Priority Mail 1-Day Small Flat Rate Envelope"=>560,
"USPS Standard Post"=>560,
"USPS Priority Mail 1-Day Flat Rate Envelope"=>560,
"USPS Priority Mail 1-Day"=>560,
"USPS Priority Mail 1-Day Legal Flat Rate Envelope"=>575,
"USPS Priority Mail 1-Day Small Flat Rate Box"=>580,
"USPS Priority Mail 1-Day Padded Flat Rate Envelope"=>595,
"USPS Priority Mail 1-Day Medium Flat Rate Box"=>1235,
"USPS Priority Mail Express 2-Day Hold For Pickup"=>1410,
"USPS Priority Mail Express 2-Day"=>1410,
"USPS Priority Mail 1-Day Large Flat Rate Box"=>1685,
"USPS Priority Mail Express 2-Day Flat Rate Envelope Hold For Pickup"=>1995,
"USPS Priority Mail Express 2-Day Padded Flat Rate Envelope Hold For Pickup"=>
1995,
"USPS Priority Mail Express 2-Day Legal Flat Rate Envelope Hold For Pickup"=>
1995,
"USPS Priority Mail Express 2-Day Padded Flat Rate Envelope"=>1995,
"USPS Priority Mail Express 2-Day Legal Flat Rate Envelope"=>1995,
"USPS Priority Mail Express 2-Day Flat Rate Envelope"=>1995,
"USPS Priority Mail Express 2-Day Flat Rate Boxes"=>3995,
"USPS Priority Mail Express 2-Day Flat Rate Boxes Hold For Pickup"=>3995}
Here's the current name mapping for the USPS rate offerings from en.yml
:
usps:
express_mail: "USPS Express Mail"
express_mail_intl: "USPS Express Mail International"
media_mail: "USPS Media Mail"
priority_mail: "USPS Priority Mail"
priority_mail_small_flat_rate_box: "USPS Priority Mail Small Flat Rate Box"
priority_mail_medium_flat_rate_box: "USPS Priority Mail Medium Flat Rate Box"
priority_mail_large_flat_rate_box: "USPS Priority Mail Large Flat Rate Box"
priority_mail_flat_rate_envelope: "USPS Priority Mail Flat Rate Envelope"
priority_mail_international: "USPS Priority Mail International"
priority_mail_international_small_flat_rate_box: "USPS Priority Mail International Small Flat Rate Box"
priority_mail_international_medium_flat_rate_box: "USPS Priority Mail International Medium Flat Rate Box"
priority_mail_international_large_flat_rate_box: "USPS Priority Mail International Large Flat Rate Box"
Since the base calculator resolves the API responses by comparing the response hash key to the calculator's localized :description, this is a problem. Not sure if there's a way around manually updating the YAML file when the API udpates, but here we are.
Thanks!
line_items
and not the unshipped inventory itemsPossible solution:
packages
check if the order is completeline_items
to calculate shippingOf course store preferences for inventory tracking will have to be taken into account.
There are many services in drop down like for fed ex ground and home etc
What will happen if suddenly a service is stopped by fed ex ?
How it is handled in this gem or is it not handled ?
I'm using this along with the spree_essential_cms gem. Not sure why but spree_essential_cms relies on activemerchant 1.14. I was wondering if spree_active_shipping was compatible? And if so can I install it as a plugin?
[edit...] I isolated the spree version to .60.1 and still getting the error.
Bundler could not find compatible versions for gem "activemerchant":
In Gemfile:
spree (~> 0.60.1) depends on
activemerchant (= 1.15.0)
spree_active_shipping depends on
activemerchant (1.9.0)
Any ideas? =/
I've just updated to spree 1.2. and come across a weird problem. Sometimes, I'll get the following error when calculating shipping:
ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5 seconds (waited 5.0029481350000005 seconds). The max pool size is currently 5; consider increasing it.
. I'm using active_shipping
0.9.14. Here is the stacktrace:
activerecord-3.2.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:258โ block (2 levels) in checkout
activerecord-3.2.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:242โ loop
activerecord-3.2.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:242โ block in checkout
/usr/local/lib/ruby/1.9.1/monitor.rb:211โ mon_synchronize
activerecord-3.2.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:239โ checkout
activerecord-3.2.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:102โ block in connection
/usr/local/lib/ruby/1.9.1/monitor.rb:211โ mon_synchronize
activerecord-3.2.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:101โ connection
activerecord-3.2.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:410โ retrieve_connection
activerecord-3.2.10/lib/active_record/connection_adapters/abstract/connection_specification.rb:171โ retrieve_connection
activerecord-3.2.10/lib/active_record/connection_adapters/abstract/connection_specification.rb:145โ connection
activerecord-3.2.10/lib/active_record/associations/association_scope.rb:13โ initialize
activerecord-3.2.10/lib/active_record/associations/association.rb:98โ new
activerecord-3.2.10/lib/active_record/associations/association.rb:98โ association_scope
activerecord-3.2.10/lib/active_record/associations/association.rb:87โ scoped
activerecord-3.2.10/lib/active_record/associations/singular_association.rb:42โ find_target
activerecord-3.2.10/lib/active_record/associations/association.rb:145โ load_target
activerecord-3.2.10/lib/active_record/associations/association.rb:55โ reload
activerecord-3.2.10/lib/active_record/associations/singular_association.rb:9โ reader
activerecord-3.2.10/lib/active_record/associations/builder/association.rb:44โ block in define_readers
[GEM_ROOT]/bundler/gems/spree_active_shipping-64219139f9b8/app/models/spree/calculator/active_shipping/base.rb:34โ compute
spree_core-1.2.3/app/models/spree/order.rb:413โ block (2 levels) in rate_hash
I'm downgrading to 0.9.13 to see if that helps. Any ideas what could be causing this issue?
I'm guessing I may have something set up wrong, but the calculators don't seem to be being registered for me. I'm using the 2-0-stable branch. I installed as described in the readme (added the gem and installed/ran migrations). It looks like the calculators are to be added in engine.rb. But Spree::ShippingMethod.calculators does not include the active_shipping calculators. Am I missing something obvious? I am using a number of other extensions, which would have the possibility of interfering I guess, but not likely in my opinion. Thanks for help anyone can give.
I'm assuming that spree_active_shipping's version numbers parallel those of Spree, and noticed the following after a bundle update:
Using spree_active_shipping (1.2.0) from git://github.com/spree/spree_active_shipping.git (at 2-0-stable)
Should the 2-0-stable
version say 2.0.x?
This is only tested against USPS Priority Mail shipping costs for now.
An order, which contains two shipments... both shipments will contribute to the cost calculation for the query made against the USPS service. I'm guessing the weight for the entire order is being passed to the USPS query rather than the weight for the specific shipment..
Going in.. cover me.
Upgrading to spree/spree branch 1-3-stable (rails 3.2.14), all paths helpers are broken.
It seems prefixing with spree.
fixes most of the problems but calls to link_to_remove_fields
still fails and I haven't found a workaround yet.
I'm getting the following error message from Bundle when trying to use spree_active_merchant with spree 1.3.1. Could I please get some feedback as to what might be the issue. Thank you.
Bundler could not find compatible versions for gem "activemerchant":
In Gemfile:
spree_active_shipping (>= 0) ruby depends on
activemerchant (= 1.9.0) ruby
spree (~> 1.3.1) ruby depends on
activemerchant (1.29.3)
The following is my Gemfile.
source 'https://rubygems.org'
ruby "1.9.3"
gem 'rails', '3.2.10'
gem 'spree', '~> 1.3.1'
gem 'spree_home_page_features'
gem 'spree_active_shipping', :branch => '1-3-stable'
gem 'active_shipping'
group :assets do
gem 'sass-rails', '> 3.2.3'> 3.2.1'
gem 'coffee-rails', '
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
group :development, :test do
gem 'pry'
gem 'sqlite3'
end
group :production do
gem 'pg'
end
gem 'spree_gateway', :github => 'spree/spree_gateway', :branch => '1-3-stable'
gem 'spree_auth_devise', :github => 'spree/spree_auth_devise', :branch => 'edge'
gem 'spree_multi_lingual', :git => "git://github.com/jipiboily/spree_multi_lingual.git", :branch => '1-3-stable'
gem 'globalize3'
these two classes where hot fixes for functionality not available inside active_shipping, these have fixed in active_shipping, so we need to either remove them or maintain them because shipping API's tend to change a lot frequently, I vote to remove them and let active_shipping deal with them since they have more contributors than we do
searching through the Code Climate build errors I see it's failing due to a bump in Shopify/active_shipping@6ce76d9
Bundler could not find compatible versions for gem "active_shipping":
In Gemfile:
spree_active_shipping (>= 0) ruby depends on
active_shipping (~> 0.10.0) ruby
active_shipping (0.11.0)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.