Class: ApiReference::PaymentMethodType

Inherits:
Object
  • Object
show all
Defined in:
lib/api_reference/models/payment_method_type.rb

Overview

The type of the underlying payment instrument, e.g. card or us_bank_account.

Constant Summary collapse

PAYMENT_METHOD_TYPE =
[
  # TODO: Write general description for CARD
  CARD = 'card'.freeze,

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CARD) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/api_reference/models/payment_method_type.rb', line 33

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

  str = value.to_s.strip

  case str.downcase
  when 'card' then CARD
  when 'us_bank_account' then US_BANK_ACCOUNT
  when 'link' then LINK
  when 'amazon_pay' then AMAZON_PAY
  when 'crypto' then CRYPTO
  else
    default_value
  end
end

.validate(value) ⇒ Object



27
28
29
30
31
# File 'lib/api_reference/models/payment_method_type.rb', line 27

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

  true
end