Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

When Spree::ActiveShipping::Config[:shipper_number] is "", an empty S…

…hipperNumber node is added to the request, resulting in a "Missing/Invalid Shipper/ShipperNumber" error response from UPS.

By adding .presence, we can have it treat a "" value as nil so that it will skip adding the
ShipperNumber node when shipper_number is "" instead of treating "" as a truthy value.

Fixes #57
  • Loading branch information...
commit 4500193db50453b5d81441fd2c81e3fbcf46f4fc 1 parent 44062ea
@TylerRick TylerRick authored radar committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/spree/active_shipping/ups_override.rb
4 lib/spree/active_shipping/ups_override.rb
@@ -88,7 +88,7 @@ def build_rate_request(origin, destination, packages, options={})
# * Shipment/RateInformation element
#SPREE OVERRIDE Negotiated Rates
- if (origin_account = @options[:origin_account] || options[:origin_account])
+ if (origin_account = @options[:origin_account].presence || options[:origin_account].presence)
shipment <<"RateInformation") do |rate_information|
rate_information <<"NegotiatedRatesIndicator", '')
@@ -157,7 +157,7 @@ def build_location_node(name,location,options={})
location_node <<'PhoneNumber',[^\d]/,'')) unless
location_node <<'FaxNumber', location.fax.gsub(/[^\d]/,'')) unless location.fax.blank?
- if name == 'Shipper' and (origin_account = @options[:origin_account] || options[:origin_account])
+ if name == 'Shipper' and (origin_account = @options[:origin_account].presence || options[:origin_account].presence)
location_node <<'ShipperNumber', origin_account)
elsif name == 'ShipTo' and (destination_account = @options[:destination_account] || options[:destination_account])
location_node <<'ShipperAssignedIdentificationNumber', destination_account)
Please sign in to comment.
Something went wrong with that request. Please try again.