Class: Batches::CvvResultBatchesTransactionsPaymentMethodCardCvvResult

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

Overview

The result of the CVV check.

Constant Summary collapse

CVV_RESULT_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_CVV_RESULT =
[
  # TODO: Write general description for MATCHED
  MATCHED = 'MATCHED'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = MATCHED) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/batches/models/cvv_result_batches_transactions_payment_method_card_cvv_result.rb', line 26

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

  str = value.to_s.strip

  case str.downcase
  when 'matched' then MATCHED
  when 'not_matched' then NOT_MATCHED
  when 'not_checked' then NOT_CHECKED
  else
    default_value
  end
end

.validate(value) ⇒ Object



20
21
22
23
24
# File 'lib/batches/models/cvv_result_batches_transactions_payment_method_card_cvv_result.rb', line 20

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

  CVV_RESULT_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_CVV_RESULT.include?(value)
end