Class: Batches::FundingBatchesTransactionsPaymentMethodCardFunding

Inherits:
Object
  • Object
show all
Defined in:
lib/batches/models/funding_batches_transactions_payment_method_card_funding.rb

Overview

Indicates how the card is funded: * DEBIT - indicates the card is a debit card where the funds may be present in an account to fulfill the transaction amount. * CREDIT - indicates the card is a credit card where the funds may be available on credit to the payer to fulfill the transaction amount. * FOOD_STAMP - indicates the card is an, Electronic Benefits Transfer, for food stamps. * CASH_BENEFITS - indicates the card is an, Electronic Benefits Transfer, for cash benefits. * PREPAID - indicates the card is a prepaid card where the funds are loaded to the card account to fulfill the transaction amount. Unlike a debit card, a prepaid is not linked to a bank account.

Constant Summary collapse

FUNDING_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_FUNDING =
[
  # TODO: Write general description for DEBIT
  DEBIT = 'DEBIT'.freeze,

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DEBIT) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/batches/models/funding_batches_transactions_payment_method_card_funding.rb', line 43

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

  str = value.to_s.strip

  case str.downcase
  when 'debit' then DEBIT
  when 'credit' then CREDIT
  when 'cash_benefits' then CASH_BENEFITS
  when 'food_stamp' then FOOD_STAMP
  when 'prepaid' then PREPAID
  else
    default_value
  end
end

.validate(value) ⇒ Object



37
38
39
40
41
# File 'lib/batches/models/funding_batches_transactions_payment_method_card_funding.rb', line 37

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

  FUNDING_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_FUNDING.include?(value)
end