Module: Klarna::Checkout::Operations::Refund

Included in:
Klarna::Checkout::Order
Defined in:
lib/klarna/checkout/operations/refund.rb

Instance Method Summary collapse

Instance Method Details

#refund_order(amount: nil, description: nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/klarna/checkout/operations/refund.rb', line 7

def refund_order(amount: nil, description: nil)
  response = execute_refund_request(amount, description)

  unless response.status == 201
    raise Klarna::Checkout::Errors::OrderRefundError.new(@status, 'refund_not_allowed')
  end

  @status = 'REFUNDED'
  response
end