caboose-cms 0.5.87 → 0.5.88

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmY4OTYwYjU3MDliOGNlMDM0YjYzNGZlMWYxZTY3OGE5NzVlZjUxNQ==
4
+ MDg3NGE4N2VhNjdiN2NiMzc1MDNjZGNhMGRkZWY0MzAzM2ZlN2VmMA==
5
5
  data.tar.gz: !binary |-
6
- YjcxYWUwNzk5YWFmYWYzNDA4OTU0M2NlMWExZDM4MjdjZWVmNTEwYw==
6
+ N2VmYzY3OTcwOTA0ZDk2YmI5ZGY2OTM2NDA1ZDMyYjBlM2QyNzAxMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmQzYzM5ZThkZDdmYzNjNzcyODc3NGVlNGFkNjY4MWVmMzYyNzIzYzBhMTdh
10
- ZTU0NzYzODQwODBiM2YzZDc2ODFjMDllYjBkNzZjYTZhMzQ2NThhM2RlMGNl
11
- NjVjZTFjYzllYTdiODgxMGZmYzcxZjhlZGRjNDMxZDUyNzNkM2I=
9
+ ZWE5MTBjMzhiMDU2ODcxYTQ5NjcyNzAzZTc5YzAzYmVhNDQzNjYwNDIzOTlj
10
+ ZWViZWYxMmMzZmYxZmNmZGJhOWZmY2RhNzM5OGM4YWUwZDMwZDQyNmY3OTI3
11
+ NTBjNjc1NjBhM2NhYzIwODAxODhlOWQ5OThkZDU0M2ExZjliN2E=
12
12
  data.tar.gz: !binary |-
13
- Y2ZhYmQ1YzY3YjdmZjdlN2EzOWY0NjU2MjhkNGJkYjI0ZmQxOTdlYTRiMTcx
14
- ZWQ3YTQ3NzE0NjAwZjBhODc2N2JlZTMzNmNjZWE4NmU2NjVmZWU0ZWI0NzEy
15
- MzBhMDNhYWI2ODEwYjk0NTAxZTkyMDNiMzY5NWQxNDRhZTBkZTA=
13
+ ZjE2MjQ4ODI1M2UxZGU0MDZiN2JjOTJiZGM4YTYyM2M0ODU4NDdhNWU2ZWI3
14
+ NWU0MDczZjhmOGU1NTgyZTNhOWU2MTcwZmJmYTUwZGQ5ZGMyZmYwMzE4ZWRm
15
+ OGU0NGEzYjZjZWQ2ODlkZGRhZDRiMGRlNWFhZTE0Y2NkNDQ4MTI=
@@ -643,6 +643,30 @@ OrderController.prototype = {
643
643
  if (resp.refresh) window.location.reload(true);
644
644
  }
645
645
  });
646
+ },
647
+
648
+ capture_funds: function(confirm)
649
+ {
650
+ var that = this;
651
+ if (!confirm)
652
+ {
653
+ var p = $('<p/>').addClass('note confirm')
654
+ .append("Are you sure you want to charge " + that.order.total + " to the customer? ")
655
+ .append($('<input/>').attr('type','button').val('Yes').click(function() { that.capture_funds(true); }))
656
+ .append(' ')
657
+ .append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); }));
658
+ $('#message').empty().append(p);
659
+ return;
660
+ }
661
+ $('#message').html("<p class='loading'>Capturing funds...</p>");
662
+ $.ajax({
663
+ url: '/admin/orders/' + order_id + '/capture',
664
+ success: function(resp) {
665
+ if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
666
+ if (resp.success) $('#message').html("<p class='note success'>" + resp.success + "</p>");
667
+ if (resp.refresh) window.location.reload(true);
668
+ }
669
+ });
646
670
  }
647
671
 
648
672
  //resend_confirmation: function(order_id)
