caboose-cms 0.5.86 → 0.5.87

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
- ZjMyNzZjNzE0NGZkZDE3N2UzMDcyNTdkZjRkYmQzNzQwNWMzNWUxOA==
4
+ MmY4OTYwYjU3MDliOGNlMDM0YjYzNGZlMWYxZTY3OGE5NzVlZjUxNQ==
5
5
  data.tar.gz: !binary |-
6
- MDk0NDljNWYzY2FmYTJlYmJhNDNjNTI1NzJlNDBlN2Q2MmVjYzNjNw==
6
+ YjcxYWUwNzk5YWFmYWYzNDA4OTU0M2NlMWExZDM4MjdjZWVmNTEwYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjkzODMxMjk0ZjZiNmZmOTQ5ZWZlMzRkZWZmMTJiYjYyMDk0NWIxYmU4NWM0
10
- OTBlZGY5ODhlMjk1ZmI0MzM0NzBlMjYwMTEyNTcyYTZlZjYwNzI1OGZlOWVj
11
- OWQyZDZjMWUwNDM4YzE4ZDg5MjQ1NWJjYzJjZjEwNzdjZTljZGI=
9
+ NmQzYzM5ZThkZDdmYzNjNzcyODc3NGVlNGFkNjY4MWVmMzYyNzIzYzBhMTdh
10
+ ZTU0NzYzODQwODBiM2YzZDc2ODFjMDllYjBkNzZjYTZhMzQ2NThhM2RlMGNl
11
+ NjVjZTFjYzllYTdiODgxMGZmYzcxZjhlZGRjNDMxZDUyNzNkM2I=
12
12
  data.tar.gz: !binary |-
13
- NzA5Yjk1MjUzNzRiMzQzNTE3OGEzMmU0ZWQxZGY2NDY4NjEwNDMwZTZmN2Q0
14
- ODg4NjdhMjE4ODYxNjU0YmRhNDIzYmExZGVmYTVjZWUxZDJhNjk3NDdhMWVl
15
- OGQ0YjZlMjk5YWY2ODFmZWM3N2JhNDZmODk4OGJiMDZhN2E1Yjc=
13
+ Y2ZhYmQ1YzY3YjdmZjdlN2EzOWY0NjU2MjhkNGJkYjI0ZmQxOTdlYTRiMTcx
14
+ ZWQ3YTQ3NzE0NjAwZjBhODc2N2JlZTMzNmNjZWE4NmU2NjVmZWU0ZWI0NzEy
15
+ MzBhMDNhYWI2ODEwYjk0NTAxZTkyMDNiMzY5NWQxNDRhZTBkZTA=
@@ -619,6 +619,30 @@ OrderController.prototype = {
619
619
  else that.refresh();
620
620
  }
621
621
  });
622
+ },
623
+
624
+ void_order: function(confirm)
625
+ {
626
+ var that = this;
627
+ if (!confirm)
628
+ {
629
+ var p = $('<p/>').addClass('note confirm')
630
+ .append("Are you sure you want to void this order? ")
631
+ .append($('<input/>').attr('type','button').val('Yes').click(function() { that.void_order(true); }))
632
+ .append(' ')
633
+ .append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); }));
634
+ $('#message').empty().append(p);
635
+ return;
636
+ }
637
+ $('#message').html("<p class='loading'>Voiding...</p>");
638
+ $.ajax({
639
+ url: '/admin/orders/' + order_id + '/void',
640
+ success: function(resp) {
641
+ if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
642
+ if (resp.success) $('#message').html("<p class='note success'>" + resp.success + "</p>");
643
+ if (resp.refresh) window.location.reload(true);
644
+ }
645
+ });
622
646
  }
623
647
 
624
648
  //resend_confirmation: function(order_id)
@@ -656,30 +680,7 @@ OrderController.prototype = {
656
680
  // if (resp.refresh) window.location.reload(true);
657
681
  // }
658
682
  // });
659
- //},
660
- //
661
- //void_order: function(order_id, confirm)
662
- //{
663
- // if (!confirm)
664
- // {
665
- // var p = $('<p/>').addClass('note confirm')
666
- // .append("Are you sure you want to void this order? ")
667
- // .append($('<input/>').attr('type','button').val('Yes').click(function() { void_order(order_id, true); }))
668
- // .append(' ')
669
- // .append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); modal.autosize(); }));
670
- // modal.autosize(p);
671
- // return;
672
- // }
673
- // modal.autosize("<p class='loading'>Voiding...</p>");
674
- // $.ajax({
675
- // url: '/admin/orders/' + order_id + '/void',
676
- // success: function(resp) {
677
- // if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
678
- // if (resp.success) modal.autosize("<p class='note success'>" + resp.success + "</p>");
679
- // if (resp.refresh) window.location.reload(true);
680
- // }
681
- // });
682
- //},
683
+ //},
683
684
  //
684
685
  //refund_order: function(order_id, confirm)
685
686
  //{
@@ -52,33 +52,35 @@ module Caboose
52
52
  def admin_void
53
53
  return if !user_is_allowed('orders', 'edit')
54
54
 
55
- response = Caboose::StdClass.new({
56
- 'refresh' => nil,
57
- 'error' => nil,
58
- 'success' => nil
59
- })
60
-
55
+ resp = Caboose::StdClass.new
61
56
  order = Order.find(params[:id])
62
57
 
63
58
  if order.financial_status == 'captured'
64
- response.error = "This order has already been captured, you will need to refund instead"
59
+ resp.error = "This order has already been captured, you will need to refund instead"
65
60
  else
66
- if PaymentProcessor.void(order)
67
- order.update_attributes(
68
- :financial_status => 'voided',
69
- :status => 'cancelled'
70
- )
61
+
62
+ t = OrderTransaction.where(:order_id => order.id, :transaction_type => OrderTransaction::TYPE_AUTHORIZE, :success => true)
63
+ 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
71
76
 
72
- # Add the variant quantities ordered back
73
- #order.cancel
77
+ # Add the variant quantities ordered back
78
+ #order.cancel
74
79
 
75
- response.success = "Order voided successfully"
76
- else
77
- response.error = "Error voiding order."
78
- end
80
+ resp.success = "Order voided successfully"
79
81
  end
80
82
 
81
- render :json => response
83
+ render :json => resp
82
84
  end
83
85
 
84
86
  # GET /admin/orders/:id/refund
@@ -11,7 +11,7 @@
11
11
  <input type='button' value='< Back' onclick="window.location='/admin/orders';" />
12
12
  <% if @order.financial_status == 'authorized' %>
13
13
  <input type='button' value='Capture Funds' onclick="capture_funds(<%= @order.id %>);" />
14
- <input type='button' value='Void' onclick="void_order(<%= @order.id %>);" />
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 %>);" />
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.86'
2
+ VERSION = '0.5.87'
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.86
4
+ version: 0.5.87
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry