Class: ThePlaidApi::CounterpartyType

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

Overview

The counterparty type. ‘merchant`: a provider of goods or services for purchase `financial_institution`: a financial entity (bank, credit union, BNPL, fintech) `payment_app`: a transfer or P2P app (e.g. Zelle) `marketplace`: a marketplace (e.g DoorDash, Google Play Store) `payment_terminal`: a point-of-sale payment terminal (e.g Square, Toast) `income_source`: the payer in an income transaction (e.g., an employer, client, or government agency)

Constant Summary collapse

COUNTERPARTY_TYPE =
[
  # TODO: Write general description for MERCHANT
  MERCHANT = 'merchant'.freeze,

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = MERCHANT) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/the_plaid_api/models/counterparty_type.rb', line 41

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

  str = value.to_s.strip

  case str.downcase
  when 'merchant' then MERCHANT
  when 'financial_institution' then FINANCIAL_INSTITUTION
  when 'payment_app' then PAYMENT_APP
  when 'marketplace' then MARKETPLACE
  when 'payment_terminal' then PAYMENT_TERMINAL
  when 'income_source' then INCOME_SOURCE
  else
    default_value
  end
end

.validate(value) ⇒ Object



35
36
37
38
39
# File 'lib/the_plaid_api/models/counterparty_type.rb', line 35

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

  COUNTERPARTY_TYPE.include?(value)
end