caboose-cms 0.5.209 → 0.5.210
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/models/caboose/order_package.rb +1 -1
- data/app/models/caboose/shipping_calculator.rb +13 -13
- data/lib/caboose/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGFkYzFmNDk4NWRjNjlmYTM5OGQ0ZjA3NjJjODdiNGMzYjAwODA3NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGQ4OGU0ZGVlMDYxODM2NTFjMTRkYTBiZWU4Y2E4NTIxZjRhYzc4Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MWE1YmRhOWUzODMyNDA3ODNmM2M4OTAzYmE5MzJkM2NmNjllNWQ3OTAwOGY1
|
10
|
+
YTBjYWI2NDk3YzE3ZDhjMjcxZGM4NmNlYTk1ZmE1OGM0NjA1NjEyMmMzYzhh
|
11
|
+
YmE0ZTE2NjU5ZDdkMzdlZWRmNDI5NDZmNDVmZmM0Mzc3NzIxODQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWRjODBlN2Y3ZjYzYTkxOGQ2ZmMwMTdiYjY4ODg5YzU2MjA4YzIzZjUzYzA1
|
14
|
+
NzM1YTMwNDc4OGU5OGM5YWUwMzc3ZDc2YWVhZThkNjRhNjc5YTAzZjM4YzYx
|
15
|
+
ODZmNTc0OTNjNGVjMmEwMzFhODMzMTQ1MDdlMTUzYmNhNWYwMWE=
|
@@ -3,7 +3,7 @@ require 'active_shipping'
|
|
3
3
|
|
4
4
|
module Caboose
|
5
5
|
class ShippingCalculator
|
6
|
-
|
6
|
+
|
7
7
|
def self.custom_rates(store_config, order)
|
8
8
|
return eval(store_config.custom_shipping_function)
|
9
9
|
end
|
@@ -81,12 +81,12 @@ module Caboose
|
|
81
81
|
order = op.order
|
82
82
|
sc = order.site.store_config
|
83
83
|
sa = order.shipping_address
|
84
|
-
origin = Location.new(:country => sc.origin_country, :state => sc.origin_state, :city => sc.origin_city, :zip => sc.origin_zip)
|
85
|
-
destination = Location.new(:country => sc.origin_country, :state => sa.state, :city => sa.city, :postal_code => sa.zip)
|
84
|
+
origin = ActiveShipping::Location.new(:country => sc.origin_country, :state => sc.origin_state, :city => sc.origin_city, :zip => sc.origin_zip)
|
85
|
+
destination = ActiveShipping::Location.new(:country => sc.origin_country, :state => sa.state, :city => sa.city, :postal_code => sa.zip)
|
86
86
|
carriers = {}
|
87
|
-
carriers['UPS'] = UPS.new( :login => sc.ups_username, :password => sc.ups_password, :key => sc.ups_key, :origin_account => sc.ups_origin_account) if sc.ups_username && sc.ups_username.strip.length > 0
|
88
|
-
carriers['USPS'] = USPS.new( :login => sc.usps_username) if sc.usps_username && sc.usps_username.strip.length > 0
|
89
|
-
carriers['FedEx'] = FedEx.new(:login => sc.fedex_username, :password => sc.fedex_password, :key => sc.fedex_key, :account => sc.fedex_account) if sc.fedex_username && sc.fedex_username.strip.length > 0
|
87
|
+
carriers['UPS'] = ActiveShipping::UPS.new( :login => sc.ups_username, :password => sc.ups_password, :key => sc.ups_key, :origin_account => sc.ups_origin_account) if sc.ups_username && sc.ups_username.strip.length > 0
|
88
|
+
carriers['USPS'] = ActiveShipping::USPS.new( :login => sc.usps_username) if sc.usps_username && sc.usps_username.strip.length > 0
|
89
|
+
carriers['FedEx'] = ActiveShipping::FedEx.new(:login => sc.fedex_username, :password => sc.fedex_password, :key => sc.fedex_key, :account => sc.fedex_account) if sc.fedex_username && sc.fedex_username.strip.length > 0
|
90
90
|
|
91
91
|
sp = op.shipping_package
|
92
92
|
package = op.activemerchant_package
|
@@ -115,22 +115,22 @@ module Caboose
|
|
115
115
|
order = op.order
|
116
116
|
sc = order.site.store_config
|
117
117
|
sa = order.shipping_address
|
118
|
-
origin = Location.new(:country => sc.origin_country, :state => sc.origin_state, :city => sc.origin_city, :zip => sc.origin_zip)
|
119
|
-
destination = Location.new(:country => sc.origin_country, :state => sa.state, :city => sa.city, :postal_code => sa.zip)
|
118
|
+
origin = ActiveShipping::Location.new(:country => sc.origin_country, :state => sc.origin_state, :city => sc.origin_city, :zip => sc.origin_zip)
|
119
|
+
destination = ActiveShipping::Location.new(:country => sc.origin_country, :state => sa.state, :city => sa.city, :postal_code => sa.zip)
|
120
120
|
|
121
121
|
carrier = case op.shipping_method.carrier
|
122
|
-
when 'UPS' then UPS.new( :login => sc.ups_username, :password => sc.ups_password, :key => sc.ups_key, :origin_account => sc.ups_origin_account)
|
123
|
-
when 'USPS' then USPS.new( :login => sc.usps_username)
|
124
|
-
when 'FedEx' then FedEx.new(:login => sc.fedex_username, :password => sc.fedex_password, :key => sc.fedex_key, :account => sc.fedex_account)
|
122
|
+
when 'UPS' then ActiveShipping::UPS.new( :login => sc.ups_username, :password => sc.ups_password, :key => sc.ups_key, :origin_account => sc.ups_origin_account)
|
123
|
+
when 'USPS' then ActiveShipping::USPS.new( :login => sc.usps_username)
|
124
|
+
when 'FedEx' then ActiveShipping::FedEx.new(:login => sc.fedex_username, :password => sc.fedex_password, :key => sc.fedex_key, :account => sc.fedex_account)
|
125
125
|
end
|
126
126
|
|
127
|
-
Caboose.log(op.shipping_method.inspect)
|
127
|
+
#Caboose.log(op.shipping_method.inspect)
|
128
128
|
|
129
129
|
sm = op.shipping_method
|
130
130
|
package = op.activemerchant_package
|
131
131
|
resp = carrier.find_rates(origin, destination, package)
|
132
132
|
resp.rates.sort_by(&:price).each do |rate|
|
133
|
-
Caboose.log("rate.service_code = #{rate.service_code}, rate.service_name = #{rate.service_name}")
|
133
|
+
#Caboose.log("rate.service_code = #{rate.service_code}, rate.service_name = #{rate.service_name}")
|
134
134
|
sm2 = ShippingMethod.where( :carrier => sm.carrier, :service_code => rate.service_code, :service_name => rate.service_name).first
|
135
135
|
sm2 = ShippingMethod.create(:carrier => sm.carrier, :service_code => rate.service_code, :service_name => rate.service_name) if sm2.nil?
|
136
136
|
if sm2.id == sm.id
|
data/lib/caboose/version.rb
CHANGED