Class: SpreeAdyen::RefundPayloadPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/spree_adyen/refund_payload_presenter.rb

Constant Summary collapse

REFERENCE_SUFFIX =
'refund'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(amount_in_cents:, currency:, payment_method:, payment:, refund:) ⇒ RefundPayloadPresenter

Returns a new instance of RefundPayloadPresenter.



5
6
7
8
9
10
11
# File 'app/presenters/spree_adyen/refund_payload_presenter.rb', line 5

def initialize(amount_in_cents:, currency:, payment_method:, payment:, refund:)
  @amount_in_cents = amount_in_cents
  @currency = currency
  @payment_method = payment_method
  @payment = payment
  @refund = refund
end

Instance Method Details

#to_hObject



13
14
15
16
17
18
19
20
21
22
# File 'app/presenters/spree_adyen/refund_payload_presenter.rb', line 13

def to_h
  {
    amount: {
      value: amount_in_cents,
      currency: currency
    },
    reference: reference,
    merchantAccount: payment_method.
  }.merge!(SpreeAdyen::ApplicationInfoPresenter.new.to_h)
end