Class: PCPServerSDK::Endpoints::PayByLinkApiClient
- Inherits:
-
BaseApiClient
- Object
- BaseApiClient
- PCPServerSDK::Endpoints::PayByLinkApiClient
- Defined in:
- lib/PCP-server-Ruby-SDK/endpoints/pay_by_link_api_client.rb
Instance Attribute Summary
Attributes inherited from BaseApiClient
Instance Method Summary collapse
-
#create_pay_by_link_request(merchant_id, commerce_case_id, checkout_id, payload) ⇒ PCPServerSDK::Models::CreatePayByLinkResponse
Create a pay-by-link for a checkout.
Methods inherited from BaseApiClient
Constructor Details
This class inherits a constructor from PCPServerSDK::Endpoints::BaseApiClient
Instance Method Details
#create_pay_by_link_request(merchant_id, commerce_case_id, checkout_id, payload) ⇒ PCPServerSDK::Models::CreatePayByLinkResponse
Create a pay-by-link for a checkout.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/PCP-server-Ruby-SDK/endpoints/pay_by_link_api_client.rb', line 15 def create_pay_by_link_request(merchant_id, commerce_case_id, checkout_id, payload) raise TypeError, MERCHANT_ID_REQUIRED_ERROR if merchant_id.nil? || merchant_id.empty? raise TypeError, COMMERCE_CASE_ID_REQUIRED_ERROR if commerce_case_id.nil? || commerce_case_id.empty? raise TypeError, CHECKOUT_ID_REQUIRED_ERROR if checkout_id.nil? || checkout_id.empty? raise TypeError, PAYLOAD_REQUIRED_ERROR if payload.nil? url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/pay-by-link") 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::CreatePayByLinkResponse) end |