Class: Klarna::Payment

Inherits:
Client
  • Object
show all
Defined in:
lib/klarna/payment.rb

Instance Method Summary collapse

Methods inherited from Client

#initialize

Constructor Details

This class inherits a constructor from Klarna::Client

Instance Method Details

#create_session(data) ⇒ Object



5
6
7
8
9
# File 'lib/klarna/payment.rb', line 5

def create_session(data)
  do_request(:post, '/payments/v1/sessions') do |request|
    request.body = data.to_json
  end
end

#customer_token(authorization_token, data) ⇒ Object



23
24
25
26
27
# File 'lib/klarna/payment.rb', line 23

def customer_token(authorization_token, data)
  do_request(:post, "/payments/v1/authorizations/#{authorization_token}/customer-token") do |request|
    request.body = data.to_json
  end
end

#place_order(authorization_token, data) ⇒ Object



17
18
19
20
21
# File 'lib/klarna/payment.rb', line 17

def place_order(authorization_token, data)
  do_request(:post, "/payments/v1/authorizations/#{authorization_token}/order") do |request|
    request.body = data.to_json
  end
end

#update_session(session_id, data) ⇒ Object



11
12
13
14
15
# File 'lib/klarna/payment.rb', line 11

def update_session(session_id, data)
  do_request(:post, "/payments/v1/sessions/#{session_id}") do |request|
    request.body = data.to_json
  end
end