caboose-cms 0.7.26 → 0.7.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cbedc8eb22cdc7fe35035da2e8a2115b21242af
4
- data.tar.gz: 32d51d39f8312a4a9a46e994c485efbf4c531fa4
3
+ metadata.gz: 09b8be49da8f98835e23293bd190dc36fe08e7ca
4
+ data.tar.gz: ea3dc7cf4d1d322ab599d456a9e2e2b687a05748
5
5
  SHA512:
6
- metadata.gz: 236bd5322624a04ea7b2cc4b6c06e1c3216b556b24f5f62cc07a5f6c8d7ca4159622498d8acc53dd2427442afd538ac6bd24d1afe690dfa120949af803b76ee4
7
- data.tar.gz: 05916a5469fdc4c67e88df67179a4977184efa71dbfeaaec8b9839a11164b87fcfe04118687454b3e6074d76eaa5850907d181292397e8a89fdca3a3286eab04
6
+ metadata.gz: 61ad49076220e5e907860229e7c93669111592147219fd10c3d8b40c698a31555fca740b00ec5e71a1268e3a58dc97f62a16154df385d7acd32e1f9208a3d7c1
7
+ data.tar.gz: 6a9bf468065377ca084c7504bc10905810df3215c4ef0dbe0f2739fef1515fced6ccd7725c76358aeeaf298af3f05bba4c806a252925b0bdc95488bc22dba5b9
@@ -49,10 +49,31 @@ Caboose.Store.Modules.CheckoutPayment = (function() {
49
49
  }
50
50
  }
51
51
  else
52
- {
53
- $('#message').html("<p class='loading'>Processing payment...</p>");
54
- $('form#payment').submit();
55
- $('#checkout-continue button').hide();
52
+ {
53
+ // Verify that the order total is correct before submitting
54
+ $('#message').html("<p class='loading'>Verifying order total...</p>");
55
+ var total_is_correct = true;
56
+ $.ajax({
57
+ url: '/checkout/total',
58
+ type: 'get',
59
+ success: function(x) {
60
+ if (parseFloat(x) != CABOOSE_ORDER_TOTAL)
61
+ total_is_correct = false;
62
+ },
63
+ async: false
64
+ });
65
+
66
+ if (total_is_correct == false)
67
+ {
68
+ $('#message').html("<p class='note error'>It looks like the order total has changed since this page has refreshed. Please submit your order again after this page refreshes.");
69
+ setTimeout(function() { window.location.reload(true); }, 3000);
70
+ }
71
+ else
72
+ {
73
+ $('#message').html("<p class='loading'>Processing payment...</p>");
74
+ $('form#payment').submit();
75
+ $('#checkout-continue button').hide();
76
+ }
56
77
  }
57
78
  };
58
79
 
@@ -181,6 +181,16 @@ module Caboose
181
181
  end
182
182
 
183
183
  #===========================================================================
184
+
185
+ # GET /checkout/total
186
+ def verify_total
187
+ total = 0.00
188
+ if logged_in?
189
+ @order.calculate
190
+ total = @order.total
191
+ end
192
+ render :json => total
193
+ end
184
194
 
185
195
  # GET /checkout/address
186
196
  def address
@@ -18,7 +18,8 @@ module Caboose
18
18
  'customer_id' => '',
19
19
  'status' => Order::STATUS_PENDING,
20
20
  'shipping_method_code' => '',
21
- 'id' => ''
21
+ 'id' => '',
22
+ 'order_number' => ''
22
23
  }, {
23
24
  'model' => 'Caboose::Order',
24
25
  'sort' => 'id',
@@ -124,11 +124,13 @@ store_config = @site.store_config
124
124
  var SHOW_RELAY = <%= @show_relay ? 'true' : 'false' %>;
125
125
 
126
126
  var cart = false;
127
+ var CABOOSE_ORDER_TOTAL = 0.0;
127
128
  $(document).ready(function() {
128
129
  cart = new Cart({
129
130
  allow_edit_line_items: false,
130
131
  allow_edit_gift_cards: false
131
132
  });
133
+ CABOOSE_ORDER_TOTAL = <%= Caboose.json(@order.total); %>;
132
134
  });
133
135
 
134
136
  </script>
@@ -11,7 +11,8 @@
11
11
  <a class="caboose-btn" href='/admin/orders/summary-report' target='_blank'>Summary Report</a>
12
12
  </p>
13
13
  <form action='/admin/orders' method='get' id='search_form' style='display: none;'>
14
- <p><input type='text' name='id' placeholder='Order ID' value="<%= @pager.params['id'] %>" style='width: 100px;' /></p>
14
+ <p><input type='text' name='id' placeholder='Order ID' value="<%= @pager.params['id'] %>" style='width: 100px;' /></p>
15
+ <p><input type='text' name='order_number' placeholder='Order Number' value="<%= @pager.params['order_number'] %>" style='width: 100px;' /></p>
15
16
  <p><select name='customer_id'>
16
17
  <optgroup label='Status' style='width: 100px'>
17
18
  <option value=''>-- All customers --</option>
@@ -513,6 +513,7 @@ Caboose::Engine.routes.draw do
513
513
  #=============================================================================
514
514
 
515
515
  get '/checkout' => 'checkout#index'
516
+ get '/checkout/total' => 'checkout#verify_total'
516
517
  post '/checkout/attach-user' => 'checkout#attach_user'
517
518
  post '/checkout/attach-guest' => 'checkout#attach_guest'
518
519
  get '/checkout/addresses' => 'checkout#addresses'
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.7.26'
2
+ VERSION = '0.7.27'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.26
4
+ version: 0.7.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2015-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg