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 = nil, context = nil) ⇒ OnlinePayments::SDK::Domain::CancelPaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}/cancel.
-
#capture_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::CaptureResponse
Resource /v2/{merchantId}/payments/{paymentId}/capture.
-
#complete_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::CompletePaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}/complete.
-
#create_payment(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CreatePaymentResponse
Resource /v2/{merchantId}/payments.
-
#get_captures(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::CapturesResponse
Resource /v2/{merchantId}/payments/{paymentId}/captures.
-
#get_payment(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}.
-
#get_payment_details(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentDetailsResponse
Resource /v2/{merchantId}/payments/{paymentId}/details.
-
#get_refunds(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::RefundsResponse
Resource /v2/{merchantId}/payments/{paymentId}/refunds.
-
#initialize(parent, path_context = nil) ⇒ PaymentsClient
constructor
A new instance of PaymentsClient.
-
#refund_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::RefundResponse
Resource /v2/{merchantId}/payments/{paymentId}/refund.
-
#subsequent_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::SubsequentPaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}/subsequent.
Constructor Details
#initialize(parent, path_context = nil) ⇒ PaymentsClient
Returns a new instance of PaymentsClient.
35 36 37 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 35 def initialize(parent, path_context = nil) super(parent, path_context) end |
Instance Method Details
#cancel_payment(payment_id, body = nil, context = nil) ⇒ OnlinePayments::SDK::Domain::CancelPaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}/cancel
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 146 def cancel_payment(payment_id, body = nil, 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 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 |
#capture_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::CaptureResponse
Resource /v2/{merchantId}/payments/{paymentId}/capture
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 245 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 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 |
#complete_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::CompletePaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}/complete
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 113 def complete_payment(payment_id, body, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/v2/{merchantId}/payments/{paymentId}/complete', path_context) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::CompletePaymentResponse, context ) rescue ResponseException => e error_type = OnlinePayments::SDK::Domain::PaymentErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#create_payment(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CreatePaymentResponse
Resource /v2/{merchantId}/payments
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 52 def create_payment(body, context = nil) uri = instantiate_uri('/v2/{merchantId}/payments') @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::CreatePaymentResponse, context ) rescue ResponseException => e error_type = OnlinePayments::SDK::Domain::PaymentErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#get_captures(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::CapturesResponse
Resource /v2/{merchantId}/payments/{paymentId}/captures
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 277 def get_captures(payment_id, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/v2/{merchantId}/payments/{paymentId}/captures', path_context) @communicator.get( uri, client_headers, nil, OnlinePayments::SDK::Domain::CapturesResponse, 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 |
#get_payment(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 81 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 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 |
#get_payment_details(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentDetailsResponse
Resource /v2/{merchantId}/payments/{paymentId}/details
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 308 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 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 |
#get_refunds(payment_id, context = nil) ⇒ OnlinePayments::SDK::Domain::RefundsResponse
Resource /v2/{merchantId}/payments/{paymentId}/refunds
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 339 def get_refunds(payment_id, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/v2/{merchantId}/payments/{paymentId}/refunds', path_context) @communicator.get( uri, client_headers, nil, OnlinePayments::SDK::Domain::RefundsResponse, 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 |
#refund_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::RefundResponse
Resource /v2/{merchantId}/payments/{paymentId}/refund
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 212 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 ResponseException => e error_type = OnlinePayments::SDK::Domain::RefundErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise 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
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/onlinepayments/sdk/merchant/payments/payments_client.rb', line 179 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 ResponseException => e error_type = OnlinePayments::SDK::Domain::PaymentErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |