Commit f2334d4d by Owo Sugiana

Bug fixed ISO8583.__setBitTypeANS()

1 parent 6d57d653
0.1.5 2020-04-25
----------------
- Bug fixed pada ISO8583.__setBitTypeANS() dimana seharusnya menggunakan
ljust() ketimbang zfill()
0.1.4 2020-04-21
----------------
- Tangkap pesan kesalahan saat iso.process() agar tampil di log
......
......@@ -11,6 +11,18 @@ class BaseISO8583(ISO8583):
self.redefineBit(
bit, short_name, long_name, type_, size, valueType)
def _ISO8583__setBitTypeANS(self, bit, value): # Override
value = "%s" % value
if len(value) > self.getBitLimit(bit):
value = value[0:self.getBitLimit(bit)]
raise ValueTooLarge('Error: value up to size! Bit[%s] of type %s limit size = %s' % (
bit, self.getBitType(bit), self.getBitLimit(bit)))
data_form = self.getBitFormat(bit)
if data_form == "A":
self.BITMAP_VALUES[bit] = value.ljust(self.getBitLimit(bit)).encode()
elif data_form == "E":
self.BITMAP_VALUES[bit] = value.zfill(self.getBitLimit(bit)).encode('cp1148')
def redefineBit(self, bit, short_name, long_name, type_, size, valueType):
if type_ in ('LL', 'LLL'):
LenForm = 'A' # ASCII
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!