Class: PCPServerSDK::Endpoints::PaymentExecutionApiClient
- Inherits:
-
BaseApiClient
- Object
- BaseApiClient
- PCPServerSDK::Endpoints::PaymentExecutionApiClient
- Defined in:
- lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb
Constant Summary collapse
- PAYMENT_EXECUTION_ID_REQUIRED_ERROR =
'Payment Execution ID is required'
Instance Attribute Summary
Attributes inherited from BaseApiClient
Instance Method Summary collapse
-
#cancel_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::CancelPaymentResponse
Cancel a payment.
-
#capture_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::CapturePaymentResponse
Capture a payment.
-
#complete_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::CompletePaymentResponse
Complete a payment.
-
#create_payment(merchant_id, commerce_case_id, checkout_id, payload) ⇒ PCPServerSDK::Models::CreatePaymentResponse
Create a payment.
-
#initialize(config, http_client = nil) ⇒ PaymentExecutionApiClient
constructor
A new instance of PaymentExecutionApiClient.
-
#pause_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::PausePaymentResponse
Pause a payment.
-
#refresh_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::PaymentExecution
Refresh a payment.
-
#refund_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::RefundPaymentResponse
Refund a payment.
Constructor Details
#initialize(config, http_client = nil) ⇒ PaymentExecutionApiClient
Returns a new instance of PaymentExecutionApiClient.
16 17 18 |
# File 'lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb', line 16 def initialize(config, http_client = nil) super(config, http_client) end |
Instance Method Details
#cancel_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::CancelPaymentResponse
Cancel a payment
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb', line 71 def cancel_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) validate_ids(merchant_id, commerce_case_id, checkout_id) raise TypeError, PAYMENT_EXECUTION_ID_REQUIRED_ERROR if payment_execution_id.nil? || payment_execution_id.empty? url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-executions/#{payment_execution_id}/cancel") request_init = { method: 'POST', headers: { 'Content-Type' => 'application/json' }, body: JSON.generate(payload) } response = make_api_call(url.to_s, request_init) deserialize_json(response, PCPServerSDK::Models::CancelPaymentResponse) end |
#capture_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::CapturePaymentResponse
Capture a payment
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb', line 48 def capture_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) validate_ids(merchant_id, commerce_case_id, checkout_id) raise TypeError, PAYMENT_EXECUTION_ID_REQUIRED_ERROR if payment_execution_id.nil? || payment_execution_id.empty? url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-executions/#{payment_execution_id}/capture") request_init = { method: 'POST', headers: { 'Content-Type' => 'application/json' }, body: JSON.generate(payload) } response = make_api_call(url.to_s, request_init) deserialize_json(response, PCPServerSDK::Models::CapturePaymentResponse) end |
#complete_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::CompletePaymentResponse
Complete a payment
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb', line 117 def complete_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) validate_ids(merchant_id, commerce_case_id, checkout_id) raise TypeError, PAYMENT_EXECUTION_ID_REQUIRED_ERROR if payment_execution_id.nil? || payment_execution_id.empty? url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-executions/#{payment_execution_id}/complete") request_init = { method: 'POST', headers: { 'Content-Type' => 'application/json' }, body: JSON.generate(payload) } response = make_api_call(url.to_s, request_init) deserialize_json(response, PCPServerSDK::Models::CompletePaymentResponse) end |
#create_payment(merchant_id, commerce_case_id, checkout_id, payload) ⇒ PCPServerSDK::Models::CreatePaymentResponse
Create a payment
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb', line 26 def create_payment(merchant_id, commerce_case_id, checkout_id, payload) validate_ids(merchant_id, commerce_case_id, checkout_id) url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-executions") request_init = { method: 'POST', headers: { 'Content-Type' => 'application/json' }, body: JSON.generate(payload) } response = make_api_call(url.to_s, request_init) deserialize_json(response, PCPServerSDK::Models::CreatePaymentResponse) end |
#pause_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::PausePaymentResponse
Pause a payment
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb', line 140 def pause_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) validate_ids(merchant_id, commerce_case_id, checkout_id) raise TypeError, PAYMENT_EXECUTION_ID_REQUIRED_ERROR if payment_execution_id.nil? || payment_execution_id.empty? url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-executions/#{payment_execution_id}/pause") request_init = { method: 'POST', headers: { 'Content-Type' => 'application/json' }, body: JSON.generate(payload) } response = make_api_call(url.to_s, request_init) deserialize_json(response, PCPServerSDK::Models::PausePaymentResponse) end |
#refresh_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::PaymentExecution
Refresh a payment
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb', line 163 def refresh_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) validate_ids(merchant_id, commerce_case_id, checkout_id) raise TypeError, PAYMENT_EXECUTION_ID_REQUIRED_ERROR if payment_execution_id.nil? || payment_execution_id.empty? url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-executions/#{payment_execution_id}/refresh") request_init = { method: 'POST', headers: { 'Content-Type' => 'application/json' }, body: JSON.generate(payload) } response = make_api_call(url.to_s, request_init) deserialize_json(response, PCPServerSDK::Models::PaymentExecution) end |
#refund_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) ⇒ PCPServerSDK::Models::RefundPaymentResponse
Refund a payment
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb', line 94 def refund_payment(merchant_id, commerce_case_id, checkout_id, payment_execution_id, payload) validate_ids(merchant_id, commerce_case_id, checkout_id) raise TypeError, PAYMENT_EXECUTION_ID_REQUIRED_ERROR if payment_execution_id.nil? || payment_execution_id.empty? url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/payment-executions/#{payment_execution_id}/refund") request_init = { method: 'POST', headers: { 'Content-Type' => 'application/json' }, body: JSON.generate(payload) } response = make_api_call(url.to_s, request_init) deserialize_json(response, PCPServerSDK::Models::RefundPaymentResponse) end |