caboose-cms 0.5.86 → 0.5.87
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
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmY4OTYwYjU3MDliOGNlMDM0YjYzNGZlMWYxZTY3OGE5NzVlZjUxNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjcxYWUwNzk5YWFmYWYzNDA4OTU0M2NlMWExZDM4MjdjZWVmNTEwYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmQzYzM5ZThkZDdmYzNjNzcyODc3NGVlNGFkNjY4MWVmMzYyNzIzYzBhMTdh
|
10
|
+
ZTU0NzYzODQwODBiM2YzZDc2ODFjMDllYjBkNzZjYTZhMzQ2NThhM2RlMGNl
|
11
|
+
NjVjZTFjYzllYTdiODgxMGZmYzcxZjhlZGRjNDMxZDUyNzNkM2I=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
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
|
-
|
59
|
+
resp.error = "This order has already been captured, you will need to refund instead"
|
65
60
|
else
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
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
|
-
|
73
|
-
|
77
|
+
# Add the variant quantities ordered back
|
78
|
+
#order.cancel
|
74
79
|
|
75
|
-
|
76
|
-
else
|
77
|
-
response.error = "Error voiding order."
|
78
|
-
end
|
80
|
+
resp.success = "Order voided successfully"
|
79
81
|
end
|
80
82
|
|
81
|
-
render :json =>
|
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(
|
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 %>);" />
|
data/lib/caboose/version.rb
CHANGED