Class: Ingenico::Connect::SDK::Merchant::Payments::PaymentsClient
- Inherits:
-
ApiResource
- Object
- ApiResource
- Ingenico::Connect::SDK::Merchant::Payments::PaymentsClient
- Defined in:
- lib/ingenico/connect/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
-
#approve(payment_id, body, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/approve.
-
#cancel(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/cancel.
-
#cancelapproval(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/cancelapproval.
-
#capture(payment_id, body, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/capture.
-
#captures(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/captures.
-
#complete(payment_id, body, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/complete.
-
#create(body, context = nil) ⇒ Object
Resource /{merchantId}/payments.
-
#get(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}.
-
#initialize(parent, path_context) ⇒ PaymentsClient
constructor
- parent
- ApiResource path_context
-
Hash of String to String.
-
#processchallenged(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/processchallenged.
-
#refund(payment_id, body, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/refund.
-
#third_party_status(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/thirdpartystatus.
-
#tokenize(payment_id, body, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/tokenize.
Constructor Details
#initialize(parent, path_context) ⇒ PaymentsClient
- parent
- path_context
-
Hash of String to String
31 32 33 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 31 def initialize(parent, path_context) super(parent, path_context) end |
Instance Method Details
#approve(payment_id, body, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/approve
- payment_id
-
String
- body
- context
- Returns
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 120 def approve(payment_id, body, context=nil) path_context = { 'paymentId' => payment_id, } uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/approve', path_context) return @communicator.post( uri, client_headers, nil, body, Ingenico::Connect::SDK::Domain::Payment::PaymentApprovalResponse, context) rescue ResponseException => e error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#cancel(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/cancel
- payment_id
-
String
- context
- Returns
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 285 def cancel(payment_id, context=nil) path_context = { 'paymentId' => payment_id, } uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/cancel', path_context) return @communicator.post( uri, client_headers, nil, nil, Ingenico::Connect::SDK::Domain::Payment::CancelPaymentResponse, context) rescue ResponseException => e error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#cancelapproval(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/cancelapproval
- payment_id
-
String
- context
- Returns
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 318 def cancelapproval(payment_id, context=nil) path_context = { 'paymentId' => payment_id, } uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/cancelapproval', path_context) return @communicator.post( uri, client_headers, nil, nil, Ingenico::Connect::SDK::Domain::Payment::CancelApprovalPaymentResponse, context) rescue ResponseException => e error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#capture(payment_id, body, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/capture
- payment_id
-
String
- body
- context
- Returns
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 154 def capture(payment_id, body, context=nil) path_context = { 'paymentId' => payment_id, } uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/capture', path_context) return @communicator.post( uri, client_headers, nil, body, Ingenico::Connect::SDK::Domain::Capture::CaptureResponse, context) rescue ResponseException => e error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#captures(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/captures
- payment_id
-
String
- context
- Returns
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 187 def captures(payment_id, context=nil) path_context = { 'paymentId' => payment_id, } uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/captures', path_context) return @communicator.get( uri, client_headers, nil, Ingenico::Connect::SDK::Domain::Capture::CapturesResponse, context) rescue ResponseException => e error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#complete(payment_id, body, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/complete
- payment_id
-
String
- body
- context
- Returns
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 220 def complete(payment_id, body, context=nil) path_context = { 'paymentId' => payment_id, } uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/complete', path_context) return @communicator.post( uri, client_headers, nil, body, Ingenico::Connect::SDK::Domain::Payment::CompletePaymentResponse, context) rescue ResponseException => e error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#create(body, context = nil) ⇒ Object
Resource /{merchantId}/payments
- body
- context
- Returns
- Raises
-
DeclinedPaymentException if the Ingenico ePayments platform declined / rejected the payment. The payment result will be available from the exception.
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 51 def create(body, context=nil) uri = instantiate_uri('/{apiVersion}/{merchantId}/payments', nil) return @communicator.post( uri, client_headers, nil, body, Ingenico::Connect::SDK::Domain::Payment::CreatePaymentResponse, context) rescue ResponseException => e error_type = { 400 => Ingenico::Connect::SDK::Domain::Payment::PaymentErrorResponse, 402 => Ingenico::Connect::SDK::Domain::Payment::PaymentErrorResponse, 403 => Ingenico::Connect::SDK::Domain::Payment::PaymentErrorResponse, 502 => Ingenico::Connect::SDK::Domain::Payment::PaymentErrorResponse, 503 => Ingenico::Connect::SDK::Domain::Payment::PaymentErrorResponse, }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse) error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#get(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}
- payment_id
-
String
- context
- Returns
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 87 def get(payment_id, context=nil) path_context = { 'paymentId' => payment_id, } uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}', path_context) return @communicator.get( uri, client_headers, nil, Ingenico::Connect::SDK::Domain::Payment::PaymentResponse, context) rescue ResponseException => e error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#processchallenged(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/processchallenged
- payment_id
-
String
- context
- Returns
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 351 def processchallenged(payment_id, context=nil) path_context = { 'paymentId' => payment_id, } uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/processchallenged', path_context) return @communicator.post( uri, client_headers, nil, nil, Ingenico::Connect::SDK::Domain::Payment::PaymentResponse, context) rescue ResponseException => e error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#refund(payment_id, body, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/refund
- payment_id
-
String
- body
- context
- Returns
- Raises
-
DeclinedRefundException if the Ingenico ePayments platform declined / rejected the refund. The refund result will be available from the exception.
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 386 def refund(payment_id, body, context=nil) path_context = { 'paymentId' => payment_id, } uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/refund', path_context) return @communicator.post( uri, client_headers, nil, body, Ingenico::Connect::SDK::Domain::Refund::RefundResponse, context) rescue ResponseException => e error_type = { 400 => Ingenico::Connect::SDK::Domain::Refund::RefundErrorResponse, 404 => Ingenico::Connect::SDK::Domain::Refund::RefundErrorResponse, }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse) error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#third_party_status(payment_id, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/thirdpartystatus
- payment_id
-
String
- context
- Returns
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 253 def third_party_status(payment_id, context=nil) path_context = { 'paymentId' => payment_id, } uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/thirdpartystatus', path_context) return @communicator.get( uri, client_headers, nil, Ingenico::Connect::SDK::Domain::Payment::ThirdPartyStatusResponse, context) rescue ResponseException => e error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |
#tokenize(payment_id, body, context = nil) ⇒ Object
Resource /{merchantId}/payments/{paymentId}/tokenize
- payment_id
-
String
- body
- context
- Returns
- Raises
-
ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)
- Raises
-
AuthorizationException if the request was not allowed (HTTP status code 403)
- Raises
-
IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)
- Raises
-
ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,
or there was a conflict (HTTP status code 404, 409 or 410)
- Raises
-
GlobalCollectException if something went wrong at the Ingenico ePayments platform,
the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
- Raises
-
ApiException if the Ingenico ePayments platform returned any other error
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 423 def tokenize(payment_id, body, context=nil) path_context = { 'paymentId' => payment_id, } uri = instantiate_uri('/{apiVersion}/{merchantId}/payments/{paymentId}/tokenize', path_context) return @communicator.post( uri, client_headers, nil, body, Ingenico::Connect::SDK::Domain::Token::CreateTokenResponse, context) rescue ResponseException => e error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise create_exception(e.status_code, e.body, error_object, context) end |