@@ -657,30 +681,7 @@ OrderController.prototype = {
657
681
  // }
658
682
  // });
659
683
  //},
660
- //
661
- //capture_funds: function(order_id, confirm)
662
- //{
663
- // total = $('#total').html();
664
- // if (!confirm)
665
- // {
666
- // var p = $('<p/>').addClass('note confirm')
667
- // .append("Are you sure you want to charge " + total + " to the customer? ")
668
- // .append($('<input/>').attr('type','button').val('Yes').click(function() { capture_funds(order_id, true); }))
669
- // .append(' ')
670
- // .append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); modal.autosize(); }));
671
- // modal.autosize(p);
672
- // return;
673
- // }
674
- // modal.autosize("<p class='loading'>Capturing funds...</p>");
675
- // $.ajax({
676
- // url: '/admin/orders/' + order_id + '/capture',
677
- // success: function(resp) {
678
- // if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
679
- // if (resp.success) modal.autosize("<p class='note success'>" + resp.success + "</p>");
680
- // if (resp.refresh) window.location.reload(true);
681
- // }
682
- // });
683
- //},
684
+ //
684
685
  //
685
686
  //refund_order: function(order_id, confirm)
686
687
  //{
@@ -83,7 +83,7 @@ module Caboose
83
83
  #:relay_url => "#{request.protocol}#{request.host_with_port}/checkout/authnet-relay/#{@order.id}",
84
84
  :relay_response => 'TRUE',
85
85
  #:relay_url => "#{request.protocol}#{request.host_with_port}/checkout/authnet-relay",
86
- :relay_url => sc.pp_relay_url,
86
+ :relay_url => "#{sc.pp_relay_domain}/checkout/authnet-relay",
87
87
  :transaction_type => 'AUTH_ONLY',
88
88
  :test => sc.pp_testing
89
89
  )
@@ -54,30 +54,36 @@ module Caboose
54
54
 
55
55
  resp = Caboose::StdClass.new
56
56
  order = Order.find(params[:id])
57
+ t = OrderTransaction.where(:order_id => order.id, :transaction_type => OrderTransaction::TYPE_AUTHORIZE, :success => true).first
57
58
 
58
59
  if order.financial_status == 'captured'
59
60
  resp.error = "This order has already been captured, you will need to refund instead"
61
+ elsif t.nil?
62
+ resp.error = "This order doesn't seem to be authorized."
60
63
  else
61
-
62
- t = OrderTransaction.where(:order_id => order.id, :transaction_type => OrderTransaction::TYPE_AUTHORIZE, :success => true)
64
+
63
65
  sc = @site.store_config
64
- response = AuthorizeNet::SIM::Transaction.new(
65
- sc.pp_username,
66
- sc.pp_password,
67
- order.total,
68
- :transaction_type => 'VOID',
69
- :transaction_id => t.transaction_id
70
- )
71
- order.update_attributes(
72
- :financial_status => 'voided',
73
- :status => 'cancelled'
74
- )
75
- order.save
76
-
77
- # Add the variant quantities ordered back
78
- #order.cancel
79
-
80
- resp.success = "Order voided successfully"
66
+ case sc.pp_name
67
+ when 'authorize.net'
68
+
69
+ response = AuthorizeNet::SIM::Transaction.new(
70
+ sc.pp_username,
71
+ sc.pp_password,
72
+ order.total,
73
+ :transaction_type => 'VOID',
74
+ :transaction_id => t.transaction_id
75
+ )
76
+ order.update_attributes(
77
+ :financial_status => 'voided',
78
+ :status => 'cancelled'
79
+ )
80
+ order.save
81
+ # TODO: Add the variant quantities ordered back
82
+ resp.success = "Order voided successfully"
83
+ when 'payscape'
84
+ # TODO: Implement payscape void order
85
+ end
86
+
81
87
  end
82
88
 
83
89
  render :json => resp
@@ -240,24 +246,34 @@ module Caboose
240
246
  def capture_funds
241
247
  return if !user_is_allowed('orders', 'edit')
242
248
 
243
- response = Caboose::StdClass.new({
244
- 'refresh' => nil,
245
- 'error' => nil,
246
- 'success' => nil
247
- })
248
-
249
+ response = Caboose::StdClass.new
249
250
  order = Order.find(params[:id])
251
+ t = OrderTransaction.where(:order_id => order.id, :transaction_type => OrderTransaction::TYPE_AUTHORIZE, :success => true).first
250
252
 
251
253
  if order.financial_status == 'captured'
252
254
  resp.error = "Funds for this order have already been captured."
253
255
  elsif order.total > order.auth_amount
254
256
  resp.error = "The order total exceeds the authorized amount."
257
+ elsif t.nil?
258
+ resp.error = "This order doesn't seem to be authorized."
255
259
  else
256
- if PaymentProcessor.capture(order)
257
- order.update_attribute(:financial_status, 'captured')
258
- response.success = 'Captured funds successfully'
259
- else
260
- response.error = 'Error capturing funds'
260
+
261
+ sc = @site.store_config
262
+ case sc.pp_name
263
+ when 'authorize.net'
264
+
265
+ response = AuthorizeNet::SIM::Transaction.new(
266
+ sc.pp_username,
267
+ sc.pp_password,
268
+ order.total,
269
+ :transaction_type => 'CAPTURE_ONLY',
270
+ :transaction_id => t.transaction_id
271
+ )
272
+ order.update_attribute(:financial_status, 'captured')
273
+ resp.success = 'Captured funds successfully'
274
+ when 'payscape'
275
+ # TODO: Implement capture funds for payscape
276
+
261
277
  end
262
278
 
263
279
  #if (order.discounts.any? && order.total < order.discounts.first.amount_current) || PaymentProcessor.capture(order)
@@ -273,6 +289,7 @@ module Caboose
273
289
  #else
274
290
  # response.error = "Error capturing funds."
275
291
  #end
292
+
276
293
  end
277
294
 
278
295
  render :json => response
@@ -27,7 +27,7 @@ module Caboose
27
27
  when 'pp_username' then sc.pp_username = value
28
28
  when 'pp_password' then sc.pp_password = value
29
29
  when 'pp_testing' then sc.pp_testing = value
30
- when 'pp_relay_url' then sc.pp_relay_url = value
30
+ when 'pp_relay_domain' then sc.pp_relay_domain = value
31
31
  when 'ups_username' then sc.ups_username = value
32
32
  when 'ups_password' then sc.ups_password = value
33
33
  when 'ups_key' then sc.ups_key = value
@@ -58,7 +58,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
58
58
  #Caboose::PageCache => [:block],
59
59
  Caboose::ShippingPackage => [:price, :carrier, :service_code, :service_name, :shipping_method_id, :length, :width, :height],
60
60
  Caboose::Site => [:shipping_cost_function],
61
- Caboose::StoreConfig => [:use_usps, :allowed_shipping_codes, :default_shipping_code],
61
+ Caboose::StoreConfig => [:use_usps, :allowed_shipping_codes, :default_shipping_code, :pp_relay_url, :pp_response_url],
62
62
  Caboose::Variant => [:quantity],
63
63
  Caboose::Vendor => [:vendor, :vendor_id]
64
64
  }
@@ -557,9 +557,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
557
557
  [ :pp_name , :string ],
558
558
  [ :pp_username , :string ],
559
559
  [ :pp_password , :string ],
560
- [ :pp_testing , :boolean , { :default => true }],
561
- [ :pp_relay_url , :string ],
562
- [ :pp_response_url , :string ],
560
+ [ :pp_testing , :boolean , { :default => true }],
561
+ [ :pp_relay_domain , :string ],
563
562
  [ :ups_username , :string ],
564
563
  [ :ups_password , :string ],
565
564
  [ :ups_key , :string ],
@@ -8,7 +8,7 @@ store_config = @site.store_config
8
8
  <form id="payment" target="relay" action="https://secure.authorize.net/gateway/transact.dll" method="post">
9
9
  <%= sim_fields(@sim_transaction) %>
10
10
  <input type="hidden" id="x_invoice_num" name="x_invoice_num" value="<%= @order.id %>" />
11
- <input type="hidden" id="x_description" name="x_after_relay" value="<%= raw store_config.pp_response_url %>/<%= @order.id %>" />
11
+ <input type="hidden" id="x_description" name="x_after_relay" value="<%= raw store_config.pp_relay_domain %>/checkout/authnet-response/<%= @order.id %>" />
12
12
  <input type="hidden" id="x_first_name" name="x_first_name" value="<%= raw @order.billing_address.first_name %>" />
13
13
  <input type="hidden" id="x_last_name" name="x_last_name" value="<%= raw @order.billing_address.last_name %>" />
14
14
  <input type="hidden" id="x_address" name="x_address" value="<%= raw @order.billing_address.address1 %>" />
@@ -10,15 +10,15 @@
10
10
  <p>
11
11
  <input type='button' value='< Back' onclick="window.location='/admin/orders';" />
12
12
  <% if @order.financial_status == 'authorized' %>
13
- <input type='button' value='Capture Funds' onclick="capture_funds(<%= @order.id %>);" />
14
- <input type='button' value='Void' onclick="controller.void_order();" />
13
+ <input type='button' value='Capture Funds' onclick="controller.capture_funds();" />
14
+ <input type='button' value='Void' onclick="controller.void_order();" />
15
15
  <% end %>
