Class: Batches::ChannelBatchesChannel

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

Overview

Describes whether the transaction was processed in a face to face(CP) scenario or a Customer Not Present (CNP) scenario. * CP - A Customer Present transaction is when the payer and the merchant are in direct face to face contact when exchanging payment method information to fulfill a transaction. e.g. in a store and paying at the counter that is attended by a clerk. * CNP - A Customer NOT Present transaction is when the payer and the merchant are not together when exchanging payment method information to fulfill a transaction. e.g. a transaction executed from a merchant's website or over the phone

Constant Summary collapse

CHANNEL_BATCHES_CHANNEL =
[
  # TODO: Write general description for CP
  CP = 'CP'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CP) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/batches/models/channel_batches_channel.rb', line 31

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

  str = value.to_s.strip

  case str.downcase
  when 'cp' then CP
  when 'cnp' then CNP
  else
    default_value
  end
end

.validate(value) ⇒ Object



25
26
27
28
29
# File 'lib/batches/models/channel_batches_channel.rb', line 25

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

  CHANNEL_BATCHES_CHANNEL.include?(value)
end