Class: CheckoutSdk::Payments::PaymentsClient

Inherits:
BasePaymentsClient show all
Defined in:
lib/checkout_sdk/payments/payments_client.rb

Constant Summary

Constants inherited from BasePaymentsClient

BasePaymentsClient::PAYMENTS_PATH

Instance Attribute Summary

Attributes inherited from Client

#api_client, #authorization_type, #configuration

Instance Method Summary collapse

Methods inherited from BasePaymentsClient

#get_payment_actions, #get_payment_details, #get_payments_list, #refund_payment, #reverse_payment, #void_payment

Constructor Details

#initialize(api_client, configuration) ⇒ PaymentsClient

Returns a new instance of PaymentsClient.

Parameters:



8
9
10
# File 'lib/checkout_sdk/payments/payments_client.rb', line 8

def initialize(api_client, configuration)
  super api_client, configuration, CheckoutSdk::AuthorizationType::SECRET_KEY_OR_OAUTH
end

Instance Method Details

#capture_payment(payment_id, capture_request = nil, idempotency_key = nil) ⇒ Object

Parameters:

  • payment_id (String)
  • capture_request (Hash, CaptureRequest) (defaults to: nil)
  • idempotency_key (String, nil) (defaults to: nil)


33
34
35
36
37
38
# File 'lib/checkout_sdk/payments/payments_client.rb', line 33

def capture_payment(payment_id, capture_request = nil, idempotency_key = nil)
  api_client.invoke_post(build_path(PAYMENTS_PATH, payment_id, 'captures'),
                         sdk_authorization,
                         capture_request,
                         idempotency_key)
end

#increment_payment_authorization(payment_id, authorization_request = nil, idempotency_key = nil) ⇒ Object

Parameters:

  • payment_id (String)
  • authorization_request (Hash, AuthorizationRequest) (defaults to: nil)
  • idempotency_key (String, nil) (defaults to: nil)


43
44
45
46
47
48
# File 'lib/checkout_sdk/payments/payments_client.rb', line 43

def increment_payment_authorization(payment_id, authorization_request = nil, idempotency_key = nil)
  api_client.invoke_post(build_path(PAYMENTS_PATH, payment_id, 'authorizations'),
                         sdk_authorization,
                         authorization_request,
                         idempotency_key)
end

#request_payment(payment_request, idempotency_key = nil) ⇒ Object

Parameters:

  • payment_request (Hash, PaymentRequest)
  • idempotency_key (String, nil) (defaults to: nil)


14
15
16
17
18
19
# File 'lib/checkout_sdk/payments/payments_client.rb', line 14

def request_payment(payment_request, idempotency_key = nil)
  api_client.invoke_post(PAYMENTS_PATH,
                         sdk_authorization,
                         payment_request,
                         idempotency_key)
end

#request_payout(payout_request, idempotency_key = nil) ⇒ Object

Parameters:

  • payout_request (Hash, PayoutRequest)
  • idempotency_key (String, nil) (defaults to: nil)


23
24
25
26
27
28
# File 'lib/checkout_sdk/payments/payments_client.rb', line 23

def request_payout(payout_request, idempotency_key = nil)
  api_client.invoke_post(PAYMENTS_PATH,
                         sdk_authorization,
                         payout_request,
                         idempotency_key)
end