Class: ThePlaidApi::WalletTransactionFailureReason

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

Overview

The error code of a failed transaction. Error codes include: ‘EXTERNAL_SYSTEM`: The transaction was declined by an external system. `EXPIRED`: The transaction request has expired. `CANCELLED`: The transaction request was rescinded. `INVALID`: The transaction did not meet certain criteria, such as an inactive account or no valid counterparty, etc. `UNKNOWN`: The transaction was unsuccessful, but the exact cause is unknown.

Constant Summary collapse

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = EXTERNAL_SYSTEM) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/the_plaid_api/models/wallet_transaction_failure_reason.rb', line 37

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

  str = value.to_s.strip

  case str.downcase
  when 'external_system' then EXTERNAL_SYSTEM
  when 'expired' then EXPIRED
  when 'cancelled' then CANCELLED
  when 'invalid' then INVALID
  when 'unknown' then UNKNOWN
  else
    default_value
  end
end

.validate(value) ⇒ Object



31
32
33
34
35
# File 'lib/the_plaid_api/models/wallet_transaction_failure_reason.rb', line 31

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

  WALLET_TRANSACTION_FAILURE_REASON.include?(value)
end