Sha256: afd24878559c7b3007df96b9bdc2d37dcf31d7dab5d6c43413e4c3ff3a8764ac
Contents?: true
Size: 1014 Bytes
Versions: 4
Compression:
Stored size: 1014 Bytes
Contents
# frozen_string_literal: true module Kaui class Payment < KillBillClient::Model::Payment include Kaui::PaymentState attr_accessor :payment_date, :target_invoice_id TRANSACTION_STATUSES = %w[SUCCESS PENDING PAYMENT_FAILURE PLUGIN_FAILURE UNKNOWN].freeze 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 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 %i[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 end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
kaui-3.0.4 | app/models/kaui/payment.rb |
kaui-3.0.2 | app/models/kaui/payment.rb |
kaui-2.2.1 | app/models/kaui/payment.rb |
kaui-3.0.1 | app/models/kaui/payment.rb |