Class: KillBillClient::Model::Transaction
Constant Summary
collapse
- KILLBILL_API_TRANSACTIONS_PREFIX =
"#{KILLBILL_API_PREFIX}/paymentTransactions"
Constants included
from TagHelper
KillBillClient::Model::TagHelper::AUTO_INVOICING_OFF_ID, KillBillClient::Model::TagHelper::AUTO_PAY_OFF_ID, KillBillClient::Model::TagHelper::MANUAL_PAY_ID, KillBillClient::Model::TagHelper::OVERDUE_ENFORCEMENT_OFF_ID, KillBillClient::Model::TagHelper::TEST_ID, KillBillClient::Model::TagHelper::WRITTEN_OFF_ID
Constants inherited
from Resource
Resource::KILLBILL_API_PAGINATION_PREFIX, Resource::KILLBILL_API_PREFIX
Instance Attribute Summary
Attributes inherited from Resource
#clazz, #etag, #response, #session_id, #uri
Instance Method Summary
collapse
-
#auth(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#auth_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#cancel_scheduled_payment(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#capture(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#chargeback(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#chargeback_by_external_key(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#chargeback_reversals(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#complete(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#complete_auth(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#complete_credit(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#complete_purchase(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#credit(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#credit_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#purchase(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#purchase_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#refund(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#refund_by_external_key(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
-
#update_transaction_state(status, control_plugin_name = nil, user, reason, comment, options) ⇒ Object
-
#void(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
Methods included from TagHelper
#add_tag, #add_tag_from_definition_id, #control_tag?, included, #remove_tag, #remove_tag_from_definition_id, #set_tags
included
included
Methods inherited from Resource
#==, #_to_hash, attribute, create_alias, delete, extract_session_id, from_json, from_response, get, has_many, has_one, #hash, head, #initialize, instantiate_record_from_json, post, put, #refresh, require_multi_tenant_options!, #to_hash, #to_json
Instance Method Details
#auth(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
20
21
22
23
24
|
# File 'lib/killbill_client/models/transaction.rb', line 20
def auth(account_id, payment_method_id = nil, user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
@transaction_type = 'AUTHORIZE'
query_map = {}
create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments", query_map, payment_method_id, user, reason, , options, refresh_options)
end
|
#auth_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
38
39
40
41
42
|
# File 'lib/killbill_client/models/transaction.rb', line 38
def auth_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
@transaction_type = 'AUTHORIZE'
query_map = {:externalKey => account_external_key}
create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/payments", query_map, payment_method_id, user, reason, , options, refresh_options)
end
|
#cancel_scheduled_payment(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
# File 'lib/killbill_client/models/transaction.rb', line 151
def cancel_scheduled_payment(user = nil, reason = nil, = nil, options = {})
uri = transaction_external_key ? "#{Payment::KILLBILL_API_PAYMENTS_PREFIX}/cancelScheduledPaymentTransaction" :
"#{Payment::KILLBILL_API_PAYMENTS_PREFIX}/#{transaction_id}/cancelScheduledPaymentTransaction"
query_map = {}
query_map[:transactionExternalKey] = transaction_external_key if transaction_external_key
self.class.delete uri,
{},
query_map,
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
|
#capture(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/killbill_client/models/transaction.rb', line 75
def capture(user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
follow_location = delete_follow_location(options)
refresh_payment_with_failure_handling(follow_location, refresh_options || options) do
self.class.post "#{follow_up_path(payment_id)}",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
end
|
#chargeback(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'lib/killbill_client/models/transaction.rb', line 136
def chargeback(user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
follow_location = delete_follow_location(options)
refresh_payment_with_failure_handling(follow_location, refresh_options || options) do
self.class.post "#{follow_up_path(payment_id)}/chargebacks",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
end
|
#chargeback_by_external_key(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
168
169
170
171
172
173
174
175
176
177
178
179
180
|
# File 'lib/killbill_client/models/transaction.rb', line 168
def chargeback_by_external_key(user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
follow_location = delete_follow_location(options)
refresh_payment_with_failure_handling(follow_location, refresh_options || options) do
self.class.post "#{follow_up_path(payment_id)}/chargebacks",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
end
|
#chargeback_reversals(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
182
183
184
185
186
187
188
189
190
191
192
193
194
|
# File 'lib/killbill_client/models/transaction.rb', line 182
def chargeback_reversals(user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
follow_location = delete_follow_location(options)
refresh_payment_with_failure_handling(follow_location, refresh_options || options) do
self.class.post "#{follow_up_path(payment_id)}/chargebackReversals",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
end
|
#complete(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
56
57
58
|
# File 'lib/killbill_client/models/transaction.rb', line 56
def complete(user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
complete_initial_transaction(user, reason, , options, refresh_options)
end
|
#complete_auth(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
60
61
62
63
|
# File 'lib/killbill_client/models/transaction.rb', line 60
def complete_auth(user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
@transaction_type = 'AUTHORIZE'
complete_initial_transaction(user, reason, , options, refresh_options)
end
|
#complete_credit(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
70
71
72
73
|
# File 'lib/killbill_client/models/transaction.rb', line 70
def complete_credit(user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
@transaction_type = 'CREDIT'
complete_initial_transaction(user, reason, , options, refresh_options)
end
|
#complete_purchase(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
65
66
67
68
|
# File 'lib/killbill_client/models/transaction.rb', line 65
def complete_purchase(user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
@transaction_type = 'PURCHASE'
complete_initial_transaction(user, reason, , options, refresh_options)
end
|
#credit(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
32
33
34
35
36
|
# File 'lib/killbill_client/models/transaction.rb', line 32
def credit(account_id, payment_method_id = nil, user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
@transaction_type = 'CREDIT'
query_map = {}
create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments", query_map, payment_method_id, user, reason, , options, refresh_options)
end
|
#credit_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
50
51
52
53
54
|
# File 'lib/killbill_client/models/transaction.rb', line 50
def credit_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
@transaction_type = 'CREDIT'
query_map = {:externalKey => account_external_key}
create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/payments", query_map, payment_method_id, user, reason, , options, refresh_options)
end
|
#purchase(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
26
27
28
29
30
|
# File 'lib/killbill_client/models/transaction.rb', line 26
def purchase(account_id, payment_method_id = nil, user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
@transaction_type = 'PURCHASE'
query_map = {}
create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments", query_map, payment_method_id, user, reason, , options, refresh_options)
end
|
#purchase_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
44
45
46
47
48
|
# File 'lib/killbill_client/models/transaction.rb', line 44
def purchase_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
@transaction_type = 'PURCHASE'
query_map = {:externalKey => account_external_key}
create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/payments", query_map, payment_method_id, user, reason, , options, refresh_options)
end
|
#refund(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/killbill_client/models/transaction.rb', line 89
def refund(user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
follow_location = delete_follow_location(options)
refresh_payment_with_failure_handling(follow_location, refresh_options || options) do
self.class.post "#{follow_up_path(payment_id)}/refunds",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
end
|
#refund_by_external_key(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/killbill_client/models/transaction.rb', line 103
def refund_by_external_key(user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
follow_location = delete_follow_location(options)
refresh_payment_with_failure_handling(follow_location, refresh_options || options) do
self.class.post "#{Payment::KILLBILL_API_PAYMENTS_PREFIX}/refunds",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
end
|
#update_transaction_state(status, control_plugin_name = nil, user, reason, comment, options) ⇒ Object
196
197
198
199
200
201
202
203
204
205
|
# File 'lib/killbill_client/models/transaction.rb', line 196
def update_transaction_state(status, control_plugin_name = nil, user, reason, , options)
self.class.post "KILLBILL_API_TRANSACTIONS_PREFIX/#{transaction_id}",
{:paymentId => payment_id, :status => status}.to_json,
{:controlPluginName => (control_plugin_name || [])},
{
:user => user,
:reason => reason,
:comment =>
}.merge(options)
end
|
#void(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/killbill_client/models/transaction.rb', line 117
def void(user = nil, reason = nil, = nil, options = {}, refresh_options = nil)
follow_location = delete_follow_location(options)
refresh_payment_with_failure_handling(follow_location, refresh_options || options) do
self.class.delete "#{follow_up_path(payment_id)}",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
if payment_external_key
KillBillClient::Model::Payment.find_by_external_key(payment_external_key, false, false, options)
else
KillBillClient::Model::Payment.find_by_id(payment_id, false, false, options)
end
end
end
|