Class: Batches::BrandBatchesTransactionsPaymentMethodCardBrand
- Inherits:
-
Object
- Object
- Batches::BrandBatchesTransactionsPaymentMethodCardBrand
- Defined in:
- lib/batches/models/brand_batches_transactions_payment_method_card_brand.rb
Overview
Indicates the card brand that issued the card.
Constant Summary collapse
- BRAND_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_BRAND =
[ # TODO: Write general description for VISA VISA = 'VISA'.freeze, # TODO: Write general description for MASTERCARD MASTERCARD = 'MASTERCARD'.freeze, # TODO: Write general description for AMEX AMEX = 'AMEX'.freeze, # TODO: Write general description for DINERS DINERS = 'DINERS'.freeze, # TODO: Write general description for DISCOVER DISCOVER = 'DISCOVER'.freeze, # TODO: Write general description for JCB JCB = 'JCB'.freeze, # TODO: Write general description for CUP CUP = 'CUP'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = VISA) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/batches/models/brand_batches_transactions_payment_method_card_brand.rb', line 38 def self.from_value(value, default_value = VISA) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'visa' then VISA when 'mastercard' then MASTERCARD when 'amex' then AMEX when 'diners' then DINERS when 'discover' then DISCOVER when 'jcb' then JCB when 'cup' then CUP else default_value end end |
.validate(value) ⇒ Object
32 33 34 35 36 |
# File 'lib/batches/models/brand_batches_transactions_payment_method_card_brand.rb', line 32 def self.validate(value) return false if value.nil? BRAND_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_BRAND.include?(value) end |