Class: Bakong::Khqr::MerchantCode::BakongAccountID

Inherits:
TagLengthString show all
Defined in:
lib/bakong/khqr/merchant_code/global_unique_identifier.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, bakong_account_id) ⇒ BakongAccountID

Returns a new instance of BakongAccountID.



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/bakong/khqr/merchant_code/global_unique_identifier.rb', line 68

def initialize(tag, )
  raise Error.from(ERROR_CODES[:BAKONG_ACCOUNT_ID_REQUIRED]) if .nil? ||  == ""

  parts = .split("@")
  if .length > EMV[:INVALID_LENGTH][:BAKONG_ACCOUNT]
    raise Error.from(ERROR_CODES[:BAKONG_ACCOUNT_ID_LENGTH_INVALID])
  end
  raise Error.from(ERROR_CODES[:BAKONG_ACCOUNT_ID_INVALID]) if parts.length < 2

  super
end