caboose-cms 0.5.156 → 0.5.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose/checkout_confirm_without_payment.js +36 -0
- data/app/controllers/caboose/checkout_controller.rb +52 -17
- data/app/views/caboose/checkout/confirm_without_payment.html.erb +3 -6
- data/app/views/caboose/checkout/thanks.html.erb +14 -2
- data/config/routes.rb +2 -1
- data/lib/caboose/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2YwM2I5ZDUwYzdhZTQyZGRjZTFjMmI1MjFlNGRmYTk1ZDkxZjAwYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDE0NWMxY2IzNjZiZTJiODliMDY5NTlhZTU1NDlkMzY3Mjk1OGMyZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YWU2N2NjYjE0MWVjNzY1Y2Y2YjQyNWZmMTNhZmE3Y2NmMTdmOTJkMDlkMzdj
|
10
|
+
MjNjY2M1M2FkNzBjMjAzMTNmZWIyYjkyOTc1MTZlZGRiNjEwNmQyMzQ3OWE1
|
11
|
+
YzE1ZmFjNTcyMzA4MGVmYTQ1MWY1YTM3MzA5NTRhNDhiOTRlYmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGI0ODI2ZWVjYWMyNzM1MWNhNjM5YmQwMzQyNjFjOTA5ZjAzNzJjM2EwYzIx
|
14
|
+
YzA3YTg3YmE0MTJhYmRlYjAyZTFlMGRhMzk1NTlmMWQyMjdjM2I5MWU0NTQ3
|
15
|
+
MGQyYTBmOWYyOWI3YTI4Yzk0ZjE2NmZiOTdmYjY4MzM0NjcyNTM=
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
Caboose.Store.Modules.CheckoutPayment = (function() {
|
3
|
+
|
4
|
+
self = {
|
5
|
+
is_confirm: false
|
6
|
+
};
|
7
|
+
|
8
|
+
self.initialize = function() {
|
9
|
+
$('#checkout-continue button').click(self.continue_handler);
|
10
|
+
};
|
11
|
+
|
12
|
+
self.continue_handler = function(event) {
|
13
|
+
$('#message').html("<p class='loading'>Processing...</p>");
|
14
|
+
$.ajax({
|
15
|
+
url: '/checkout/confirm',
|
16
|
+
type: 'post',
|
17
|
+
success: function(resp)
|
18
|
+
{
|
19
|
+
if (resp.success == true)
|
20
|
+
{
|
21
|
+
if (resp.redirect)
|
22
|
+
window.location = resp.redirect;
|
23
|
+
else
|
24
|
+
window.location = '/checkout/thanks';
|
25
|
+
}
|
26
|
+
else if (resp.error)
|
27
|
+
$('#message').html("<p class='note error'>" + resp.error + "</p>");
|
28
|
+
else
|
29
|
+
$('#message').html("<p class='note error'>There was an error processing your payment.</p>");
|
30
|
+
}
|
31
|
+
});
|
32
|
+
};
|
33
|
+
|
34
|
+
return self
|
35
|
+
}).call(Caboose.Store);
|
36
|
+
|
@@ -72,7 +72,7 @@ module Caboose
|
|
72
72
|
redirect_to '/checkout' and return if !logged_in?
|
73
73
|
redirect_to '/checkout/addresses' and return if @order.billing_address.nil? || (@order.has_shippable_items? && @order.shipping_address.nil?)
|
74
74
|
redirect_to '/checkout/shipping' and return if @order.has_shippable_items? && @order.has_empty_shipping_methods?
|
75
|
-
|
75
|
+
redirect_to '/checkout/confirm' and return if @order.total == 0.00
|
76
76
|
|
77
77
|
# Make sure all the variants still exist
|
78
78
|
@order.line_items.each do |li|
|
@@ -109,22 +109,57 @@ module Caboose
|
|
109
109
|
end
|
110
110
|
|
111
111
|
# GET /checkout/confirm
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
112
|
+
def confirm_without_payment
|
113
|
+
redirect_to '/checkout' and return if !logged_in?
|
114
|
+
redirect_to '/checkout/addresses' and return if @order.billing_address.nil? || (@order.has_shippable_items? && @order.shipping_address.nil?)
|
115
|
+
redirect_to '/checkout/shipping' and return if @order.has_shippable_items? && @order.has_empty_shipping_methods?
|
116
|
+
redirect_to '/checkout/payment' and return if @order.total > 0.00
|
117
|
+
|
118
|
+
# Make sure all the variants still exist
|
119
|
+
@order.line_items.each do |li|
|
120
|
+
v = Variant.where(:id => li.variant_id).first
|
121
|
+
if v.nil? || v.status == 'Deleted'
|
122
|
+
render :file => 'caboose/checkout/deleted_variant'
|
123
|
+
return
|
124
|
+
end
|
125
|
+
end
|
126
|
+
@logged_in_user = logged_in_user
|
127
|
+
end
|
128
|
+
|
129
|
+
# POST /checkout/confirm
|
130
|
+
def confirm
|
131
|
+
render :json => { :error => 'Not logged in.' } and return if !logged_in?
|
132
|
+
render :json => { :error => 'Invalid addresses.' } and return if @order.billing_address.nil? || (@order.has_shippable_items? && @order.shipping_address.nil?)
|
133
|
+
render :json => { :error => 'Invalid shipping methods.' } and return if @order.has_shippable_items? && @order.has_empty_shipping_methods?
|
134
|
+
render :json => { :error => 'Order requires payment.' } and return if @order.total > 0.00
|
135
|
+
|
136
|
+
resp = Caboose::StdClass.new
|
137
|
+
|
138
|
+
@order.financial_status = Order::FINANCIAL_STATUS_AUTHORIZED
|
139
|
+
@order.status = Order::STATUS_PENDING
|
140
|
+
@order.order_number = @site.store_config.next_order_number
|
141
|
+
|
142
|
+
# Take funds from any gift cards that were used on the order
|
143
|
+
@order.take_gift_card_funds
|
144
|
+
|
145
|
+
# Send out emails
|
146
|
+
OrdersMailer.configure_for_site(@site.id).customer_new_order(@order).deliver
|
147
|
+
OrdersMailer.configure_for_site(@site.id).fulfillment_new_order(@order).deliver
|
148
|
+
|
149
|
+
# Emit order event
|
150
|
+
Caboose.plugin_hook('order_authorized', @order)
|
151
|
+
|
152
|
+
# Save the order
|
153
|
+
@order.save
|
154
|
+
|
155
|
+
# Clear the cart and re-initialize
|
156
|
+
session[:cart_id] = nil
|
157
|
+
init_cart
|
158
|
+
|
159
|
+
resp.success = true
|
160
|
+
resp.redirect = '/checkout/thanks'
|
161
|
+
render :json => resp
|
162
|
+
end
|
128
163
|
|
129
164
|
# GET /checkout/thanks
|
130
165
|
def thanks
|
@@ -38,11 +38,8 @@ store_config = @site.store_config
|
|
38
38
|
</section>
|
39
39
|
<% end %>
|
40
40
|
<section id='payment_method'>
|
41
|
-
<h3>Payment Method</h3>
|
42
|
-
<
|
43
|
-
<p id='confirm_card_number'></p>
|
44
|
-
<p><a href="#" id='edit_payment'>Edit</a></p>
|
45
|
-
</div>
|
41
|
+
<h3>Payment Method</h3>
|
42
|
+
<p>Your order does not require payment.</p>
|
46
43
|
</section>
|
47
44
|
<div style='clear: left;'> </div>
|
48
45
|
</section>
|
@@ -59,7 +56,7 @@ store_config = @site.store_config
|
|
59
56
|
|
60
57
|
<%= content_for :caboose_js do %>
|
61
58
|
<%= javascript_include_tag 'caboose/cart' %>
|
62
|
-
<%= javascript_include_tag 'caboose/
|
59
|
+
<%= javascript_include_tag 'caboose/checkout_confirm_without_payment' %>
|
63
60
|
<script type='text/javascript'>
|
64
61
|
|
65
62
|
var cart = false;
|
@@ -4,13 +4,25 @@
|
|
4
4
|
|
5
5
|
<% if @last_order.has_downloadable_items? %>
|
6
6
|
<p>Your order contained downloadable items. Download your items with the links below:</p>
|
7
|
-
<ul>
|
7
|
+
<ul id='downloads'>
|
8
8
|
<% @last_order.line_items.each do |li| %>
|
9
9
|
<% if li.variant.downloadable %>
|
10
10
|
<li><a href='/my-account/orders/<%= @last_order.id %>/line-items/<%= li.id %>/download' target="_blank"><%= li.variant.product.title %></a></li>
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
13
|
-
</ul>
|
13
|
+
</ul>
|
14
14
|
<% end %>
|
15
15
|
|
16
16
|
<p><a href="/">Continue Shopping</a></p>
|
17
|
+
|
18
|
+
|
19
|
+
<%= content_for :caboose_css do %>
|
20
|
+
<style type='text/css'>
|
21
|
+
|
22
|
+
p { margin-bottom: 10px; }
|
23
|
+
|
24
|
+
#downloads { margin: 0 0 10px 0; padding: 0; list-style: none; }
|
25
|
+
#downloads li { margin: 0; padding: 0; }
|
26
|
+
|
27
|
+
</style>
|
28
|
+
<% end %>
|
data/config/routes.rb
CHANGED
@@ -388,7 +388,8 @@ Caboose::Engine.routes.draw do
|
|
388
388
|
put '/checkout/shipping' => 'checkout#update_shipping'
|
389
389
|
get '/checkout/gift-cards' => 'checkout#gift_cards'
|
390
390
|
get '/checkout/payment' => 'checkout#payment'
|
391
|
-
get '/checkout/confirm' => 'checkout#confirm_without_payment'
|
391
|
+
get '/checkout/confirm' => 'checkout#confirm_without_payment'
|
392
|
+
post '/checkout/confirm' => 'checkout#confirm'
|
392
393
|
get '/checkout/thanks' => 'checkout#thanks'
|
393
394
|
get '/checkout/test-email' => 'checkout#test_email'
|
394
395
|
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.158
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
@@ -408,6 +408,7 @@ files:
|
|
408
408
|
- app/assets/javascripts/caboose/cart_old.js
|
409
409
|
- app/assets/javascripts/caboose/checkout.js
|
410
410
|
- app/assets/javascripts/caboose/checkout_addresses.js
|
411
|
+
- app/assets/javascripts/caboose/checkout_confirm_without_payment.js
|
411
412
|
- app/assets/javascripts/caboose/checkout_gift_cards.js
|
412
413
|
- app/assets/javascripts/caboose/checkout_login_register.js
|
413
414
|
- app/assets/javascripts/caboose/checkout_module.js
|