Class: Kaui::Payment
- Inherits:
-
KillBillClient::Model::Payment
- Object
- KillBillClient::Model::Payment
- Kaui::Payment
- Includes:
- PaymentState
- Defined in:
- app/models/kaui/payment.rb
Constant Summary collapse
- TRANSACTION_STATUSES =
%w[SUCCESS PENDING PAYMENT_FAILURE PLUGIN_FAILURE UNKNOWN].freeze
- DEFAULT_VISIBLE_COLUMNS =
Columns shown by default on the Payments list screen (demo-friendly defaults); the rest remain available but hidden until the user opts in via "Edit Columns".
%w[payment_date payment_number status account_id currency purchased_amount refunded_amount credited_amount].freeze
- REMAPPING_FIELDS =
{ 'auth_amount' => 'auth', 'captured_amount' => 'capture', 'purchased_amount' => 'purchase', 'credited_amount' => 'credit', 'refunded_amount' => 'refund' }.freeze
- ADVANCED_SEARCH_COLUMNS =
%w[id account_id payment_method_id external_key].freeze
- ADVANCED_SEARCH_NAME_CHANGES =
[%w[ac_id account_id]].freeze
Constants included from PaymentState
Kaui::PaymentState::REFUNDABLE_TRANSACTION_TYPES
Instance Attribute Summary collapse
-
#payment_date ⇒ Object
Returns the value of attribute payment_date.
-
#target_invoice_id ⇒ Object
Returns the value of attribute target_invoice_id.
Class Method Summary collapse
- .build_from_raw_payment(raw_payment) ⇒ Object
- .list_or_search(search_key = nil, offset = 0, limit = 10, options = {}) ⇒ Object
Methods included from PaymentState
#amount_capturable, #amount_refundable, #capturable?, #chargebackable?, #fully_refunded?, #paid_amount_to_money, #refundable?, #returned_amount_to_money, #total_authed_amount_to_money, #voidable?
Instance Attribute Details
#payment_date ⇒ Object
Returns the value of attribute payment_date.
7 8 9 |
# File 'app/models/kaui/payment.rb', line 7 def payment_date @payment_date end |
#target_invoice_id ⇒ Object
Returns the value of attribute target_invoice_id.
7 8 9 |
# File 'app/models/kaui/payment.rb', line 7 def target_invoice_id @target_invoice_id end |
Class Method Details
.build_from_raw_payment(raw_payment) ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/models/kaui/payment.rb', line 23 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
31 32 33 34 35 36 37 |
# File 'app/models/kaui/payment.rb', line 31 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 |