Class: Plaid::Code

Inherits:
Object
  • Object
show all
Defined in:
lib/plaid/models/code.rb

Overview

A code representing the rationale for permitting or declining the proposed transfer. Possible values are: ‘NSF` – Transaction likely to result in a return due to insufficient funds. `RISK` - Transaction is high-risk. `MANUALLY_VERIFIED_ITEM` – Item created via same-day micro deposits, limited information available. Plaid can only offer `permitted` as a transaction decision. `LOGIN_REQUIRED` – Unable to collect the account information required for an authorization decision due to Item staleness. Can be rectified using Link update mode. `ERROR` – Unable to collect the account information required for an authorization decision due to an error.

Constant Summary collapse

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = NSF) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/plaid/models/code.rb', line 40

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

  str = value.to_s.strip

  case str.downcase
  when 'nsf' then NSF
  when 'risk' then RISK
  when 'manually_verified_item' then MANUALLY_VERIFIED_ITEM
  when 'login_required' then LOGIN_REQUIRED
  when 'error' then ERROR
  else
    default_value
  end
end

.validate(value) ⇒ Object



34
35
36
37
38
# File 'lib/plaid/models/code.rb', line 34

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

  true
end