Class: Workarea::Klarna::Gateway::CaptureRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/workarea/klarna/gateway/capture_request.rb

Instance Attribute Summary

Attributes inherited from Request

#method, #order, #path, #summary

Instance Method Summary collapse

Methods inherited from Request

#continent, #continent_key, #password, #sesssion, #subdomain, #url, #username, #validate!

Constructor Details

#initialize(tender, amount) ⇒ CaptureRequest

Returns a new instance of CaptureRequest.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/workarea/klarna/gateway/capture_request.rb', line 5

def initialize(tender, amount)
  @tender = tender
  @payment = tender.payment
  @amount = amount

  @path = "/ordermanagement/v1/orders/#{tender.order_id}/captures"
  @method = 'post'
  @summary = I18n.t(
    'workarea.klarna.gateway.request.capture',
    amount: @amount.format
  )
end

Instance Method Details

#bodyObject



18
19
20
# File 'lib/workarea/klarna/gateway/capture_request.rb', line 18

def body
  { captured_amount: @amount.cents }
end