Class: Kaui::Invoice

Inherits:
KillBillClient::Model::Invoice
  • Object
show all
Defined in:
app/models/kaui/invoice.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build_from_raw_invoice(raw_invoice) ⇒ Object


3
4
5
6
7
8
9
# File 'app/models/kaui/invoice.rb', line 3

def self.build_from_raw_invoice(raw_invoice)
  result = Kaui::Invoice.new
  KillBillClient::Model::InvoiceAttributes.instance_variable_get('@json_attributes').each do |attr|
    result.send("#{attr}=", raw_invoice.send(attr))
  end
  result
end

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


11
12
13
14
15
16
17
# File 'app/models/kaui/invoice.rb', line 11

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

Instance Method Details

#credit_adjustment_to_moneyObject


29
30
31
# File 'app/models/kaui/invoice.rb', line 29

def credit_adjustment_to_money
  Kaui::Base.to_money(credit_adj, currency)
end

#refund_adjustment_to_moneyObject


25
26
27
# File 'app/models/kaui/invoice.rb', line 25

def refund_adjustment_to_money
  Kaui::Base.to_money(refund_adj, currency)
end