Class: Airwallex::PaymentIntent
- Inherits:
-
APIResource
- Object
- APIResource
- Airwallex::PaymentIntent
- Extended by:
- APIOperations::Create, APIOperations::List, APIOperations::Retrieve
- Includes:
- APIOperations::Update
- Defined in:
- lib/airwallex/resources/payment_intent.rb
Constant Summary collapse
- SIMULATION_SHOPPER_ACTION_PATH =
Sandbox-only — see https://www.airwallex.com/docs/api/simulation/shopper-actions
"/api/v1/simulation/pa/shopper_actions"
Instance Attribute Summary
Attributes inherited from APIResource
Class Method Summary collapse
Instance Method Summary collapse
-
#cancel(params = {}) ⇒ Object
Cancel the payment intent.
-
#capture(params = {}) ⇒ Object
Capture an authorized payment.
-
#confirm(params = {}) ⇒ Object
Confirm the payment intent with payment method details.
-
#simulate_shopper_pay(url:) ⇒ PaymentIntent
Simulate the shopper completing a redirect/3DS challenge raised during #confirm, using the
urlfrom the confirm response's next_action. -
#simulate_shopper_reject(url:) ⇒ PaymentIntent
Simulate the shopper abandoning/rejecting a redirect/3DS challenge raised during #confirm, using the
urlfrom the confirm response's next_action.
Methods included from APIOperations::Create
Methods included from APIOperations::Retrieve
Methods included from APIOperations::List
Methods included from APIOperations::Update
Methods inherited from APIResource
#changed_attributes, #dirty?, #initialize, #inspect, #method_missing, #refresh, #refresh_from, resource_name, #respond_to_missing?, symbolized_get, symbolized_post, #to_hash, #to_json, #to_s
Constructor Details
This class inherits a constructor from Airwallex::APIResource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Airwallex::APIResource
Class Method Details
.resource_path ⇒ Object
13 14 15 |
# File 'lib/airwallex/resources/payment_intent.rb', line 13 def self.resource_path "/api/v1/pa/payment_intents" end |
Instance Method Details
#cancel(params = {}) ⇒ Object
Cancel the payment intent
28 29 30 31 32 33 34 35 |
# File 'lib/airwallex/resources/payment_intent.rb', line 28 def cancel(params = {}) response = Airwallex.client.post( "#{self.class.resource_path}/#{id}/cancel", params ) refresh_from(response) self end |
#capture(params = {}) ⇒ Object
Capture an authorized payment
38 39 40 41 42 43 44 45 |
# File 'lib/airwallex/resources/payment_intent.rb', line 38 def capture(params = {}) response = Airwallex.client.post( "#{self.class.resource_path}/#{id}/capture", params ) refresh_from(response) self end |
#confirm(params = {}) ⇒ Object
Confirm the payment intent with payment method details
18 19 20 21 22 23 24 25 |
# File 'lib/airwallex/resources/payment_intent.rb', line 18 def confirm(params = {}) response = Airwallex.client.post( "#{self.class.resource_path}/#{id}/confirm", params ) refresh_from(response) self end |
#simulate_shopper_pay(url:) ⇒ PaymentIntent
Simulate the shopper completing a redirect/3DS challenge raised during
#confirm, using the url from the confirm response's next_action
52 53 54 55 56 |
# File 'lib/airwallex/resources/payment_intent.rb', line 52 def simulate_shopper_pay(url:) response = Airwallex.client.post("#{SIMULATION_SHOPPER_ACTION_PATH}/pay", url: url) refresh_from(response) self end |
#simulate_shopper_reject(url:) ⇒ PaymentIntent
Simulate the shopper abandoning/rejecting a redirect/3DS challenge
raised during #confirm, using the url from the confirm response's
next_action
64 65 66 67 68 |
# File 'lib/airwallex/resources/payment_intent.rb', line 64 def simulate_shopper_reject(url:) response = Airwallex.client.post("#{SIMULATION_SHOPPER_ACTION_PATH}/reject", url: url) refresh_from(response) self end |