Class: KillBillClient::Model::Transaction
- Inherits:
-
PaymentTransactionAttributes
- Object
- Resource
- PaymentTransactionAttributes
- KillBillClient::Model::Transaction
- 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
- #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
- #void(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
Instance Method Details
#auth(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ 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, 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
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, 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
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, 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
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, 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
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, 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 |
#complete(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ Object
48 49 50 |
# File 'lib/killbill_client/models/transaction.rb', line 48 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
52 53 54 55 |
# File 'lib/killbill_client/models/transaction.rb', line 52 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
62 63 64 65 |
# File 'lib/killbill_client/models/transaction.rb', line 62 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
57 58 59 60 |
# File 'lib/killbill_client/models/transaction.rb', line 57 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
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, 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
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, 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
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, 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
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, 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
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, 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 |
#void(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil) ⇒ 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, 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() end end |