Class: KillBillClient::Model::Transaction
- Inherits:
-
PaymentTransactionAttributes
- Object
- Resource
- PaymentTransactionAttributes
- KillBillClient::Model::Transaction
- Includes:
- AuditLogWithHistoryHelper
- Defined in:
- lib/killbill_client/models/transaction.rb
Constant Summary collapse
- KILLBILL_API_TRANSACTIONS_PREFIX =
"#{KILLBILL_API_PREFIX}/paymentTransactions"
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
- #void(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
Methods included from AuditLogWithHistoryHelper
Instance Method Details
#auth(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
16 17 18 19 20 |
# File 'lib/killbill_client/models/transaction.rb', line 16 def auth(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, = {}, = nil) @transaction_type = 'AUTHORIZE' query_map = {} create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments", query_map, payment_method_id, user, reason, comment, , ) end |
#auth_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
34 35 36 37 38 |
# File 'lib/killbill_client/models/transaction.rb', line 34 def auth_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, = {}, = 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, comment, , ) end |
#cancel_scheduled_payment(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/killbill_client/models/transaction.rb', line 143 def cancel_scheduled_payment(user = nil, reason = nil, comment = nil, = {}) 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 => comment, }.merge() end |
#capture(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/killbill_client/models/transaction.rb', line 71 def capture(user = nil, reason = nil, comment = nil, = {}, = nil) follow_location = delete_follow_location() refresh_payment_with_failure_handling(follow_location, || ) do self.class.post "#{follow_up_path(payment_id)}", to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end end |
#chargeback(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/killbill_client/models/transaction.rb', line 128 def chargeback(user = nil, reason = nil, comment = nil, = {}, = nil) follow_location = delete_follow_location() refresh_payment_with_failure_handling(follow_location, || ) do self.class.post "#{follow_up_path(payment_id)}/chargebacks", to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end end |
#chargeback_by_external_key(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/killbill_client/models/transaction.rb', line 160 def chargeback_by_external_key(user = nil, reason = nil, comment = nil, = {}, = nil) follow_location = delete_follow_location() refresh_payment_with_failure_handling(follow_location, || ) do self.class.post "#{follow_up_path(payment_id)}/chargebacks", to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end end |
#chargeback_reversals(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/killbill_client/models/transaction.rb', line 174 def chargeback_reversals(user = nil, reason = nil, comment = nil, = {}, = nil) follow_location = delete_follow_location() refresh_payment_with_failure_handling(follow_location, || ) do self.class.post "#{follow_up_path(payment_id)}/chargebackReversals", to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end end |
#complete(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
52 53 54 |
# File 'lib/killbill_client/models/transaction.rb', line 52 def complete(user = nil, reason = nil, comment = nil, = {}, = nil) complete_initial_transaction(user, reason, comment, , ) end |
#complete_auth(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
56 57 58 59 |
# File 'lib/killbill_client/models/transaction.rb', line 56 def complete_auth(user = nil, reason = nil, comment = nil, = {}, = nil) @transaction_type = 'AUTHORIZE' complete_initial_transaction(user, reason, comment, , ) end |
#complete_credit(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
66 67 68 69 |
# File 'lib/killbill_client/models/transaction.rb', line 66 def complete_credit(user = nil, reason = nil, comment = nil, = {}, = nil) @transaction_type = 'CREDIT' complete_initial_transaction(user, reason, comment, , ) end |
#complete_purchase(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
61 62 63 64 |
# File 'lib/killbill_client/models/transaction.rb', line 61 def complete_purchase(user = nil, reason = nil, comment = nil, = {}, = nil) @transaction_type = 'PURCHASE' complete_initial_transaction(user, reason, comment, , ) end |
#credit(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
28 29 30 31 32 |
# File 'lib/killbill_client/models/transaction.rb', line 28 def credit(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, = {}, = nil) @transaction_type = 'CREDIT' query_map = {} create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments", query_map, payment_method_id, user, reason, comment, , ) end |
#credit_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
46 47 48 49 50 |
# File 'lib/killbill_client/models/transaction.rb', line 46 def credit_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, = {}, = 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, comment, , ) end |
#purchase(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
22 23 24 25 26 |
# File 'lib/killbill_client/models/transaction.rb', line 22 def purchase(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, = {}, = nil) @transaction_type = 'PURCHASE' query_map = {} create_initial_transaction("#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments", query_map, payment_method_id, user, reason, comment, , ) end |
#purchase_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
40 41 42 43 44 |
# File 'lib/killbill_client/models/transaction.rb', line 40 def purchase_by_external_key(account_external_key, payment_method_id = nil, user = nil, reason = nil, comment = nil, = {}, = 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, comment, , ) end |
#refund(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/killbill_client/models/transaction.rb', line 85 def refund(user = nil, reason = nil, comment = nil, = {}, = nil) follow_location = delete_follow_location() refresh_payment_with_failure_handling(follow_location, || ) do self.class.post "#{follow_up_path(payment_id)}/refunds", to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end end |
#refund_by_external_key(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/killbill_client/models/transaction.rb', line 99 def refund_by_external_key(user = nil, reason = nil, comment = nil, = {}, = nil) follow_location = delete_follow_location() refresh_payment_with_failure_handling(follow_location, || ) do self.class.post "#{Payment::KILLBILL_API_PAYMENTS_PREFIX}/refunds", to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end end |
#void(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/killbill_client/models/transaction.rb', line 113 def void(user = nil, reason = nil, comment = nil, = {}, = nil) follow_location = delete_follow_location() refresh_payment_with_failure_handling(follow_location, || ) do self.class.delete "#{follow_up_path(payment_id)}", to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() KillBillClient::Model::Payment.find_by_id(payment_id, false, false, ) end end |