Class: OnlinePayments::SDK::Merchant::PaymentLinks::PaymentLinksClient

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

Overview

PaymentLinks client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context = nil) ⇒ PaymentLinksClient

Returns a new instance of PaymentLinksClient.

Parameters:



19
20
21
# File 'lib/onlinepayments/sdk/merchant/paymentlinks/payment_links_client.rb', line 19

def initialize(parent, path_context = nil)
  super(parent, path_context)
end

Instance Method Details

Resource /v2/{merchantId}/paymentlinks/{paymentLinkId}/cancel

Parameters:

Raises:



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/onlinepayments/sdk/merchant/paymentlinks/payment_links_client.rb', line 95

def cancel_payment_link_by_id(payment_link_id, context = nil)
  path_context = {
    'paymentLinkId'.freeze => payment_link_id,
  }
  uri = instantiate_uri('/v2/{merchantId}/paymentlinks/{paymentLinkId}/cancel', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    nil,
    context
  )
rescue ResponseException => e
  error_type = OnlinePayments::SDK::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end

Resource /v2/{merchantId}/paymentlinks

Parameters:

Returns:

Raises:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/onlinepayments/sdk/merchant/paymentlinks/payment_links_client.rb', line 36

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

Resource /v2/{merchantId}/paymentlinks/{paymentLinkId}

Parameters:

Returns:

Raises:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/onlinepayments/sdk/merchant/paymentlinks/payment_links_client.rb', line 65

def get_payment_link_by_id(payment_link_id, context = nil)
  path_context = {
    'paymentLinkId'.freeze => payment_link_id,
  }
  uri = instantiate_uri('/v2/{merchantId}/paymentlinks/{paymentLinkId}', path_context)
  @communicator.get(
    uri,
    client_headers,
    nil,
    OnlinePayments::SDK::Domain::PaymentLinkResponse,
    context
  )
rescue ResponseException => e
  error_type = OnlinePayments::SDK::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end