Class: Kaui::Transaction
- Inherits:
-
KillBillClient::Model::Transaction
- Object
- KillBillClient::Model::Transaction
- Kaui::Transaction
- Defined in:
- app/models/kaui/transaction.rb
Instance Attribute Summary collapse
-
#next_retry_date ⇒ Object
Returns the value of attribute next_retry_date.
Class Method Summary collapse
Instance Method Summary collapse
- #amount_to_money ⇒ Object
- #create(account_id = nil, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Instance Attribute Details
#next_retry_date ⇒ Object
Returns the value of attribute next_retry_date.
3 4 5 |
# File 'app/models/kaui/transaction.rb', line 3 def next_retry_date @next_retry_date end |
Class Method Details
.amount_to_money(transaction) ⇒ Object
37 38 39 |
# File 'app/models/kaui/transaction.rb', line 37 def self.amount_to_money(transaction) self.new(:amount => transaction.amount, :currency => transaction.currency).amount_to_money end |
.build_from_raw_transaction(raw_transaction) ⇒ Object
5 6 7 8 9 10 11 |
# File 'app/models/kaui/transaction.rb', line 5 def self.build_from_raw_transaction(raw_transaction) result = Kaui::Transaction.new KillBillClient::Model::PaymentTransactionAttributes.instance_variable_get('@json_attributes').each do |attr| result.send("#{attr}=", raw_transaction.send(attr)) end result end |
Instance Method Details
#amount_to_money ⇒ Object
33 34 35 |
# File 'app/models/kaui/transaction.rb', line 33 def amount_to_money Kaui::Base.to_money(amount, currency) end |
#create(account_id = nil, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/models/kaui/transaction.rb', line 13 def create(account_id = nil, payment_method_id = nil, user = nil, reason = nil, comment = nil, = {}) if transaction_type == 'AUTHORIZE' auth(account_id, payment_method_id, user, reason, comment, ) elsif transaction_type == 'CAPTURE' capture(user, reason, comment, ) elsif transaction_type == 'CHARGEBACK' chargeback(user, reason, comment, ) elsif transaction_type == 'CREDIT' credit(account_id, payment_method_id, user, reason, comment, ) elsif transaction_type == 'PURCHASE' purchase(account_id, payment_method_id, user, reason, comment, ) elsif transaction_type == 'REFUND' refund(user, reason, comment, ) elsif transaction_type == 'VOID' void(user, reason, comment, ) else raise ArgumentError.new("Unknown transaction type #{transaction_type}") end end |