Class: Worldline::Acquiring::SDK::V1::Acquirer::Merchant::Payments::PaymentsClient
- Inherits:
-
ApiResource
- Object
- ApiResource
- Worldline::Acquiring::SDK::V1::Acquirer::Merchant::Payments::PaymentsClient
- Defined in:
- lib/worldline/acquiring/sdk/v1/acquirer/merchant/payments/payments_client.rb
Overview
Payments client. Thread-safe.
Instance Attribute Summary
Attributes inherited from ApiResource
Instance Method Summary collapse
-
#create_refund(payment_id, body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiActionResponseForRefund
Resource /processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/refunds - Refund payment.
-
#get_payment_status(payment_id, query, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiPaymentResource
Resource /processing/v1/{acquirerId}/{merchantId}/payments/{paymentId} - Retrieve payment.
-
#increment_payment(payment_id, body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiIncrementResponse
Resource /processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/increments - Increment authorization.
-
#initialize(parent, path_context) ⇒ PaymentsClient
constructor
A new instance of PaymentsClient.
-
#process_payment(body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiPaymentResponse
Resource /processing/v1/{acquirerId}/{merchantId}/payments - Create payment.
-
#reverse_authorization(payment_id, body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiReversalResponse
Resource /processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/authorization-reversals - Reverse authorization.
-
#simple_capture_of_payment(payment_id, body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiActionResponse
Resource /processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/captures - Capture payment.
Constructor Details
#initialize(parent, path_context) ⇒ PaymentsClient
Returns a new instance of PaymentsClient.
27 28 29 |
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/payments/payments_client.rb', line 27 def initialize(parent, path_context) super(parent: parent, path_context: path_context) end |
Instance Method Details
#create_refund(payment_id, body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiActionResponseForRefund
Resource /processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/refunds - Refund payment
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/payments/payments_client.rb', line 200 def create_refund(payment_id, body, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/refunds', path_context) @communicator.post( uri, nil, nil, body, Worldline::Acquiring::SDK::V1::Domain::ApiActionResponseForRefund, context) rescue Worldline::Acquiring::SDK::Communication::ResponseException => e error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context) end |
#get_payment_status(payment_id, query, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiPaymentResource
Resource /processing/v1/{acquirerId}/{merchantId}/payments/{paymentId} - Retrieve payment
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/payments/payments_client.rb', line 73 def get_payment_status(payment_id, query, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}', path_context) @communicator.get( uri, nil, query, Worldline::Acquiring::SDK::V1::Domain::ApiPaymentResource, context) rescue Worldline::Acquiring::SDK::Communication::ResponseException => e error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context) end |
#increment_payment(payment_id, body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiIncrementResponse
Resource /processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/increments - Increment authorization
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/payments/payments_client.rb', line 168 def increment_payment(payment_id, body, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/increments', path_context) @communicator.post( uri, nil, nil, body, Worldline::Acquiring::SDK::V1::Domain::ApiIncrementResponse, context) rescue Worldline::Acquiring::SDK::Communication::ResponseException => e error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context) end |
#process_payment(body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiPaymentResponse
Resource /processing/v1/{acquirerId}/{merchantId}/payments - Create payment
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/payments/payments_client.rb', line 44 def process_payment(body, context = nil) uri = instantiate_uri('/processing/v1/{acquirerId}/{merchantId}/payments', nil) @communicator.post( uri, nil, nil, body, Worldline::Acquiring::SDK::V1::Domain::ApiPaymentResponse, context) rescue Worldline::Acquiring::SDK::Communication::ResponseException => e error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context) end |
#reverse_authorization(payment_id, body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiReversalResponse
Resource /processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/authorization-reversals - Reverse authorization
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/payments/payments_client.rb', line 136 def (payment_id, body, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/authorization-reversals', path_context) @communicator.post( uri, nil, nil, body, Worldline::Acquiring::SDK::V1::Domain::ApiReversalResponse, context) rescue Worldline::Acquiring::SDK::Communication::ResponseException => e error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context) end |
#simple_capture_of_payment(payment_id, body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiActionResponse
Resource /processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/captures - Capture payment
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/payments/payments_client.rb', line 104 def simple_capture_of_payment(payment_id, body, context = nil) path_context = { 'paymentId'.freeze => payment_id, } uri = instantiate_uri('/processing/v1/{acquirerId}/{merchantId}/payments/{paymentId}/captures', path_context) @communicator.post( uri, nil, nil, body, Worldline::Acquiring::SDK::V1::Domain::ApiActionResponse, context) rescue Worldline::Acquiring::SDK::Communication::ResponseException => e error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context) end |