Comment #2 on issue 11 by
wangzha...@gmail.com: iso8583py change bit128
http://code.google.com/p/iso8583py/issues/detail?id=11
Hello:
iso =
"0110F23A40010A80800000000000060000011662260199201777774010000000000001000702014927000006014927070207026011061792000594901241820072172111156166226019920177777191111111111111111111AE3D1B33"
ISO8583.py(source codes), run python test8583.py
Traceback (most recent call last):
File "test8583.py", line 19, in <module>
b.setIsoContent(iso)
File "/home/wangzhaohe/app/ISO8583Module-1.2/ISO8583/ISO8583.py",
line 992, in setIsoContent
self.__inicializeBitsFromBitmapStr(self.BITMAP_HEX)
File "/home/wangzhaohe/app/ISO8583Module-1.2/ISO8583/ISO8583.py",
line 519, in __inicializeBitsFromBitmapStr
self.BITMAP_VALUES[(c +1)* 8] = 'X'
IndexError: list assignment index out of range
*The reason is in line 519:*
def __inicializeBitsFromBitmapStr(self, bitmap):
"""Method that receive a bitmap str, process it, and prepare
ISO8583 object to understand and "see" the bits and values inside the
ISO ASCII package.
It's a internal method, so don't call!
@param: bitmap -> bitmap str to be analized and translated to
"bits"
"""
bits = []
for c in range(0,16):
for d in range(1,9):
if self.DEBUG == True:
print ('Value (%d)-> %s & %s = %s' %
(d,self.BITMAP[c] , self._TMP[d], (self.BITMAP[c] & self._TMP[d]) ))
if (self.BITMAP[c] & self._TMP[d]) == self._TMP[d]:
if d == 1: # e o 8 bit
if self.DEBUG == True:
print ('Bit %s is present !!!' % ((c +1)* 8))
bits.append((c +1)* 8)
*self.BITMAP_VALUES[(c +1)* 8] = 'X'*
else:
if (c == 0) & (d == 2): # Continuation bit
*when c=15, c +1* 8==128, but self.BITMAP_VALUES's lenth is 128**, so
index error displayed.*
#init with "0" the array of values
def __inicializeBitmapValues(self):
"""Method that inicialize/reset a internal array used to save
bits and values
It's a internal method, so don't call!
"""
if self.DEBUG == True:
print ('Init bitmap_values')
if len(self.BITMAP_VALUES) == 128:
*for cont in range(0,128):*
self.BITMAP_VALUES[cont] = self._BIT_DEFAULT_VALUE
else:
*for cont in range(0,128):*
self.BITMAP_VALUES.append(self._BIT_DEFAULT_VALUE)
Here if 128 changes to 129, I think it will be ok.
ISO8583_changed_by_wzh.py, run python test8583.py
['2', 'Primary account number (PAN)', 'LL', 19, 'n']
value = 166226019920177777
['3', 'Precessing code', 'N', 6, 'n']
value = 401000
['4', 'Amount transaction', 'N', 12, 'n']
value = 000000000100
['7', 'Date and time transmission', 'N', 10, 'n']
value = 0702014927
['11', 'Systems trace audit number', 'N', 6, 'n']
value = 000006
['12', 'Date and time local transaction', 'N', 6, 'n']
value = 014927
['13', 'Date effective', 'N', 4, 'n']
value = 0702
['15', 'Date settlement', 'N', 4, 'n']
value = 0702
['18', 'Message error indicator', 'N', 4, 'n']
value = 6011
['32', 'Acquiring institution identification code', 'LL', 11, 'n']
value = 06179200
['37', 'Retrieval reference number', 'N', 12, 'an']
value = 059490124182
['39', 'Action code', 'A', 2, 'an']
value = 00
['41', 'Card acceptor terminal identification', 'N', 8, 'ans']
value = 72172111
['49', 'Verification data', 'A', 3, 'a']
value = 156
['102', 'Account identification 1', 'LL', 28, 'ans']
value = 166226019920177777
['103', 'Account identification 2', 'LL', 28, 'ans']
value = 191111111111111111111
['128', 'Message authentication code (MAC) field', 'B', 16, 'b']
value = AE3D1B33
wangz...@gmail.com
2013-10-01
? 2013?09?30? 21:06,
iso8...@googlecode.com ??: