Class: Plaid::Decision

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

Overview

A decision regarding the proposed transfer. ‘approved` – The proposed transfer has received the end user’s consent and has been approved for processing. Plaid has also reviewed the proposed transfer and has approved it for processing. ‘permitted` – Plaid was unable to fetch the information required to approve or decline the proposed transfer. You may proceed with the transfer, but further review is recommended. Plaid is awaiting further instructions from the client. `declined` – Plaid reviewed the proposed transfer and declined processing. Refer to the `code` field in the `decision_rationale` object for details.

Constant Summary collapse

DECISION =
[
  # TODO: Write general description for APPROVED
  APPROVED = 'approved'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = APPROVED) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/plaid/models/decision.rb', line 34

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

  str = value.to_s.strip

  case str.downcase
  when 'approved' then APPROVED
  when 'permitted' then PERMITTED
  when 'declined' then DECLINED
  else
    default_value
  end
end

.validate(value) ⇒ Object



28
29
30
31
32
# File 'lib/plaid/models/decision.rb', line 28

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

  true
end