Sha256: a7d3c2e05c6393088cffb513da2804f37bcffda3cce0ad14c7d325ef19fe1525

Contents?: true

Size: 674 Bytes

Versions: 11

Compression:

Stored size: 674 Bytes

Contents

class Kaui::InvoicePayment < KillBillClient::Model::InvoicePayment

  SAMPLE_REASON_CODES = ['600 - Alt payment method',
                         '699 - OTHER']

  [:auth, :captured, :purchased, :refunded, :credited].each do |type|
    define_method "#{type}_amount_to_money" do
      Kaui::Base.to_money(send("#{type}_amount"), currency)
    end
  end

  def paid_amount_to_money
    captured_amount_to_money + purchased_amount_to_money
  end

  # TODO Better name?
  def returned_amount_to_money
    refunded_amount_to_money + credited_amount_to_money
  end

  def is_fully_refunded?
    refunded_amount == captured_amount || refunded_amount == purchased_amount
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kaui-0.11.0 app/models/kaui/invoice_payment.rb
kaui-0.10.0 app/models/kaui/invoice_payment.rb
kaui-0.9.0 app/models/kaui/invoice_payment.rb
kaui-0.8.4 app/models/kaui/invoice_payment.rb
kaui-0.8.3 app/models/kaui/invoice_payment.rb
kaui-0.8.2 app/models/kaui/invoice_payment.rb
kaui-0.8.1 app/models/kaui/invoice_payment.rb
kaui-0.8.0 app/models/kaui/invoice_payment.rb
kaui-0.7.2 app/models/kaui/invoice_payment.rb
kaui-0.7.1 app/models/kaui/invoice_payment.rb
kaui-0.7.0 app/models/kaui/invoice_payment.rb