Class: ModernTreasury::PaymentMethod1

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

Overview

The method by which the invoice can be paid. ‘ui` will show the embedded payment collection flow. `automatic` will automatically initiate payment based upon the account details of the receiving_account id.nIf the invoice amount is positive, the automatically initiated payment order’s direction will be debit. If the invoice amount is negative, the automatically initiated payment order’s direction will be credit. One of ‘manual`, `ui`, or `automatic`.

Constant Summary collapse

PAYMENT_METHOD1 =
[
  # TODO: Write general description for UI
  UI = 'ui'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = UI) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/modern_treasury/models/payment_method1.rb', line 32

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

  str = value.to_s.strip

  case str.downcase
  when 'ui' then UI
  when 'manual' then MANUAL
  when 'automatic' then AUTOMATIC
  else
    default_value
  end
end

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/modern_treasury/models/payment_method1.rb', line 26

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

  PAYMENT_METHOD1.include?(value)
end