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) ⇒ 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)
  super(parent: parent, path_context: path_context)
end

Instance Method Details

Resource /v2/{merchantId}/paymentlinks/{paymentLinkId}/cancel - Cancel PaymentLink by ID

Parameters:

Raises:



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 96

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 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

Resource /v2/{merchantId}/paymentlinks - Create payment link

Parameters:

Returns:

Raises:



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 37

def create_payment_link(body, context = nil)
  uri = instantiate_uri('/v2/{merchantId}/paymentlinks', nil)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    OnlinePayments::SDK::Domain::PaymentLinkResponse,
    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

Resource /v2/{merchantId}/paymentlinks/{paymentLinkId} - Get payment link by ID

Parameters:

Returns:

Raises:



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 66

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 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