Class: KillBillClient::Model::Transaction
Constant Summary
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
-
#capture(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#chargeback(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
7
8
9
10
11
|
# File 'lib/killbill_client/models/transaction.rb', line 7
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
25
26
27
28
29
|
# File 'lib/killbill_client/models/transaction.rb', line 25
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
|
#capture(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/killbill_client/models/transaction.rb', line 58
def capture(user = nil, reason = nil, = nil, options = {})
created_transaction = self.class.post "#{follow_up_path(payment_id)}",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
created_transaction.refresh(options, Payment)
end
|
#chargeback(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/killbill_client/models/transaction.rb', line 94
def chargeback(user = nil, reason = nil, = nil, options = {})
created_transaction = self.class.post "#{follow_up_path(payment_id)}/chargebacks",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
created_transaction.refresh(options, Payment)
end
|
#complete_auth(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
43
44
45
46
|
# File 'lib/killbill_client/models/transaction.rb', line 43
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
53
54
55
56
|
# File 'lib/killbill_client/models/transaction.rb', line 53
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
48
49
50
51
|
# File 'lib/killbill_client/models/transaction.rb', line 48
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
19
20
21
22
23
|
# File 'lib/killbill_client/models/transaction.rb', line 19
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
37
38
39
40
41
|
# File 'lib/killbill_client/models/transaction.rb', line 37
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
13
14
15
16
17
|
# File 'lib/killbill_client/models/transaction.rb', line 13
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
31
32
33
34
35
|
# File 'lib/killbill_client/models/transaction.rb', line 31
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
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/killbill_client/models/transaction.rb', line 70
def refund(user = nil, reason = nil, = nil, options = {})
created_transaction = self.class.post "#{follow_up_path(payment_id)}/refunds",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
created_transaction.refresh(options, Payment)
end
|
#void(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/killbill_client/models/transaction.rb', line 82
def void(user = nil, reason = nil, = nil, options = {})
created_transaction = self.class.delete "#{follow_up_path(payment_id)}",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
created_transaction.refresh(options, Payment)
end
|