class Workarea::Klarna::Gateway::PlaceOrderRequest

Public Class Methods

new(tender, amount, auto_capture: false) click to toggle source
Calls superclass method
# File lib/workarea/klarna/gateway/place_order_request.rb, line 5
def initialize(tender, amount, auto_capture: false)
  super(Workarea::Order.find(tender.payment.id))

  @tender = tender
  @payment = tender.payment
  @amount = amount
  @auto_capture = auto_capture

  @path = "/payments/v1/authorizations/#{authorization_token}/order"
  @method = 'post'
  @summary = I18n.t(
    'workarea.klarna.gateway.request.place_order',
    amount: @amount.format
  )
end

Public Instance Methods

authorization_token() click to toggle source
# File lib/workarea/klarna/gateway/place_order_request.rb, line 28
def authorization_token
  payment.klarna.authorization_token
end
body() click to toggle source
# File lib/workarea/klarna/gateway/place_order_request.rb, line 21
def body
  Gateway::Order
    .new(order, payment: payment)
    .to_h
    .merge(auto_capture: @auto_capture)
end