Class: UnivapayClientSdk::DirectDebitRegistrationOrigin

Inherits:
Object
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/direct_debit_registration_origin.rb

Overview

Where the bank account was registered from — merchant_console for the merchant dashboard, anywhere otherwise.

Constant Summary collapse

DIRECT_DEBIT_REGISTRATION_ORIGIN =
[
  # TODO: Write general description for ANYWHERE
  ANYWHERE = 'anywhere'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ANYWHERE) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/univapay_client_sdk/models/direct_debit_registration_origin.rb', line 24

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

  str = value.to_s.strip

  case str.downcase
  when 'anywhere' then ANYWHERE
  when 'merchant_console' then MERCHANT_CONSOLE
  else
    default_value
  end
end

.validate(value) ⇒ Object



18
19
20
21
22
# File 'lib/univapay_client_sdk/models/direct_debit_registration_origin.rb', line 18

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

  DIRECT_DEBIT_REGISTRATION_ORIGIN.include?(value)
end