Class: Bakong::Khqr::MerchantCode::PointOfInitiationMethod

Inherits:
TagLengthString
  • Object
show all
Defined in:
lib/bakong/khqr/merchant_code/point_of_initiation_method.rb

Instance Attribute Summary

Attributes inherited from TagLengthString

#length, #tag, #value

Instance Method Summary collapse

Methods inherited from TagLengthString

#to_s

Constructor Details

#initialize(tag, value) ⇒ PointOfInitiationMethod

Returns a new instance of PointOfInitiationMethod.



12
13
14
15
16
17
18
19
# File 'lib/bakong/khqr/merchant_code/point_of_initiation_method.rb', line 12

def initialize(tag, value)
  raise Error.from(ERROR_CODES[:POINT_INITIATION_LENGTH_INVALID]) if value.to_s.length > 2
  unless [EMV[:STATIC_QR], EMV[:DYNAMIC_QR]].include?(value)
    raise Error.from(ERROR_CODES[:POINT_OF_INITIATION_METHOD_INVALID])
  end

  super
end