caboose-store 0.0.35 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose_store/modules/checkout.js +2 -2
- data/app/assets/javascripts/caboose_store/modules/checkout_step3.js +2 -2
- data/app/controllers/caboose_store/checkout_controller.rb +1 -1
- data/app/models/caboose_store/order.rb +3 -3
- data/app/models/caboose_store/schema.rb +2 -1
- data/app/models/caboose_store/shipping_calculator.rb +3 -3
- data/lib/caboose-store.rb +2 -2
- data/lib/caboose-store/engine.rb +1 -1
- data/lib/caboose-store/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
|
+
MTU2YzBkNGJlOTQ1NmM1OTkwYTExNmQ5ZDNlOWEyY2IwYzUwMmNmYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzUwNTdhOTEzMzIxYzMyNzUzNzBkYWFkOWU1ZTYyODI0NGMzNDkyMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmQ4ZTIzNTE0YjJiMzBmMjgxNGY4NTA2NTM4MjBmNzYzNzc3NDQxYmI2ZTI5
|
10
|
+
YTg5NDg1YTg2MWMxODY2ZTk2NGJmOTRiYTIyZDExNWZiMWZkNDI2ODhjNmE0
|
11
|
+
Zjc4ZDVkYWRjYzQyMWI0MDZhYWFlNmExNDEwMmJmM2JiZWY2ZDA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGM5Y2ExMDFmYTU2YmU0ODE5ZTY3OTNmZmM5YzM5YWNhMjc3MWJhZmNjY2U1
|
14
|
+
OWE3YTdlYTJlY2VhODM3MGYyY2Y4MTgyMzczMmZjNjg4YjNjZDJhNGE0Y2Ex
|
15
|
+
NjExNWEyMDJhZWI5NGVmZTM3OTFiZGUxZTRiNjlmZGE2MmIzN2U=
|
@@ -166,7 +166,7 @@ Caboose.Store.Modules.Checkout = (function() {
|
|
166
166
|
$.ajax({
|
167
167
|
url: '/checkout/shipping',
|
168
168
|
type: 'put',
|
169
|
-
data: {
|
169
|
+
data: { shipping_method_code: event.target.value },
|
170
170
|
success: function(response) {
|
171
171
|
if (response.success) {
|
172
172
|
self.order = response.order;
|
@@ -192,7 +192,7 @@ Caboose.Store.Modules.Checkout = (function() {
|
|
192
192
|
self.paymentSubmitHandler = function(event) {
|
193
193
|
event.preventDefault();
|
194
194
|
|
195
|
-
if (!self.order.
|
195
|
+
if (!self.order.shipping_method_code) {
|
196
196
|
alert('Please choose a shipping method');
|
197
197
|
} else {
|
198
198
|
self.$checkout.off('submit', '#checkout-payment form#payment').addClass('loading');
|
@@ -17,8 +17,8 @@ Caboose.Store.Modules.CheckoutStep3 = (function() {
|
|
17
17
|
url: '/checkout/shipping',
|
18
18
|
type: 'put',
|
19
19
|
data: {
|
20
|
-
shipping_method:
|
21
|
-
|
20
|
+
shipping_method: $(event.target).data('shipping-method'),
|
21
|
+
shipping_method_code: $(event.target).data('shipping-code')
|
22
22
|
},
|
23
23
|
success: function(resp) {
|
24
24
|
if (resp.errors && resp.errors.length > 0)
|
@@ -163,7 +163,7 @@ module CabooseStore
|
|
163
163
|
# PUT /checkout/shipping
|
164
164
|
def update_shipping
|
165
165
|
@order.shipping_method = params[:shipping_method]
|
166
|
-
@order.shipping_method_code = params[:
|
166
|
+
@order.shipping_method_code = params[:shipping_method_code]
|
167
167
|
render :json => {
|
168
168
|
:success => @order.save,
|
169
169
|
:errors => @order.errors.full_messages
|
@@ -17,9 +17,9 @@ module CabooseStore
|
|
17
17
|
attr_accessible :id,
|
18
18
|
:order_number,
|
19
19
|
:subtotal,
|
20
|
-
:tax,
|
21
|
-
:shipping_code,
|
20
|
+
:tax,
|
22
21
|
:shipping_method,
|
22
|
+
:shipping_method_code,
|
23
23
|
:shipping,
|
24
24
|
:handling,
|
25
25
|
:discount,
|
@@ -170,7 +170,7 @@ module CabooseStore
|
|
170
170
|
end
|
171
171
|
|
172
172
|
def calculate_shipping
|
173
|
-
return 0 if !self.shipping_address || !self.
|
173
|
+
return 0 if !self.shipping_address || !self.shipping_method_code
|
174
174
|
ShippingCalculator.rate(self)[:total_price]
|
175
175
|
end
|
176
176
|
|
@@ -101,7 +101,8 @@ class CabooseStore::Schema < Caboose::Utilities::Schema
|
|
101
101
|
[ :referring_site , :text ],
|
102
102
|
[ :landing_page , :string ],
|
103
103
|
[ :landing_page_ref , :string ],
|
104
|
-
[ :
|
104
|
+
[ :shipping_method , :string ],
|
105
|
+
[ :shipping_method_code , :string ],
|
105
106
|
[ :transaction_id , :string ],
|
106
107
|
[ :auth_code , :string ],
|
107
108
|
[ :alternate_id , :integer ],
|
@@ -58,7 +58,7 @@ module CabooseStore
|
|
58
58
|
ups_response = ups.find_rates(origin, destination, packages)
|
59
59
|
|
60
60
|
rates = ups_response.rates.collect do |rate|
|
61
|
-
next if CabooseStore::
|
61
|
+
next if CabooseStore::allowed_shipping_method_codes && !CabooseStore::allowed_shipping_method_codes.index(rate.service_code)
|
62
62
|
|
63
63
|
{
|
64
64
|
:service_code => rate.service_code,
|
@@ -72,8 +72,8 @@ module CabooseStore
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def self.rate(order)
|
75
|
-
return nil if !order.
|
76
|
-
self.rates(order).each { |rate| return rate if rate[:service_code] == order.
|
75
|
+
return nil if !order.shipping_method_code
|
76
|
+
self.rates(order).each { |rate| return rate if rate[:service_code] == order.shipping_method_code }
|
77
77
|
return nil
|
78
78
|
end
|
79
79
|
end
|
data/lib/caboose-store.rb
CHANGED
data/lib/caboose-store/engine.rb
CHANGED
@@ -80,7 +80,7 @@ module CabooseStore::BootStrapper
|
|
80
80
|
:landing_page_ref => params[:ref] || nil
|
81
81
|
)
|
82
82
|
|
83
|
-
order.update_attribute(:
|
83
|
+
order.update_attribute(:shipping_method_code, CabooseStore::default_shipping_method_code) if CabooseStore::default_shipping_method_code
|
84
84
|
|
85
85
|
# Define the cart ID
|
86
86
|
session[:cart_id] = order.id
|