Class: Kaui::Payment

Inherits:
KillBillClient::Model::Payment
  • Object
show all
Includes:
PaymentState
Defined in:
app/models/kaui/payment.rb

Constant Summary collapse

TRANSACTION_STATUSES =
%w(SUCCESS PENDING PAYMENT_FAILURE PLUGIN_FAILURE UNKNOWN)

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from PaymentState

#amount_capturable, #amount_refundable, #capturable?, #chargebackable?, #is_fully_refunded?, #paid_amount_to_money, #refundable?, #returned_amount_to_money, #total_authed_amount_to_money, #voidable?

Instance Attribute Details

#payment_dateObject

Returns the value of attribute payment_date.



5
6
7
# File 'app/models/kaui/payment.rb', line 5

def payment_date
  @payment_date
end

#target_invoice_idObject

Returns the value of attribute target_invoice_id.



5
6
7
# File 'app/models/kaui/payment.rb', line 5

def target_invoice_id
  @target_invoice_id
end

Class Method Details

.build_from_raw_payment(raw_payment) ⇒ Object



9
10
11
12
13
14
15
# File 'app/models/kaui/payment.rb', line 9

def self.build_from_raw_payment(raw_payment)
  result = Kaui::Payment.new
  KillBillClient::Model::PaymentAttributes.instance_variable_get('@json_attributes').each do |attr|
    result.send("#{attr}=", raw_payment.send(attr))
  end
  result
end

.list_or_search(search_key = nil, offset = 0, limit = 10, options = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'app/models/kaui/payment.rb', line 17

def self.list_or_search(search_key = nil, offset = 0, limit = 10, options = {})
  if search_key.present?
    find_in_batches_by_search_key(search_key, offset, limit, options)
  else
    find_in_batches(offset, limit, options)
  end
end