Class: Kaui::Invoice
- Inherits:
-
KillBillClient::Model::Invoice
- Object
- KillBillClient::Model::Invoice
- Kaui::Invoice
- Defined in:
- app/models/kaui/invoice.rb
Constant Summary collapse
- TABLE_IGNORE_COLUMNS =
%w[amount balance credit_adj refund_adj items is_parent_invoice parent_invoice_id parent_account_id audit_logs bundle_keys].freeze
- ADVANCED_SEARCH_COLUMNS =
%w[id account_id invoice_date target_date currency status balance].freeze
- ADVANCED_SEARCH_NAME_CHANGES =
[%w[ac_id account_id]].freeze
Class Method Summary collapse
- .build_from_raw_invoice(raw_invoice) ⇒ Object
- .list_or_search(search_key = nil, offset = 0, limit = 10, options = {}) ⇒ Object
Instance Method Summary collapse
Class Method Details
.build_from_raw_invoice(raw_invoice) ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/models/kaui/invoice.rb', line 9 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
17 18 19 20 21 22 23 |
# File 'app/models/kaui/invoice.rb', line 17 def self.list_or_search(search_key = nil, offset = 0, limit = 10, = {}) if search_key.present? find_in_batches_by_search_key(search_key, offset, limit, ) else find_in_batches(offset, limit, ) end end |
Instance Method Details
#credit_adjustment_to_money ⇒ Object
35 36 37 |
# File 'app/models/kaui/invoice.rb', line 35 def credit_adjustment_to_money Kaui::Base.to_money(credit_adj, currency) end |
#refund_adjustment_to_money ⇒ Object
31 32 33 |
# File 'app/models/kaui/invoice.rb', line 31 def refund_adjustment_to_money Kaui::Base.to_money(refund_adj, currency) end |