Class: ThePlaidApi::PaymentInitiationConsentProcessingMode

Inherits:
Object
  • Object
show all
Defined in:
lib/the_plaid_api/models/payment_initiation_consent_processing_mode.rb

Overview

Decides the mode under which the payment processing should be performed, using ‘IMMEDIATE` as default. `IMMEDIATE`: Will immediately execute the payment, waiting for a response from the ASPSP before returning the result of the payment initiation. This is ideal for user-present flows. `ASYNC`: Will accept a payment execution request and schedule it for processing, immediately returning the new `payment_id`. Listen for webhooks to obtain real-time updates on the payment status. This is ideal for non user-present flows.

Constant Summary collapse

[
  # TODO: Write general description for ASYNC
  ASYNC = 'ASYNC'.freeze,

  # TODO: Write general description for IMMEDIATE
  IMMEDIATE = 'IMMEDIATE'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ASYNC) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/the_plaid_api/models/payment_initiation_consent_processing_mode.rb', line 30

def self.from_value(value, default_value = ASYNC)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'async' then ASYNC
  when 'immediate' then IMMEDIATE
  else
    default_value
  end
end

.validate(value) ⇒ Object



24
25
26
27
28
# File 'lib/the_plaid_api/models/payment_initiation_consent_processing_mode.rb', line 24

def self.validate(value)
  return false if value.nil?

  PAYMENT_INITIATION_CONSENT_PROCESSING_MODE.include?(value)
end