caboose-cms 0.5.161 → 0.5.162

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
- YTQ1MTU0YjcyN2E4MjYwOGUwYzgzZDNmMTc5NmMxYWViYzNlZmIyZg==
4
+ YzQ0ZGYxZDUzOWE3ODliMGRmYWM4ZGMwN2E1ZjY2ZjlhMDI5MDMzMg==
5
5
  data.tar.gz: !binary |-
6
- OTk0Y2NjZmE1M2NkYzgyNTYwM2Y2NzNjMjE0MWE2Y2M0MDkwZWUwNQ==
6
+ MDhlNmIwZWE3Njc4NDk1MDgwYjlkNjhlZTU5YzJjN2EwYWUxZDA4Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWJlMGU1OGY4YTE3ODcxZWY5MmRiOWVkMTJlNzdhMTI5OTJkZmNmNTEyZjU3
10
- MGJkZjUzZjRlMWE2MjdkYTQ5NTU0OWNmMjk3ZTdhNGQzZTNlNTI0YmMwMmM0
11
- ZDZmYWY1NzI5MGY1ZDAxMzU0YWMwMDE3ZGRhMWE5ZWM2MjI0YzM=
9
+ ZDMyY2RjNWNjOWQ4MTFhYzc2YzFhM2EyMjEwZjhhOTFhZjI3YTAwOGQzYzFm
10
+ M2E1OWY2NzQzZTIxN2U4YjAzNmFlYTY1ODViYTA5ZGU2ZTQ1MWQ1ODgxMmYz
11
+ Zjg0ODhlZGY5ZWY2YzNmOGU4ZmNjMDU3YzRiNjBhNGM5YjRhMzI=
12
12
  data.tar.gz: !binary |-
13
- ZjYzYWQ1MmZlMjU4NGEzNDExMTc4ZDJiNGYyZGY4MzA5NzE3OTk0YzYzNGZi
14
- NzJjODAxNWUzYWNlYzkwZGIwNTk2YzA4ZDI5NTdkMWM2MmFkYTkyNmY0Y2Iy
15
- ZmMyNjQ2NTMxY2M1ZmZlYTkyMGIzZWYxNmI3NTQzYjg2MzNiMDI=
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
- t = OrderTransaction.where(:order_id => order.id, :transaction_type => OrderTransaction::TYPE_AUTHORIZE, :success => true).first
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
- when 'payscape'
99
- # TODO: Implement capture funds for payscape
100
-
101
- end
102
-
103
- #if (order.discounts.any? && order.total < order.discounts.first.amount_current) || PaymentProcessor.capture(order)
104
- # order.financial_status = 'captured'
105
- # order.save
106
- #
107
- # if order.discounts.any?
108
- # order.update_attribute(:amount_discounted, order.discounts.first.amount_current)
109
- # order.update_gift_cards
110
- # end
111
- #
112
- # response.success = "Captured funds successfully"
113
- #else
114
- # response.error = "Error capturing funds."
115
- #end
116
-
117
- end
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 %>)" />
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.161'
2
+ VERSION = '0.5.162'
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.161
4
+ version: 0.5.162
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry