Class: Airwallex::PaymentConsent
- Inherits:
-
APIResource
- Object
- APIResource
- Airwallex::PaymentConsent
- Extended by:
- APIOperations::Create, APIOperations::List, APIOperations::Retrieve
- Includes:
- APIOperations::Update
- Defined in:
- lib/airwallex/resources/payment_consent.rb
Overview
Represents a Payment Consent — a saved card/payment method authorized for future off-session charges without re-prompting the customer.
Does NOT attach directly to a BillingSubscription — a subscription's payment_source_id references a PaymentSource (see Airwallex::PaymentSource), a separate Billing object created FROM a verified, merchant-initiated PaymentConsent. See PaymentSource's docstring for the full chain.
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
-
.resource_path ⇒ String
API resource path for payment consents.
Instance Method Summary collapse
-
#disable(params = {}) ⇒ PaymentConsent
Disable this consent so it can no longer be charged.
-
#simulate_shopper_verify(url:) ⇒ PaymentConsent
Simulate the shopper completing a redirect/3DS challenge raised during #verify, using the
urlfrom the verify response's next_action. -
#verify(params = {}) ⇒ PaymentConsent
Verify this consent (e.g. via a zero/low-value authorization) before it can be used for off-session charges.
-
#verify_continue(params = {}) ⇒ PaymentConsent
Continue a verification that requires further customer action (e.g. completing 3DS).
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 ⇒ String
Returns API resource path for payment consents.
32 33 34 |
# File 'lib/airwallex/resources/payment_consent.rb', line 32 def self.resource_path "/api/v1/pa/payment_consents" end |
Instance Method Details
#disable(params = {}) ⇒ PaymentConsent
Disable this consent so it can no longer be charged
65 66 67 68 69 |
# File 'lib/airwallex/resources/payment_consent.rb', line 65 def disable(params = {}) response = Airwallex.client.post("#{self.class.resource_path}/#{id}/disable", params) refresh_from(response) self end |
#simulate_shopper_verify(url:) ⇒ PaymentConsent
Simulate the shopper completing a redirect/3DS challenge raised
during #verify, using the url from the verify response's
next_action
77 78 79 80 81 |
# File 'lib/airwallex/resources/payment_consent.rb', line 77 def simulate_shopper_verify(url:) response = Airwallex.client.post("#{SIMULATION_SHOPPER_ACTION_PATH}/verify", url: url) refresh_from(response) self end |
#verify(params = {}) ⇒ PaymentConsent
Verify this consent (e.g. via a zero/low-value authorization) before it can be used for off-session charges
44 45 46 47 48 |
# File 'lib/airwallex/resources/payment_consent.rb', line 44 def verify(params = {}) response = Airwallex.client.post("#{self.class.resource_path}/#{id}/verify", params) refresh_from(response) self end |
#verify_continue(params = {}) ⇒ PaymentConsent
Continue a verification that requires further customer action (e.g. completing 3DS)
55 56 57 58 59 |
# File 'lib/airwallex/resources/payment_consent.rb', line 55 def verify_continue(params = {}) response = Airwallex.client.post("#{self.class.resource_path}/#{id}/verify_continue", params) refresh_from(response) self end |