Class: Adapters::PaymentHistoryAdapter

Inherits:
Object
  • Object
show all
Defined in:
app/models/adapters/payment_history_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ PaymentHistoryAdapter

Returns a new instance of PaymentHistoryAdapter.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/adapters/payment_history_adapter.rb', line 7

def initialize(input)
  @input_payment = input.dig(:payments, :payment)

  if @input_payment.nil? || !Flipper.enabled?(:payment_history)
    @payments = []
    @return_payments = []
  else
    @input_payments = [@input_payment].flatten
    payments, return_payments = @input_payments.partition do |payment|
      payment.dig(:return_payment, :check_trace_number).blank?
    end

    @payments = process_payments(payments)
    @return_payments = process_return_payments(return_payments)
  end
end

Instance Attribute Details

#paymentsObject

Returns the value of attribute payments.



5
6
7
# File 'app/models/adapters/payment_history_adapter.rb', line 5

def payments
  @payments
end

#return_paymentsObject

Returns the value of attribute return_payments.



5
6
7
# File 'app/models/adapters/payment_history_adapter.rb', line 5

def return_payments
  @return_payments
end