Class: OnlinePayments::SDK::Merchant::PreAuthorization::PreAuthorizationClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/onlinepayments/sdk/merchant/preauthorization/pre_authorization_client.rb

Overview

PreAuthorization client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ PreAuthorizationClient

Returns a new instance of PreAuthorizationClient.

Parameters:



20
21
22
# File 'lib/onlinepayments/sdk/merchant/preauthorization/pre_authorization_client.rb', line 20

def initialize(parent, path_context)
  super(parent: parent, path_context: path_context)
end

Instance Method Details

#add_authorization_details(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::AddAuthorizationDetailsResponse

Resource /v2/{merchantId}/payments/{paymentId}/authorization-additional-data - Add market specific additional data to a payment prior to capture.

Parameters:

Returns:

Raises:



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/onlinepayments/sdk/merchant/preauthorization/pre_authorization_client.rb', line 76

def add_authorization_details(payment_id, body, context = nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v2/{merchantId}/payments/{paymentId}/authorization-additional-data', path_context)


  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    OnlinePayments::SDK::Domain::AddAuthorizationDetailsResponse,
    context)
rescue OnlinePayments::SDK::Communication::ResponseException => e
  error_type = OnlinePayments::SDK::Domain::PaymentErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context)
end

#increment_authorization(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::IncrementAuthorizationResponse

Resource /v2/{merchantId}/payments/{paymentId}/increment-authorization - Increment authorization

Parameters:

Returns:

Raises:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/onlinepayments/sdk/merchant/preauthorization/pre_authorization_client.rb', line 40

def increment_authorization(payment_id, body, context = nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v2/{merchantId}/payments/{paymentId}/increment-authorization', path_context)


  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    OnlinePayments::SDK::Domain::IncrementAuthorizationResponse,
    context)
rescue OnlinePayments::SDK::Communication::ResponseException => e
  error_type = OnlinePayments::SDK::Domain::PaymentErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context)
end