Class: Bakong::Khqr::MerchantCode::CRC

Inherits:
TagLengthString show all
Defined in:
lib/bakong/khqr/merchant_code/crc.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) ⇒ CRC

Returns a new instance of CRC.



11
12
13
14
15
16
# File 'lib/bakong/khqr/merchant_code/crc.rb', line 11

def initialize(tag, value)
  raise Error.from(ERROR_CODES[:CRC_TAG_REQUIRED]) if value.nil? || value == ""
  raise Error.from(ERROR_CODES[:CRC_LENGTH_INVALID]) if value.length > 4

  super
end