Class: OnlinePayments::SDK::Merchant::Payments::PaymentsClient
- Inherits:
-
ApiResource
- Object
- ApiResource
- OnlinePayments::SDK::Merchant::Payments::PaymentsClient
- Defined in:
- lib/onlinepayments/sdk/merchant/payments/payments_client.rb
Overview
Payments client. Thread-safe.
Instance Attribute Summary
Attributes inherited from ApiResource
#client_meta_info, #communicator
Instance Method Summary collapse
-
#cancel_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::CancelPaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}/cancel - Cancel payment.
-
#capture_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::CaptureResponse
Resource /v2/{merchantId}/payments/{paymentId}/capture - Capture payment.
-
#create_payment(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CreatePaymentResponse
Resource /v2/{merchantId}/payments - Create payment.
-
#get_payment(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentResponse
Resource /v2/{merchantId}/payments/{paymentId} - Get payment.
-
#get_payment_details(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentDetailsResponse
Resource /v2/{merchantId}/payments/{paymentId}/details - Get payment details.
-
#initialize(parent, path_context) ⇒ PaymentsClient
constructor
A new instance of PaymentsClient.
-
#refund_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::RefundResponse
Resource /v2/{merchantId}/payments/{paymentId}/refund - Refund payment.
-
#subsequent_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::SubsequentPaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}/subsequent - Subsequent payment.
Constructor Details
#initialize(parent, path_context) ⇒ PaymentsClient
Returns a new instance of PaymentsClient.
27 28 29 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 27 def initialize(parent, path_context) super(parent: parent, path_context: path_context) end |
Instance Method Details
#cancel_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::CancelPaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}/cancel - Cancel payment
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 138 def cancel_payment(payment_id, body, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/v2/{merchantId}/payments/{paymentId}/cancel', path_context) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::CancelPaymentResponse, 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 |
#capture_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::CaptureResponse
Resource /v2/{merchantId}/payments/{paymentId}/capture - Capture payment
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 171 def capture_payment(payment_id, body, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/v2/{merchantId}/payments/{paymentId}/capture', path_context) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::CaptureResponse, 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 |
#create_payment(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CreatePaymentResponse
Resource /v2/{merchantId}/payments - Create payment
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 46 def create_payment(body, context = nil) uri = instantiate_uri('/v2/{merchantId}/payments', nil) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::CreatePaymentResponse, 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 |
#get_payment(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentResponse
Resource /v2/{merchantId}/payments/{paymentId} - Get payment
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 75 def get_payment(payment_id, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/v2/{merchantId}/payments/{paymentId}', path_context) @communicator.get( uri, client_headers, nil, OnlinePayments::SDK::Domain::PaymentResponse, 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_payment_details(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentDetailsResponse
Resource /v2/{merchantId}/payments/{paymentId}/details - Get payment details
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 106 def get_payment_details(payment_id, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/v2/{merchantId}/payments/{paymentId}/details', path_context) @communicator.get( uri, client_headers, nil, OnlinePayments::SDK::Domain::PaymentDetailsResponse, 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 |
#refund_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::RefundResponse
Resource /v2/{merchantId}/payments/{paymentId}/refund - Refund payment
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 205 def refund_payment(payment_id, body, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/v2/{merchantId}/payments/{paymentId}/refund', path_context) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::RefundResponse, context) rescue OnlinePayments::SDK::Communication::ResponseException => e error_type = OnlinePayments::SDK::Domain::RefundErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context) end |
#subsequent_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::SubsequentPaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}/subsequent - Subsequent payment
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 239 def subsequent_payment(payment_id, body, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/v2/{merchantId}/payments/{paymentId}/subsequent', path_context) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::SubsequentPaymentResponse, 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 |