caboose-cms 0.5.161 → 0.5.162
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
|
+
YzQ0ZGYxZDUzOWE3ODliMGRmYWM4ZGMwN2E1ZjY2ZjlhMDI5MDMzMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDhlNmIwZWE3Njc4NDk1MDgwYjlkNjhlZTU5YzJjN2EwYWUxZDA4Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDMyY2RjNWNjOWQ4MTFhYzc2YzFhM2EyMjEwZjhhOTFhZjI3YTAwOGQzYzFm
|
10
|
+
M2E1OWY2NzQzZTIxN2U4YjAzNmFlYTY1ODViYTA5ZGU2ZTQ1MWQ1ODgxMmYz
|
11
|
+
Zjg0ODhlZGY5ZWY2YzNmOGU4ZmNjMDU3YzRiNjBhNGM5YjRhMzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzhlYjYxYjQ5NjRkYWVkODJmYzljMWMyMGZkOWExNmQ4NmQ0ZGVmNWJmZGI2
|
14
|
+
ODczYTNjNjliZjM4OWFiYTQ4YmQ5MjRhMTg5ZWU4MDA2MDQxMjU0Y2NhMThl
|
15
|
+
N2IzNjVmM2FhOTU4ODdiODcxNzUyNzY3YjM5YWQ5MmZhMjdiMTc=
|
@@ -62,59 +62,61 @@ module Caboose
|
|
62
62
|
def capture_funds
|
63
63
|
return if !user_is_allowed('orders', 'edit')
|
64
64
|
|
65
|
-
resp = Caboose::StdClass.new
|
65
|
+
#resp = Caboose::StdClass.new
|
66
66
|
order = Order.find(params[:id])
|
67
|
-
|
68
|
-
|
69
|
-
if order.financial_status == Order::FINANCIAL_STATUS_CAPTURED
|
70
|
-
resp.error = "Funds for this order have already been captured."
|
71
|
-
elsif order.total > t.amount
|
72
|
-
resp.error = "The order total exceeds the authorized amount."
|
73
|
-
elsif t.nil?
|
74
|
-
resp.error = "This order doesn't seem to be authorized."
|
75
|
-
else
|
76
|
-
|
77
|
-
sc = @site.store_config
|
78
|
-
case sc.pp_name
|
79
|
-
when 'authorize.net'
|
80
|
-
transaction = AuthorizeNet::AIM::Transaction.new(sc.pp_username, sc.pp_password)
|
81
|
-
response = transaction.prior_auth_capture(t.transaction_id, order.total)
|
82
|
-
|
83
|
-
order.update_attribute(:financial_status, Order::FINANCIAL_STATUS_CAPTURED)
|
84
|
-
resp.success = 'Captured funds successfully'
|
85
|
-
|
86
|
-
ot = Caboose::OrderTransaction.new(
|
87
|
-
:order_id => order.id,
|
88
|
-
:date_processed => DateTime.now.utc,
|
89
|
-
:transaction_type => Caboose::OrderTransaction::TYPE_CAPTURE
|
90
|
-
)
|
91
|
-
ot.success = response.response_code && response.response_code == '1'
|
92
|
-
ot.transaction_id = response.transaction_id
|
93
|
-
ot.auth_code = response.authorization_code
|
94
|
-
ot.response_code = response.response_code
|
95
|
-
ot.amount = order.total
|
96
|
-
ot.save
|
67
|
+
resp = order.capture_funds
|
97
68
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
69
|
+
#t = OrderTransaction.where(:order_id => order.id, :transaction_type => OrderTransaction::TYPE_AUTHORIZE, :success => true).first
|
70
|
+
#
|
71
|
+
#if order.financial_status == Order::FINANCIAL_STATUS_CAPTURED
|
72
|
+
# resp.error = "Funds for this order have already been captured."
|
73
|
+
#elsif order.total > t.amount
|
74
|
+
# resp.error = "The order total exceeds the authorized amount."
|
75
|
+
#elsif t.nil?
|
76
|
+
# resp.error = "This order doesn't seem to be authorized."
|
77
|
+
#else
|
78
|
+
#
|
79
|
+
# sc = @site.store_config
|
80
|
+
# case sc.pp_name
|
81
|
+
# when 'authorize.net'
|
82
|
+
# transaction = AuthorizeNet::AIM::Transaction.new(sc.pp_username, sc.pp_password)
|
83
|
+
# response = transaction.prior_auth_capture(t.transaction_id, order.total)
|
84
|
+
#
|
85
|
+
# order.update_attribute(:financial_status, Order::FINANCIAL_STATUS_CAPTURED)
|
86
|
+
# resp.success = 'Captured funds successfully'
|
87
|
+
#
|
88
|
+
# ot = Caboose::OrderTransaction.new(
|
89
|
+
# :order_id => order.id,
|
90
|
+
# :date_processed => DateTime.now.utc,
|
91
|
+
# :transaction_type => Caboose::OrderTransaction::TYPE_CAPTURE
|
92
|
+
# )
|
93
|
+
# ot.success = response.response_code && response.response_code == '1'
|
94
|
+
# ot.transaction_id = response.transaction_id
|
95
|
+
# ot.auth_code = response.authorization_code
|
96
|
+
# ot.response_code = response.response_code
|
97
|
+
# ot.amount = order.total
|
98
|
+
# ot.save
|
99
|
+
#
|
100
|
+
# when 'payscape'
|
101
|
+
# # TODO: Implement capture funds for payscape
|
102
|
+
#
|
103
|
+
# end
|
104
|
+
#
|
105
|
+
# #if (order.discounts.any? && order.total < order.discounts.first.amount_current) || PaymentProcessor.capture(order)
|
106
|
+
# # order.financial_status = 'captured'
|
107
|
+
# # order.save
|
108
|
+
# #
|
109
|
+
# # if order.discounts.any?
|
110
|
+
# # order.update_attribute(:amount_discounted, order.discounts.first.amount_current)
|
111
|
+
# # order.update_gift_cards
|
112
|
+
# # end
|
113
|
+
# #
|
114
|
+
# # response.success = "Captured funds successfully"
|
115
|
+
# #else
|
116
|
+
# # response.error = "Error capturing funds."
|
117
|
+
# #end
|
118
|
+
#
|
119
|
+
#end
|
118
120
|
|
119
121
|
render :json => resp
|
120
122
|
end
|
@@ -9,11 +9,11 @@
|
|
9
9
|
|
10
10
|
<p>
|
11
11
|
<input type='button' value='< Back' onclick="window.location='/admin/orders';" />
|
12
|
-
<% if @order.financial_status == Caboose::Order::FINANCIAL_STATUS_AUTHORIZED %>
|
12
|
+
<% if @order.financial_status == Caboose::Order::FINANCIAL_STATUS_AUTHORIZED && @order.total > 0.00 %>
|
13
13
|
<input type='button' value='Capture Funds' onclick="controller.capture_funds();" />
|
14
14
|
<input type='button' value='Void' onclick="controller.void_order();" />
|
15
15
|
<% end %>
|
16
|
-
<% if @order.financial_status == Caboose::Order::FINANCIAL_STATUS_CAPTURED %>
|
16
|
+
<% if @order.financial_status == Caboose::Order::FINANCIAL_STATUS_CAPTURED && @order.total > 0.00 %>
|
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 %>)" />
|
data/lib/caboose/version.rb
CHANGED