Class: ThePlaidApi::PaymentChannel

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

Overview

The channel used to make a payment. ‘online:` transactions that took place online. `in store:` transactions that were made at a physical location. `other:` transactions that relate to banks, e.g. fees or deposits. This field replaces the `transaction_type` field.

Constant Summary collapse

PAYMENT_CHANNEL =
[
  # TODO: Write general description for ONLINE
  ONLINE = 'online'.freeze,

  # TODO: Write general description for ENUM_IN_STORE
  ENUM_IN_STORE = 'in store'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ONLINE) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/the_plaid_api/models/payment_channel.rb', line 29

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

  str = value.to_s.strip

  case str.downcase
  when 'online' then ONLINE
  when 'enum_in_store' then ENUM_IN_STORE
  when 'other' then OTHER
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/the_plaid_api/models/payment_channel.rb', line 23

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

  PAYMENT_CHANNEL.include?(value)
end