Class: SpreeAdyen::CapturePayloadPresenter

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

Constant Summary collapse

REFERENCE_SUFFIX =
'capture'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(amount_in_cents:, payment:, payment_method:) ⇒ CapturePayloadPresenter

Returns a new instance of CapturePayloadPresenter.



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

def initialize(amount_in_cents:, payment:, payment_method:)
  @amount_in_cents = amount_in_cents
  @payment = payment
  @order = payment.order
  @payment_method = payment_method
end

Instance Method Details

#to_hObject



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

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