Class: ThePlaidApi::TransactionCode

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

Overview

An identifier classifying the transaction type. This field is only populated for European institutions. For institutions in the US and Canada, this field is set to ‘null`. `adjustment:` Bank adjustment `atm:` Cash deposit or withdrawal via an automated teller machine `bank charge:` Charge or fee levied by the institution `bill payment`: Payment of a bill `cash:` Cash deposit or withdrawal `cashback:` Cash withdrawal while making a debit card purchase `cheque:` Document ordering the payment of money to another person or organization `direct debit:` Automatic withdrawal of funds initiated by a third party at a regular interval `interest:` Interest earned or incurred `purchase:` Purchase made with a debit or credit card `standing order:` Payment instructed by the account holder to a third party at a regular interval `transfer:` Transfer of money between accounts

Constant Summary collapse

TRANSACTION_CODE =
[
  # TODO: Write general description for ADJUSTMENT
  ADJUSTMENT = 'adjustment'.freeze,

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

  # TODO: Write general description for ENUM_BANK_CHARGE
  ENUM_BANK_CHARGE = 'bank charge'.freeze,

  # TODO: Write general description for ENUM_BILL_PAYMENT
  ENUM_BILL_PAYMENT = 'bill payment'.freeze,

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

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

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

  # TODO: Write general description for ENUM_DIRECT_DEBIT
  ENUM_DIRECT_DEBIT = 'direct debit'.freeze,

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

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

  # TODO: Write general description for ENUM_STANDING_ORDER
  ENUM_STANDING_ORDER = 'standing order'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ADJUSTMENT) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/the_plaid_api/models/transaction_code.rb', line 64

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

  str = value.to_s.strip

  case str.downcase
  when 'adjustment' then ADJUSTMENT
  when 'atm' then ATM
  when 'enum_bank_charge' then ENUM_BANK_CHARGE
  when 'enum_bill_payment' then ENUM_BILL_PAYMENT
  when 'cash' then CASH
  when 'cashback' then CASHBACK
  when 'cheque' then CHEQUE
  when 'enum_direct_debit' then ENUM_DIRECT_DEBIT
  when 'interest' then INTEREST
  when 'purchase' then PURCHASE
  when 'enum_standing_order' then ENUM_STANDING_ORDER
  when 'transfer' then TRANSFER
  else
    default_value
  end
end

.validate(value) ⇒ Object



58
59
60
61
62
# File 'lib/the_plaid_api/models/transaction_code.rb', line 58

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

  TRANSACTION_CODE.include?(value)
end