Class: ThePlaidApi::PaymentAmountCurrency

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

Overview

The ISO-4217 currency code of the payment. For standing orders and payment consents, ‘“GBP”` must be used. For Poland, Denmark, Sweden and Norway, only the local currency is currently supported.

Constant Summary collapse

PAYMENT_AMOUNT_CURRENCY =
[
  # TODO: Write general description for GBP
  GBP = 'GBP'.freeze,

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = GBP) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/the_plaid_api/models/payment_amount_currency.rb', line 37

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

  str = value.to_s.strip

  case str.downcase
  when 'gbp' then GBP
  when 'eur' then EUR
  when 'pln' then PLN
  when 'sek' then SEK
  when 'dkk' then DKK
  when 'nok' then NOK
  else
    default_value
  end
end

.validate(value) ⇒ Object



31
32
33
34
35
# File 'lib/the_plaid_api/models/payment_amount_currency.rb', line 31

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

  PAYMENT_AMOUNT_CURRENCY.include?(value)
end