Class: OnlinePayments::SDK::Merchant::Services::ServicesClient

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

Overview

Services client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ ServicesClient

Returns a new instance of ServicesClient.

Parameters:



22
23
24
# File 'lib/onlinepayments/sdk/merchant/services/services_client.rb', line 22

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

Instance Method Details

#get_dcc_rate_inquiry(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CurrencyConversionResponse

Resource /v2/{merchantId}/services/dccrate - Get currency conversion quote

Parameters:

Returns:

Raises:



96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/onlinepayments/sdk/merchant/services/services_client.rb', line 96

def get_dcc_rate_inquiry(body, context = nil)
  uri = instantiate_uri('/v2/{merchantId}/services/dccrate', nil)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    OnlinePayments::SDK::Domain::CurrencyConversionResponse,
    context)
rescue OnlinePayments::SDK::Communication::ResponseException => e
  error_type = OnlinePayments::SDK::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context)
end

#get_iin_details(body, context = nil) ⇒ OnlinePayments::SDK::Domain::GetIINDetailsResponse

Resource /v2/{merchantId}/services/getIINdetails - Get IIN details

Parameters:

Returns:

Raises:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/onlinepayments/sdk/merchant/services/services_client.rb', line 67

def get_iin_details(body, context = nil)
  uri = instantiate_uri('/v2/{merchantId}/services/getIINdetails', nil)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    OnlinePayments::SDK::Domain::GetIINDetailsResponse,
    context)
rescue OnlinePayments::SDK::Communication::ResponseException => e
  error_type = OnlinePayments::SDK::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context)
end

#surcharge_calculation(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CalculateSurchargeResponse

Resource /v2/{merchantId}/services/surchargecalculation - Surcharge Calculation

Parameters:

Returns:

Raises:



125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/onlinepayments/sdk/merchant/services/services_client.rb', line 125

def surcharge_calculation(body, context = nil)
  uri = instantiate_uri('/v2/{merchantId}/services/surchargecalculation', nil)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    OnlinePayments::SDK::Domain::CalculateSurchargeResponse,
    context)
rescue OnlinePayments::SDK::Communication::ResponseException => e
  error_type = OnlinePayments::SDK::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context)
end

#test_connection(context = nil) ⇒ OnlinePayments::SDK::Domain::TestConnection

Resource /v2/{merchantId}/services/testconnection - Test connection

Parameters:

Returns:

Raises:



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/onlinepayments/sdk/merchant/services/services_client.rb', line 39

def test_connection(context = nil)
  uri = instantiate_uri('/v2/{merchantId}/services/testconnection', nil)
  @communicator.get(
    uri,
    client_headers,
    nil,
    OnlinePayments::SDK::Domain::TestConnection,
    context)
rescue OnlinePayments::SDK::Communication::ResponseException => e
  error_type = OnlinePayments::SDK::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context)
end