16
16
  <% if @order.financial_status == 'captured' %>
17
17
  <input type='button' value='Refund' onclick="refund_order(<%= @order.id %>);" />
18
18
  <% end %>
19
19
  <input type='button' value='Resend Confirmation' onclick="resend_confirmation(<%= @order.id %>)" />
20
- <input type='button' value='Add Item' onclick="controller.add_variant();" />
21
- <input type='button' value='Print Order' onclick="controller.print_order(<%= @order.id %>);" />
20
+ <input type='button' value='Add Item' onclick="controller.add_variant();" />
21
+ <input type='button' value='Print Order' onclick="controller.print_order(<%= @order.id %>);" />
22
22
 
23
23
  <% str = Caboose.plugin_hook('admin_edit_order_buttons', "", @order) %>
24
24
  <% if str %><%= raw str %><% end %>
@@ -9,7 +9,7 @@ sc = @store_config
9
9
  <p><div id='storeconfig_<%= sc.id %>_pp_name' ></div></p>
10
10
  <p><div id='storeconfig_<%= sc.id %>_pp_username' ></div></p>
11
11
  <p><div id='storeconfig_<%= sc.id %>_pp_password' ></div></p>
12
- <p><div id='storeconfig_<%= sc.id %>_pp_relay_url' ></div></p>
12
+ <p><div id='storeconfig_<%= sc.id %>_pp_relay_domain' ></div></p>
13
13
  <p><div id='storeconfig_<%= sc.id %>_pp_testing' ></div></p>
14
14
 
15
15
  <h2>Fulfillment Contacts</h2>
@@ -69,8 +69,8 @@ $(document).ready(function() {
69
69
  { name: 'pp_name' , nice_name: 'Type' , type: 'select' , value: <%= raw Caboose.json(sc.pp_name ) %>, width: 400 , options_url: '/admin/store/payment-processor-options' },
70
70
  { name: 'pp_username' , nice_name: 'Username' , type: 'text' , value: <%= raw Caboose.json(sc.pp_username ) %>, width: 400 },
71
71
  { name: 'pp_password' , nice_name: 'Password' , type: 'text' , value: <%= raw Caboose.json(sc.pp_password ) %>, width: 400 },
72
- { name: 'pp_testing' , nice_name: 'Test Mode' , type: 'checkbox' , value: <%= raw Caboose.json(sc.pp_testing ? 1 : 0 ) %>, width: 400 },
73
- { name: 'pp_relay_url' , nice_name: 'Relay URL' , type: 'text' , value: <%= raw Caboose.json(sc.pp_relay_url ) %>, width: 400 },
72
+ { name: 'pp_relay_domain' , nice_name: 'Relay Domain' , type: 'text' , value: <%= raw Caboose.json(sc.pp_relay_domain ) %>, width: 400 },
73
+ { name: 'pp_testing' , nice_name: 'Test Mode' , type: 'checkbox' , value: <%= raw Caboose.json(sc.pp_testing ? 1 : 0 ) %>, width: 400 },
74
74
  { name: 'fulfillment_email' , nice_name: 'Fulfillment Email' , type: 'text' , value: <%= raw Caboose.json(sc.fulfillment_email ) %>, width: 400 },
75
75
  { name: 'shipping_email' , nice_name: 'Shipping Email' , type: 'text' , value: <%= raw Caboose.json(sc.shipping_email ) %>, width: 400 },
76
76
  { name: 'handling_percentage' , nice_name: 'Handling Percentage' , type: 'text' , value: <%= raw Caboose.json(sc.handling_percentage ) %>, width: 400 },
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.87'
2
+ VERSION = '0.5.88'
3
3
  end
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.87
4
+ version: 0.5.88
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
@@ -696,7 +696,6 @@ files:
696
696
  - app/views/caboose/categories/admin_edit.html.erb
697
697
  - app/views/caboose/categories/admin_index.html.erb
698
698
  - app/views/caboose/categories/admin_new.html.erb
699
- - app/views/caboose/checkout/#Untitled-1#
700
699
  - app/views/caboose/checkout/_address_form.html.erb
701
700
  - app/views/caboose/checkout/_billing_form.html.erb
702
701
  - app/views/caboose/checkout/_cart.html.erb
@@ -1,3 +0,0 @@
1
- https://locker-room.biz/checkout/payment?show_relay=1
2
- https://locker-room.biz/checkout/authnet-relay
3
- https://lockerroom.caboosecms.com/checkout/authnet-relay