Class: PCPServerSDK::Endpoints::PaymentIntentApiClient
- Inherits:
-
BaseApiClient
- Object
- BaseApiClient
- PCPServerSDK::Endpoints::PaymentIntentApiClient
show all
- Defined in:
- lib/PCP-server-Ruby-SDK/endpoints/payment_intent_api_client.rb
Constant Summary
collapse
- PAYMENT_INTENT_ID_REQUIRED_ERROR =
'Payment Intent ID is required'
Instance Attribute Summary
#http_client
Instance Method Summary
collapse
#initialize
Instance Method Details
#create_payment_intent(merchant_id, payload) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/PCP-server-Ruby-SDK/endpoints/payment_intent_api_client.rb', line 18
def create_payment_intent(merchant_id, payload)
raise TypeError, MERCHANT_ID_REQUIRED_ERROR if merchant_id.nil? || merchant_id.empty?
raise TypeError, PAYLOAD_REQUIRED_ERROR if payload.nil?
response = make_api_call(URI.join(get_config.host, "/v1/#{merchant_id}/payment-intents").to_s,
method: 'POST', headers: { 'Content-Type' => 'application/json' }, body: JSON.generate(payload))
deserialize_json(response, PCPServerSDK::Models::CreatePaymentIntentResponse)
end
|
#get_payment_intent(merchant_id, payment_intent_id) ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/PCP-server-Ruby-SDK/endpoints/payment_intent_api_client.rb', line 27
def get_payment_intent(merchant_id, payment_intent_id)
raise TypeError, MERCHANT_ID_REQUIRED_ERROR if merchant_id.nil? || merchant_id.empty?
raise TypeError, PAYMENT_INTENT_ID_REQUIRED_ERROR if payment_intent_id.nil? || payment_intent_id.empty?
response = make_api_call(URI.join(get_config.host, "/v1/#{merchant_id}/payment-intents/#{payment_intent_id}").to_s,
method: 'GET', headers: {})
deserialize_json(response, PCPServerSDK::Models::PaymentIntentResponse)
end
|