Class: DuffelAPI::Services::PaymentIntentsService
- Inherits:
-
BaseService
- Object
- BaseService
- DuffelAPI::Services::PaymentIntentsService
- Defined in:
- lib/duffel_api/services/payment_intents_service.rb
Constant Summary
Constants inherited from BaseService
BaseService::DEFAULT_ALL_PARAMS
Instance Method Summary collapse
-
#confirm(id, options = {}) ⇒ Resources::PaymentIntent
Confirms a payment intent by ID.
-
#create(options = {}) ⇒ Resources::PaymentIntent
Creates an payment intent.
-
#get(id, options = {}) ⇒ Resources::PaymentIntent
Retrieves a single payment intent by ID.
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from DuffelAPI::Services::BaseService
Instance Method Details
#confirm(id, options = {}) ⇒ Resources::PaymentIntent
Confirms a payment intent by ID
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/duffel_api/services/payment_intents_service.rb', line 35 def confirm(id, = {}) path = substitute_url_pattern("/payments/payment_intents/:id/actions/confirm", "id" => id) params = .delete(:params) || {} [:params] = {} [:params]["data"] = params begin response = make_request(:post, path, ) # Response doesn't raise any errors until #body is called response.tap(&:raw_body) end return if response.raw_body.nil? Resources::PaymentIntent.new(unenvelope_body(response.parsed_body), response) end |
#create(options = {}) ⇒ Resources::PaymentIntent
Creates an payment intent
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/duffel_api/services/payment_intents_service.rb', line 11 def create( = {}) path = "/payments/payment_intents" params = .delete(:params) || {} [:params] = {} [:params]["data"] = params begin response = make_request(:post, path, ) # Response doesn't raise any errors until #body is called response.tap(&:raw_body) end return if response.raw_body.nil? Resources::PaymentIntent.new(unenvelope_body(response.parsed_body), response) end |
#get(id, options = {}) ⇒ Resources::PaymentIntent
Retrieves a single payment intent by ID
60 61 62 63 64 65 66 67 68 |
# File 'lib/duffel_api/services/payment_intents_service.rb', line 60 def get(id, = {}) path = substitute_url_pattern("/payments/payment_intents/:id", "id" => id) response = make_request(:get, path, ) return if response.raw_body.nil? Resources::PaymentIntent.new(unenvelope_body(response.parsed_body), response) end |