Class: OnlinePayments::SDK::Merchant::Complete::CompleteClient
- Inherits:
-
ApiResource
- Object
- ApiResource
- OnlinePayments::SDK::Merchant::Complete::CompleteClient
- Defined in:
- lib/onlinepayments/sdk/merchant/complete/complete_client.rb
Overview
Complete client. Thread-safe.
Instance Attribute Summary
Attributes inherited from ApiResource
#client_meta_info, #communicator
Instance Method Summary collapse
-
#complete_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::CompletePaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}/complete - Complete payment.
-
#initialize(parent, path_context) ⇒ CompleteClient
constructor
A new instance of CompleteClient.
Constructor Details
#initialize(parent, path_context) ⇒ CompleteClient
Returns a new instance of CompleteClient.
19 20 21 |
# File 'lib/onlinepayments/sdk/merchant/complete/complete_client.rb', line 19 def initialize(parent, path_context) super(parent: parent, path_context: path_context) end |
Instance Method Details
#complete_payment(payment_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::CompletePaymentResponse
Resource /v2/{merchantId}/payments/{paymentId}/complete - Complete payment
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/onlinepayments/sdk/merchant/complete/complete_client.rb', line 39 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 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 |