Class: ModernTreasury::FallbackType

Inherits:
Object
  • Object
show all
Defined in:
lib/modern_treasury/models/fallback_type.rb

Overview

A payment type to fallback to if the original type is not valid for the receiving account. Currently, this only supports falling back from RTP to ACH (type=rtp and fallback_type=ach)

Constant Summary collapse

FALLBACK_TYPE =
[
  # TODO: Write general description for ACH
  ACH = 'ach'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ACH) ⇒ Object



22
23
24
25
26
# File 'lib/modern_treasury/models/fallback_type.rb', line 22

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

  default_value
end

.validate(value) ⇒ Object



16
17
18
19
20
# File 'lib/modern_treasury/models/fallback_type.rb', line 16

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

  FALLBACK_TYPE.include?(value)
end