Class: KillBillClient::Model::Transaction
Constant Summary
collapse
- KILLBILL_API_TRANSACTIONS_PREFIX =
"#{KILLBILL_API_PREFIX}/paymentTransactions"
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 = {}) ⇒ Object
-
#auth_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#cancel_scheduled_payment(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#capture(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#chargeback(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#complete(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#complete_auth(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#complete_credit(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#complete_purchase(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#credit(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#credit_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#purchase(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#purchase_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#refund(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#void(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
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 = {}) ⇒ Object
12
13
14
15
16
|
# File 'lib/killbill_client/models/transaction.rb', line 12
def auth(account_id, payment_method_id = nil, user = nil, reason = nil, = nil, options = {})
@transaction_type = 'AUTHORIZE'
query_map = {}
create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments", query_map, payment_method_id, user, reason, , options)
end
|
#auth_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
30
31
32
33
34
|
# File 'lib/killbill_client/models/transaction.rb', line 30
def auth_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, = nil, options = {})
@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)
end
|
#cancel_scheduled_payment(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/killbill_client/models/transaction.rb', line 124
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 = {}) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/killbill_client/models/transaction.rb', line 67
def capture(user = nil, reason = nil, = nil, options = {})
created_transaction = with_payment_failure_handling do
self.class.post "#{follow_up_path(payment_id)}",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
created_transaction.refresh(options, Payment)
end
|
#chargeback(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/killbill_client/models/transaction.rb', line 109
def chargeback(user = nil, reason = nil, = nil, options = {})
created_transaction = with_payment_failure_handling do
self.class.post "#{follow_up_path(payment_id)}/chargebacks",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
created_transaction.refresh(options, Payment)
end
|
#complete(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
48
49
50
|
# File 'lib/killbill_client/models/transaction.rb', line 48
def complete(user = nil, reason = nil, = nil, options = {})
complete_initial_transaction(user, reason, , options)
end
|
#complete_auth(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
52
53
54
55
|
# File 'lib/killbill_client/models/transaction.rb', line 52
def complete_auth(user = nil, reason = nil, = nil, options = {})
@transaction_type = 'AUTHORIZE'
complete_initial_transaction(user, reason, , options)
end
|
#complete_credit(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
62
63
64
65
|
# File 'lib/killbill_client/models/transaction.rb', line 62
def complete_credit(user = nil, reason = nil, = nil, options = {})
@transaction_type = 'CREDIT'
complete_initial_transaction(user, reason, , options)
end
|
#complete_purchase(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
57
58
59
60
|
# File 'lib/killbill_client/models/transaction.rb', line 57
def complete_purchase(user = nil, reason = nil, = nil, options = {})
@transaction_type = 'PURCHASE'
complete_initial_transaction(user, reason, , options)
end
|
#credit(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
24
25
26
27
28
|
# File 'lib/killbill_client/models/transaction.rb', line 24
def credit(account_id, payment_method_id = nil, user = nil, reason = nil, = nil, options = {})
@transaction_type = 'CREDIT'
query_map = {}
create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments", query_map, payment_method_id, user, reason, , options)
end
|
#credit_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
42
43
44
45
46
|
# File 'lib/killbill_client/models/transaction.rb', line 42
def credit_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, = nil, options = {})
@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)
end
|
#purchase(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
18
19
20
21
22
|
# File 'lib/killbill_client/models/transaction.rb', line 18
def purchase(account_id, payment_method_id = nil, user = nil, reason = nil, = nil, options = {})
@transaction_type = 'PURCHASE'
query_map = {}
create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments", query_map, payment_method_id, user, reason, , options)
end
|
#purchase_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
36
37
38
39
40
|
# File 'lib/killbill_client/models/transaction.rb', line 36
def purchase_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, = nil, options = {})
@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)
end
|
#refund(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/killbill_client/models/transaction.rb', line 81
def refund(user = nil, reason = nil, = nil, options = {})
created_transaction = with_payment_failure_handling do
self.class.post "#{follow_up_path(payment_id)}/refunds",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
created_transaction.refresh(options, Payment)
end
|
#void(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/killbill_client/models/transaction.rb', line 95
def void(user = nil, reason = nil, = nil, options = {})
created_transaction = with_payment_failure_handling do
self.class.delete "#{follow_up_path(payment_id)}",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
created_transaction.refresh(options, Payment)
end
|