Merge lp:~logan/ubuntu/quantal/python-iso8583/new-upstream into lp:ubuntu/quantal/python-iso8583

Proposed by Logan Rosen
Status: Merged
Merge reported by: Dimitri John Ledkov
Merged at revision: not available
Proposed branch: lp:~logan/ubuntu/quantal/python-iso8583/new-upstream
Merge into: lp:ubuntu/quantal/python-iso8583
Diff against target: 1163 lines (+296/-169)
15 files modified
ISO8583/ISO8583.py (+68/-71)
PKG-INFO (+1/-1)
TODO (+74/-0)
debian/changelog (+9/-0)
debian/control (+4/-3)
debian/rules (+3/-1)
doc/ISO8583.ISO8583.html (+42/-10)
doc/index.html (+10/-0)
examples/echoClient.py (+13/-13)
examples/echoServer.py (+8/-8)
examples/example1.py (+18/-18)
examples/example2.py (+12/-12)
examples/example3.py (+17/-17)
examples/example4.py (+15/-14)
setup.py (+2/-1)
To merge this branch: bzr merge lp:~logan/ubuntu/quantal/python-iso8583/new-upstream
Reviewer Review Type Date Requested Status
Barry Warsaw (community) Approve
Ubuntu branches Pending
Review via email: mp+116588@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Barry Warsaw (barry) wrote :

Another fine contribution to Ubuntu, thanks again. All of my previous comments on your packages do apply to this one too. It's ideal to get updates into Debian first so that it is easier to keep Ubuntu in sync. Please do file bugs in Debian and Ubuntu so that we can get this package resync'd again later.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ISO8583/ISO8583.py'
--- ISO8583/ISO8583.py 2009-08-27 15:34:49 +0000
+++ ISO8583/ISO8583.py 2012-07-25 06:33:20 +0000
@@ -16,8 +16,19 @@
16along with this program. If not, see <http://www.gnu.org/licenses/>.16along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
18"""18"""
19"""19
20 ISO8583 Class.20__author__ = 'Igor Vitorio Custodio <igorvc@vulcanno.com.br>'
21__version__= '1.2'
22__licence__ = 'GPL V3'
23
24
25
26from ISOErrors import *
27import struct
28
29
30class ISO8583:
31 """Main Class to work with ISO8583 packages.
21 Used to create, change, send, receive, parse or work with ISO8593 Package version 1993.32 Used to create, change, send, receive, parse or work with ISO8593 Package version 1993.
22 It's 100% Python :)33 It's 100% Python :)
23 Enjoy it!34 Enjoy it!
@@ -40,32 +51,18 @@
40 iso.setBit(49,986)51 iso.setBit(49,986)
41 iso.setBit(99,99)52 iso.setBit(99,99)
42 except ValueToLarge, e:53 except ValueToLarge, e:
43 print 'Value too large :( %s' % e54 print ('Value too large :( %s' % e)
44 except InvalidMTI, i:55 except InvalidMTI, i:
45 print 'This MTI is wrong :( %s' % i56 print ('This MTI is wrong :( %s' % i)
46 57
47 print 'The Message Type Indication is = %s' %iso.getMTI() 58 print ('The Message Type Indication is = %s' %iso.getMTI())
48 59
49 print 'The Bitmap is = %s' %iso.getBitmap() 60 print ('The Bitmap is = %s' %iso.getBitmap())
50 iso.showIsoBits();61 iso.showIsoBits();
51 print 'This is the ISO8583 complete package %s' % iso.getRawIso()62 print ('This is the ISO8583 complete package %s' % iso.getRawIso())
52 print 'This is the ISO8583 complete package to sent over the TCPIP network %s' % iso.getNetworkISO()63 print ('This is the ISO8583 complete package to sent over the TCPIP network %s' % iso.getNetworkISO())
53 64
54"""65"""
55
56__author__ = 'Igor Vitorio Custodio <igorvc@vulcanno.com.br>'
57__version__= '0.2'
58__licence__ = 'GPL V3'
59
60
61
62from ISOErrors import *
63import struct
64
65
66class ISO8583:
67 """Main Class to work with ISO8583 packages.
68 """
69 #Attributes66 #Attributes
70 # Bitsto be set 00000000 -> _BIT_POSITION_1 ... _BIT_POSITION_867 # Bitsto be set 00000000 -> _BIT_POSITION_1 ... _BIT_POSITION_8
71 _BIT_POSITION_1 = 128 # 10 00 00 0068 _BIT_POSITION_1 = 128 # 10 00 00 00
@@ -130,7 +127,7 @@
130 _BITS_VALUE_TYPE[37] = ['37','Retrieval reference number','N',12,'an']127 _BITS_VALUE_TYPE[37] = ['37','Retrieval reference number','N',12,'an']
131 _BITS_VALUE_TYPE[38] = ['38','Approval code','N',6,'an']128 _BITS_VALUE_TYPE[38] = ['38','Approval code','N',6,'an']
132 _BITS_VALUE_TYPE[39] = ['39','Action code','A',2,'an']129 _BITS_VALUE_TYPE[39] = ['39','Action code','A',2,'an']
133 _BITS_VALUE_TYPE[40] = ['40','Service code','N3',3,'an']130 _BITS_VALUE_TYPE[40] = ['40','Service code','N',3,'an']
134 _BITS_VALUE_TYPE[41] = ['41','Card acceptor terminal identification','N',8,'ans']131 _BITS_VALUE_TYPE[41] = ['41','Card acceptor terminal identification','N',8,'ans']
135 _BITS_VALUE_TYPE[42] = ['42','Card acceptor identification code','A',15,'ans']132 _BITS_VALUE_TYPE[42] = ['42','Card acceptor identification code','A',15,'ans']
136 _BITS_VALUE_TYPE[43] = ['43','Card acceptor name/location','A',40,'asn']133 _BITS_VALUE_TYPE[43] = ['43','Card acceptor name/location','A',40,'asn']
@@ -191,7 +188,7 @@
191 _BITS_VALUE_TYPE[98] = ['98','Payee','ANS',25,'ans']188 _BITS_VALUE_TYPE[98] = ['98','Payee','ANS',25,'ans']
192 _BITS_VALUE_TYPE[99] = ['99','Settlement institution identification code','LL',11,'n']189 _BITS_VALUE_TYPE[99] = ['99','Settlement institution identification code','LL',11,'n']
193 _BITS_VALUE_TYPE[100] = ['100','Receiving institution identification code','LL',11,'n']190 _BITS_VALUE_TYPE[100] = ['100','Receiving institution identification code','LL',11,'n']
194 _BITS_VALUE_TYPE[101] = ['101','File name','ASN',17,'ans']191 _BITS_VALUE_TYPE[101] = ['101','File name','ANS',17,'ans']
195 _BITS_VALUE_TYPE[102] = ['102','Account identification 1','LL',28,'ans']192 _BITS_VALUE_TYPE[102] = ['102','Account identification 1','LL',28,'ans']
196 _BITS_VALUE_TYPE[103] = ['103','Account identification 2','LL',28,'ans']193 _BITS_VALUE_TYPE[103] = ['103','Account identification 2','LL',28,'ans']
197 _BITS_VALUE_TYPE[104] = ['104','Transaction description','LLL',100,'ans']194 _BITS_VALUE_TYPE[104] = ['104','Transaction description','LLL',100,'ans']
@@ -332,7 +329,7 @@
332 """329 """
333 330
334 if self.DEBUG == True:331 if self.DEBUG == True:
335 print 'Init bitmap'332 print ('Init bitmap')
336 333
337 if len(self.BITMAP) == 16:334 if len(self.BITMAP) == 16:
338 for cont in range(0,16):335 for cont in range(0,16):
@@ -349,7 +346,7 @@
349 It's a internal method, so don't call!346 It's a internal method, so don't call!
350 """347 """
351 if self.DEBUG == True:348 if self.DEBUG == True:
352 print 'Init bitmap_values'349 print ('Init bitmap_values')
353 350
354 if len(self.BITMAP_VALUES) == 128:351 if len(self.BITMAP_VALUES) == 128:
355 for cont in range(0,128):352 for cont in range(0,128):
@@ -370,7 +367,7 @@
370 @raise: BitInexistent Exception, ValueToLarge Exception367 @raise: BitInexistent Exception, ValueToLarge Exception
371 """368 """
372 if self.DEBUG == True:369 if self.DEBUG == True:
373 print 'Setting bit inside bitmap bit[%s] = %s' % (bit, value)370 print ('Setting bit inside bitmap bit[%s] = %s') % (bit, value)
374 371
375 if bit < 1 or bit > 128:372 if bit < 1 or bit > 128:
376 raise BitInexistent("Bit number %s dosen't exist!" % bit)373 raise BitInexistent("Bit number %s dosen't exist!" % bit)
@@ -441,7 +438,7 @@
441 if (self.BITMAP[0] & self._BIT_POSITION_1) != self._BIT_POSITION_1:438 if (self.BITMAP[0] & self._BIT_POSITION_1) != self._BIT_POSITION_1:
442 # Only has the first bitmap439 # Only has the first bitmap
443 if self.DEBUG == True:440 if self.DEBUG == True:
444 print '%d Bitmap = %d(Decimal) = %s (hexa) ' %(c, self.BITMAP[c], hex(self.BITMAP[c])) 441 print ('%d Bitmap = %d(Decimal) = %s (hexa) ' %(c, self.BITMAP[c], hex(self.BITMAP[c])))
445 442
446 tm = hex(self.BITMAP[c])[2:]443 tm = hex(self.BITMAP[c])[2:]
447 if len(tm) != 2:444 if len(tm) != 2:
@@ -451,7 +448,7 @@
451 break448 break
452 else: # second bitmap449 else: # second bitmap
453 if self.DEBUG == True:450 if self.DEBUG == True:
454 print '%d Bitmap = %d(Decimal) = %s (hexa) ' %(c, self.BITMAP[c], hex(self.BITMAP[c])) 451 print ('%d Bitmap = %d(Decimal) = %s (hexa) ' %(c, self.BITMAP[c], hex(self.BITMAP[c])))
455 452
456 tm = hex(self.BITMAP[c])[2:]453 tm = hex(self.BITMAP[c])[2:]
457 if len(tm) != 2:454 if len(tm) != 2:
@@ -476,7 +473,7 @@
476 for x in range(0,32,2):473 for x in range(0,32,2):
477 if (int(bitmap[0:2],16) & self._BIT_POSITION_1) != self._BIT_POSITION_1: # Only 1 bitmap474 if (int(bitmap[0:2],16) & self._BIT_POSITION_1) != self._BIT_POSITION_1: # Only 1 bitmap
478 if self.DEBUG == True:475 if self.DEBUG == True:
479 print 'Token[%d] %s converted to int is = %s' %(x, bitmap[x:x+2], int(bitmap[x:x+2],16))476 print ('Token[%d] %s converted to int is = %s' %(x, bitmap[x:x+2], int(bitmap[x:x+2],16)))
480 477
481 self.BITMAP_HEX += bitmap[x:x+2]478 self.BITMAP_HEX += bitmap[x:x+2]
482 self.BITMAP[cont] = int(bitmap[x:x+2],16)479 self.BITMAP[cont] = int(bitmap[x:x+2],16)
@@ -484,7 +481,7 @@
484 break481 break
485 else: # Second bitmap482 else: # Second bitmap
486 if self.DEBUG == True:483 if self.DEBUG == True:
487 print 'Token[%d] %s converted to int is = %s' %(x, bitmap[x:x+2], int(bitmap[x:x+2],16))484 print ('Token[%d] %s converted to int is = %s' %(x, bitmap[x:x+2], int(bitmap[x:x+2],16)))
488 485
489 self.BITMAP_HEX += bitmap[x:x+2]486 self.BITMAP_HEX += bitmap[x:x+2]
490 self.BITMAP[cont] = int(bitmap[x:x+2],16) 487 self.BITMAP[cont] = int(bitmap[x:x+2],16)
@@ -499,7 +496,7 @@
499 @param: bitmap -> bitmap str to be analized and translated to "bits"496 @param: bitmap -> bitmap str to be analized and translated to "bits"
500 """497 """
501 bits = self.__inicializeBitsFromBitmapStr(bitmap)498 bits = self.__inicializeBitsFromBitmapStr(bitmap)
502 print 'Bits inside %s = %s' % (bitmap,bits) 499 print ('Bits inside %s = %s' % (bitmap,bits))
503 ################################################################################################ 500 ################################################################################################
504 501
505 ################################################################################################502 ################################################################################################
@@ -513,23 +510,23 @@
513 for c in range(0,16):510 for c in range(0,16):
514 for d in range(1,9):511 for d in range(1,9):
515 if self.DEBUG == True:512 if self.DEBUG == True:
516 print 'Value (%d)-> %s & %s = %s' % (d,self.BITMAP[c] , self._TMP[d], (self.BITMAP[c] & self._TMP[d]) )513 print ('Value (%d)-> %s & %s = %s' % (d,self.BITMAP[c] , self._TMP[d], (self.BITMAP[c] & self._TMP[d]) ))
517 if (self.BITMAP[c] & self._TMP[d]) == self._TMP[d]:514 if (self.BITMAP[c] & self._TMP[d]) == self._TMP[d]:
518 if d == 1: # e o 8 bit515 if d == 1: # e o 8 bit
519 if self.DEBUG == True:516 if self.DEBUG == True:
520 print 'Bit %s is present !!!' % ((c +1)* 8)517 print ('Bit %s is present !!!' % ((c +1)* 8))
521 bits.append((c +1)* 8)518 bits.append((c +1)* 8)
522 self.BITMAP_VALUES[(c +1)* 8] = 'X'519 self.BITMAP_VALUES[(c +1)* 8] = 'X'
523 else:520 else:
524 if (c == 0) & (d == 2): # Continuation bit521 if (c == 0) & (d == 2): # Continuation bit
525 if self.DEBUG == True:522 if self.DEBUG == True:
526 print 'Bit 1 is present !!!' 523 print ('Bit 1 is present !!!')
527 524
528 bits.append(1)525 bits.append(1)
529 526
530 else:527 else:
531 if self.DEBUG == True:528 if self.DEBUG == True:
532 print 'Bit %s is present !!!' % (c * 8 + d - 1)529 print ('Bit %s is present !!!' % (c * 8 + d - 1))
533 530
534 bits.append(c * 8 + d - 1)531 bits.append(c * 8 + d - 1)
535 self.BITMAP_VALUES[c * 8 + d - 1] = 'X'532 self.BITMAP_VALUES[c * 8 + d - 1] = 'X'
@@ -549,23 +546,23 @@
549 for c in range(0,16):546 for c in range(0,16):
550 for d in range(1,9):547 for d in range(1,9):
551 if self.DEBUG == True:548 if self.DEBUG == True:
552 print 'Value (%d)-> %s & %s = %s' % (d,self.BITMAP[c] , self._TMP[d], (self.BITMAP[c] & self._TMP[d]) )549 print ('Value (%d)-> %s & %s = %s' % (d,self.BITMAP[c] , self._TMP[d], (self.BITMAP[c] & self._TMP[d]) ))
553 if (self.BITMAP[c] & self._TMP[d]) == self._TMP[d]:550 if (self.BITMAP[c] & self._TMP[d]) == self._TMP[d]:
554 if d == 1: # e o 8 bit551 if d == 1: # e o 8 bit
555 if self.DEBUG == True:552 if self.DEBUG == True:
556 print 'Bit %s is present !!!' % ((c +1)* 8)553 print ('Bit %s is present !!!' % ((c +1)* 8))
557 554
558 bits.append((c +1)* 8)555 bits.append((c +1)* 8)
559 else:556 else:
560 if (c == 0) & (d == 2): # Continuation bit557 if (c == 0) & (d == 2): # Continuation bit
561 if self.DEBUG == True:558 if self.DEBUG == True:
562 print 'Bit 1 is present !!!' 559 print ('Bit 1 is present !!!')
563 560
564 bits.append(1)561 bits.append(1)
565 562
566 else:563 else:
567 if self.DEBUG == True:564 if self.DEBUG == True:
568 print 'Bit %s is present !!!' % (c * 8 + d - 1)565 print ('Bit %s is present !!!' % (c * 8 + d - 1))
569 566
570 bits.append(c * 8 + d - 1)567 bits.append(c * 8 + d - 1)
571 568
@@ -735,7 +732,7 @@
735 """732 """
736 733
737 for cont in range(0,128):734 for cont in range(0,128):
738 if self.BITMAP_VALUES[cont] <> self._BIT_DEFAULT_VALUE:735 if self.BITMAP_VALUES[cont] != self._BIT_DEFAULT_VALUE:
739 print("Bit[%s] of type %s has limit %s = %s"%(cont,self.getBitType(cont),self.getBitLimit(cont), self.BITMAP_VALUES[cont]) )736 print("Bit[%s] of type %s has limit %s = %s"%(cont,self.getBitType(cont),self.getBitLimit(cont), self.BITMAP_VALUES[cont]) )
740 737
741 738
@@ -777,7 +774,7 @@
777 iso.setBit(17,17)774 iso.setBit(17,17)
778 iso.setBit(99,99)775 iso.setBit(99,99)
779 str = iso.getRawIso()776 str = iso.getRawIso()
780 print 'This is the ASCII package %s' % str 777 print ('This is the ASCII package %s' % str)
781 output (print) -> This is the ASCII package 0800d010800000000000000000002000000001200000000000400001200170299778 output (print) -> This is the ASCII package 0800d010800000000000000000002000000001200000000000400001200170299
782 779
783 @return: str with complete ASCII ISO8583780 @return: str with complete ASCII ISO8583
@@ -795,7 +792,7 @@
795 resp += self.BITMAP_HEX792 resp += self.BITMAP_HEX
796 793
797 for cont in range(0,128):794 for cont in range(0,128):
798 if self.BITMAP_VALUES[cont] <> self._BIT_DEFAULT_VALUE:795 if self.BITMAP_VALUES[cont] != self._BIT_DEFAULT_VALUE:
799 resp = "%s%s"%(resp, self.BITMAP_VALUES[cont]) 796 resp = "%s%s"%(resp, self.BITMAP_VALUES[cont])
800 797
801 return resp798 return resp
@@ -822,7 +819,7 @@
822 """819 """
823 820
824 if self.DEBUG == True:821 if self.DEBUG == True:
825 print 'Trying to redefine the bit with (self,%s,%s,%s,%s,%s,%s)' % (bit, smallStr, largeStr, bitType, size, valueType)822 print ('Trying to redefine the bit with (self,%s,%s,%s,%s,%s,%s)' % (bit, smallStr, largeStr, bitType, size, valueType))
826 823
827 #validating bit position824 #validating bit position
828 if bit == 1 or bit == 64 or bit < 0 or bit > 128:825 if bit == 1 or bit == 64 or bit < 0 or bit > 128:
@@ -831,10 +828,10 @@
831 #need to validate if the type and size is compatible! example slimit = 100 and type = LL828 #need to validate if the type and size is compatible! example slimit = 100 and type = LL
832 829
833 if bitType == "B" or bitType == "N" or bitType == "AN" or bitType == "ANS" or bitType == "LL" or bitType == "LLL":830 if bitType == "B" or bitType == "N" or bitType == "AN" or bitType == "ANS" or bitType == "LL" or bitType == "LLL":
834 if valueType == "a" or valueType == "n" or valueType == "ansb" or valueType == "ans" or valueType == "b" :831 if valueType == "a" or valueType == "n" or valueType == "ansb" or valueType == "ans" or valueType == "b" or valueType == "an" :
835 self._BITS_VALUE_TYPE[bit] = [smallStr, largeStr, bitType, size, valueType]832 self._BITS_VALUE_TYPE[bit] = [smallStr, largeStr, bitType, size, valueType]
836 if self.DEBUG == True:833 if self.DEBUG == True:
837 print 'Bit %d redefined!' % bit834 print ('Bit %d redefined!' % bit)
838 835
839 else:836 else:
840 raise InvalidValueType("Error bit %d cannot be changed because %s is not a valid valueType (a, an, n ansb, b)!" % (bit,valueType))837 raise InvalidValueType("Error bit %d cannot be changed because %s is not a valid valueType (a, an, n ansb, b)!" % (bit,valueType))
@@ -855,7 +852,7 @@
855 self.MESSAGE_TYPE_INDICATION = iso[0:4]852 self.MESSAGE_TYPE_INDICATION = iso[0:4]
856 853
857 if self.DEBUG == True:854 if self.DEBUG == True:
858 print 'MTI found was %s' % self.MESSAGE_TYPE_INDICATION855 print ('MTI found was %s' % self.MESSAGE_TYPE_INDICATION)
859 856
860 857
861 ################################################################################################858 ################################################################################################
@@ -907,40 +904,40 @@
907 """904 """
908 905
909 if self.DEBUG == True:906 if self.DEBUG == True:
910 print 'This is the input string <%s>' % strWithoutMtiBitmap907 print ('This is the input string <%s>' % strWithoutMtiBitmap)
911 908
912 offset = 0;909 offset = 0;
913 # jump bit 1 because it was alread defined in the "__inicializeBitsFromBitmapStr"910 # jump bit 1 because it was alread defined in the "__inicializeBitsFromBitmapStr"
914 for cont in range(2,128):911 for cont in range(2,128):
915 if self.BITMAP_VALUES[cont] <> self._BIT_DEFAULT_VALUE:912 if self.BITMAP_VALUES[cont] != self._BIT_DEFAULT_VALUE:
916 if self.DEBUG == True:913 if self.DEBUG == True:
917 print 'String = %s offset = %s bit = %s' % (strWithoutMtiBitmap[offset:],offset,cont)914 print ('String = %s offset = %s bit = %s' % (strWithoutMtiBitmap[offset:],offset,cont))
918 915
919 if self.getBitType(cont) == 'LL':916 if self.getBitType(cont) == 'LL':
920 valueSize = int(strWithoutMtiBitmap[offset:offset +2])917 valueSize = int(strWithoutMtiBitmap[offset:offset +2])
921 if self.DEBUG == True:918 if self.DEBUG == True:
922 print 'Size of the message in LL = %s' %valueSize919 print ('Size of the message in LL = %s' %valueSize)
923 920
924 if valueSize > self.getBitLimit(cont):921 if valueSize > self.getBitLimit(cont):
925 raise ValueToLarge("This bit is larger than the especification!")922 raise ValueToLarge("This bit is larger than the especification!")
926 self.BITMAP_VALUES[cont] = strWithoutMtiBitmap[offset:offset+2] + strWithoutMtiBitmap[offset+2:offset+2+valueSize]923 self.BITMAP_VALUES[cont] = strWithoutMtiBitmap[offset:offset+2] + strWithoutMtiBitmap[offset+2:offset+2+valueSize]
927 924
928 if self.DEBUG == True:925 if self.DEBUG == True:
929 print '\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont])926 print ('\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont]))
930 927
931 offset += valueSize + 2928 offset += valueSize + 2
932 929
933 if self.getBitType(cont) == 'LLL':930 if self.getBitType(cont) == 'LLL':
934 valueSize = int(strWithoutMtiBitmap[offset:offset +3])931 valueSize = int(strWithoutMtiBitmap[offset:offset +3])
935 if self.DEBUG == True:932 if self.DEBUG == True:
936 print 'Size of the message in LLL = %s' %valueSize933 print ('Size of the message in LLL = %s' %valueSize)
937 934
938 if valueSize > self.getBitLimit(cont):935 if valueSize > self.getBitLimit(cont):
939 raise ValueToLarge("This bit is larger than the especification!")936 raise ValueToLarge("This bit is larger than the especification!")
940 self.BITMAP_VALUES[cont] = strWithoutMtiBitmap[offset:offset+3] + strWithoutMtiBitmap[offset+3:offset+3+valueSize]937 self.BITMAP_VALUES[cont] = strWithoutMtiBitmap[offset:offset+3] + strWithoutMtiBitmap[offset+3:offset+3+valueSize]
941 938
942 if self.DEBUG == True:939 if self.DEBUG == True:
943 print '\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont])940 print ('\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont]))
944 941
945 offset += valueSize + 3 942 offset += valueSize + 3
946 943
@@ -951,11 +948,11 @@
951 # self.BITMAP_VALUES[cont] = '(' + strWithoutMtiBitmap[offset:offset+4] + ')' + strWithoutMtiBitmap[offset+4:offset+4+valueSize]948 # self.BITMAP_VALUES[cont] = '(' + strWithoutMtiBitmap[offset:offset+4] + ')' + strWithoutMtiBitmap[offset+4:offset+4+valueSize]
952 # offset += valueSize + 4 949 # offset += valueSize + 4
953 950
954 if self.getBitType(cont) == 'N' or self.getBitType(cont) == 'A' or self.getBitType(cont) == 'ANS':951 if self.getBitType(cont) == 'N' or self.getBitType(cont) == 'A' or self.getBitType(cont) == 'ANS' or self.getBitType(cont) == 'B' or self.getBitType(cont) == 'AN' :
955 self.BITMAP_VALUES[cont] = strWithoutMtiBitmap[offset:self.getBitLimit(cont)+offset]952 self.BITMAP_VALUES[cont] = strWithoutMtiBitmap[offset:self.getBitLimit(cont)+offset]
956 953
957 if self.DEBUG == True:954 if self.DEBUG == True:
958 print '\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont])955 print ('\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont]))
959 956
960 offset += self.getBitLimit(cont)957 offset += self.getBitLimit(cont)
961958
@@ -979,7 +976,7 @@
979 print 'This ISO has bits:'976 print 'This ISO has bits:'
980 v3 = i2.getBitsAndValues()977 v3 = i2.getBitsAndValues()
981 for v in v3:978 for v in v3:
982 print 'Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value'])979 print ('Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value']))
983 980
984 @param: str -> complete ISO8583 string981 @param: str -> complete ISO8583 string
985 @raise: InvalidIso8583 Exception982 @raise: InvalidIso8583 Exception
@@ -987,18 +984,18 @@
987 if len(iso) < 20:984 if len(iso) < 20:
988 raise InvalidIso8583('This is not a valid iso!!')985 raise InvalidIso8583('This is not a valid iso!!')
989 if self.DEBUG == True:986 if self.DEBUG == True:
990 print 'ASCII to process <%s>' % iso987 print ('ASCII to process <%s>' % iso)
991 988
992 self.__setMTIFromStr(iso)989 self.__setMTIFromStr(iso)
993 isoT = iso[4:]990 isoT = iso[4:]
994 self.__getBitmapFromStr(isoT)991 self.__getBitmapFromStr(isoT)
995 self.__inicializeBitsFromBitmapStr(self.BITMAP_HEX)992 self.__inicializeBitsFromBitmapStr(self.BITMAP_HEX)
996 if self.DEBUG == True:993 if self.DEBUG == True:
997 print 'This is the array of bits (before) %s ' % self.BITMAP_VALUES994 print ('This is the array of bits (before) %s ' % self.BITMAP_VALUES)
998 995
999 self.__getBitFromStr(iso[4+len(self.BITMAP_HEX):]) 996 self.__getBitFromStr(iso[4+len(self.BITMAP_HEX):])
1000 if self.DEBUG == True:997 if self.DEBUG == True:
1001 print 'This is the array of bits (after) %s ' % self.BITMAP_VALUES998 print ('This is the array of bits (after) %s ' % self.BITMAP_VALUES)
1002 999
1003 1000
1004 ################################################################################################1001 ################################################################################################
@@ -1024,9 +1021,9 @@
10241021
1025 print 'Is equivalent?'1022 print 'Is equivalent?'
1026 if p1 == p1:1023 if p1 == p1:
1027 print 'Yes :)'1024 print ('Yes :)')
1028 else:1025 else:
1029 print 'Noooooooooo :('1026 print ('Noooooooooo :(')
1030 1027
1031 @param: obj2 -> object that will be compared1028 @param: obj2 -> object that will be compared
1032 @return: <0 if is not equal, 0 if is equal1029 @return: <0 if is not equal, 0 if is equal
@@ -1059,13 +1056,13 @@
1059 1056
1060 v1 = p1.getBitsAndValues()1057 v1 = p1.getBitsAndValues()
1061 for v in v1:1058 for v in v1:
1062 print 'Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value'])1059 print ('Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value']))
1063 1060
1064 @return: array of values.1061 @return: array of values.
1065 """1062 """
1066 ret = []1063 ret = []
1067 for cont in range(2,128):1064 for cont in range(2,128):
1068 if self.BITMAP_VALUES[cont] <> self._BIT_DEFAULT_VALUE:1065 if self.BITMAP_VALUES[cont] != self._BIT_DEFAULT_VALUE:
1069 _TMP = {}1066 _TMP = {}
1070 _TMP['bit'] = "%d" % cont1067 _TMP['bit'] = "%d" % cont
1071 _TMP['type'] = self.getBitType(cont)1068 _TMP['type'] = self.getBitType(cont)
@@ -1091,7 +1088,7 @@
1091 arr = self.__getBitsFromBitmap()1088 arr = self.__getBitsFromBitmap()
1092 1089
1093 if self.DEBUG == True:1090 if self.DEBUG == True:
1094 print 'This is the array of bits inside the bitmap %s' % arr1091 print ('This is the array of bits inside the bitmap %s' % arr)
1095 1092
1096 for v in arr:1093 for v in arr:
1097 if v == bit:1094 if v == bit:
@@ -1124,7 +1121,7 @@
1124 netIso += ascii1121 netIso += ascii
1125 # Example: big-endian1122 # Example: big-endian
1126 # To little-endian, replace 'iso.getNetworkISO()' with 'iso.getNetworkISO(False)'1123 # To little-endian, replace 'iso.getNetworkISO()' with 'iso.getNetworkISO(False)'
1127 print 'This <%s> the same that <%s>' % (iso.getNetworkISO(),netIso)1124 print ('This <%s> the same that <%s>' % (iso.getNetworkISO(),netIso))
1128 1125
1129 @param: bigEndian (True|False) -> if you want that the size be represented in this way. 1126 @param: bigEndian (True|False) -> if you want that the size be represented in this way.
1130 @return: size + ASCII ISO8583 package ready to go to the network!1127 @return: size + ASCII ISO8583 package ready to go to the network!
@@ -1137,11 +1134,11 @@
1137 if bigEndian:1134 if bigEndian:
1138 netIso = struct.pack('!h',len(asciiIso))1135 netIso = struct.pack('!h',len(asciiIso))
1139 if self.DEBUG == True:1136 if self.DEBUG == True:
1140 print 'Pack Big-endian'1137 print ('Pack Big-endian')
1141 else:1138 else:
1142 netIso = struct.pack('<h',len(asciiIso))1139 netIso = struct.pack('<h',len(asciiIso))
1143 if self.DEBUG == True:1140 if self.DEBUG == True:
1144 print 'Pack Little-endian'1141 print ('Pack Little-endian')
11451142
1146 netIso += asciiIso1143 netIso += asciiIso
1147 1144
@@ -1174,7 +1171,7 @@
1174 #newIso.setIsoContent(netIso[2:size])1171 #newIso.setIsoContent(netIso[2:size])
1175 arr = newIso.getBitsAndValues()1172 arr = newIso.getBitsAndValues()
1176 for v in arr:1173 for v in arr:
1177 print 'Bit %s Type %s Value = %s' % (v['bit'],v['type'],v['value'])1174 print ('Bit %s Type %s Value = %s' % (v['bit'],v['type'],v['value']))
1178 1175
1179 @param: iso -> str that represents size + ASCII ISO8583 package1176 @param: iso -> str that represents size + ASCII ISO8583 package
1180 @param: bigEndian (True|False) -> Codification of the size.1177 @param: bigEndian (True|False) -> Codification of the size.
@@ -1188,11 +1185,11 @@
1188 if bigEndian:1185 if bigEndian:
1189 size = struct.unpack('!h',size)1186 size = struct.unpack('!h',size)
1190 if self.DEBUG == True:1187 if self.DEBUG == True:
1191 print 'Unpack Big-endian'1188 print ('Unpack Big-endian')
1192 else:1189 else:
1193 size = struct.unpack('<h',size)1190 size = struct.unpack('<h',size)
1194 if self.DEBUG == True:1191 if self.DEBUG == True:
1195 print 'Unpack Little-endian'1192 print ('Unpack Little-endian')
1196 1193
1197 if len(iso) != (size[0] + 2):1194 if len(iso) != (size[0] + 2):
1198 raise InvalidIso8583('This is not a valid iso!!The ISO8583 ASCII(%s) is less than the size %s!' % (len(iso[2:]),size[0]))1195 raise InvalidIso8583('This is not a valid iso!!The ISO8583 ASCII(%s) is less than the size %s!' % (len(iso[2:]),size[0]))
11991196
=== modified file 'PKG-INFO'
--- PKG-INFO 2009-08-27 15:34:49 +0000
+++ PKG-INFO 2012-07-25 06:33:20 +0000
@@ -1,6 +1,6 @@
1Metadata-Version: 1.01Metadata-Version: 1.0
2Name: ISO8583 Module2Name: ISO8583 Module
3Version: 1.13Version: 1.2
4Summary: ISO8583 LIBRARY4Summary: ISO8583 LIBRARY
5Home-page: http://www.vulcanno.com.br/python5Home-page: http://www.vulcanno.com.br/python
6Author: Igor V. Custodio6Author: Igor V. Custodio
77
=== added file 'TODO'
--- TODO 1970-01-01 00:00:00 +0000
+++ TODO 2012-07-25 06:33:20 +0000
@@ -0,0 +1,74 @@
1Add:
2
3 - create a unsetBit(bitNumber) method to delete a value of a bit inside the object
4
5 - create a ISO8583Util Class that give some util method like:
6 - intToBCD
7 - BCDToInt
8 - getTimeGMT (to bit 12)
9 - GetDateType (to bit 13)
10
11Fix:
12
13 - ...
14
15Think about:
16
17 - Improve ... improve ... improve
18
19 - Add support to "BCD" sizes in LL LLL types.
20 ASCII LL size and ASCII value inside '123456' -> '06123456'
21 BCD LL size and ASCII value inside '123456' -> '\x06' + '123456'
22 ASCII LLL size and ASCII value inside '123456' -> '006123456'
23 BCD LLL size and ASCII value inside '123456' -> '\x00\x06' + '123456'
24
25 - Improve support to "binary" data
26 i.setBit(3,'\x00\x01\x02')
27
28 - Make sense setBit(1,'xxx') ?
29 Maybe the dialet need to have the 2º bitmap inside with no value because it's automatic that 2º be present when bit large than 64 is inside...
30 But .. Today work :) by the way ... xxx is ignored...
31
32 - It's important separate the size and the value of LL and LLL types?
33 Example, bit 2 is LL:
34 Today -> i.setBit(2,'123') -> i.getBit(2) -> 03123
35 Think -> i.setBit(2,'123') -> i.getBit(2) -> 123
36 It was build in this way because the size can be important in some cases, but we can determine the size len(i.getBit(2)) ...
37 If the partner send a ISO8583 with wrong size?
38
39 - Make a XML builder that convert a ISO8583 to a XML object and a XML to ISO8583...
40 <ISO8583>
41 <mti>0200</mti>
42 <bitmap>600000000000000</bitmap>
43 <bits>
44 <bit>
45 <number>2</number>
46 <value>03123</value>
47 <type>LL</type>
48 </bit>
49 <bit>
50 <number>3</number>
51 <value>300000</value>
52 <type>N</type>
53 </bit>
54 </bits>
55 </ISO8583>
56
57 - Use log4Python to improve debug information
58
59 - Support Python V3
60
61 - Improve errors:
62 - validate values
63
64 - Improve the package name / structure
65 - today: FROM ISO8583.ISO8583 import ISO8583
66 - future: FROM iso8583 import ISO8583
67
68 - Create more examples
69
70 - Create benchmarks with JPOS
71
72 - Support EBCDIC ...
73
74 - ...
0\ No newline at end of file75\ No newline at end of file
176
=== modified file 'debian/changelog'
--- debian/changelog 2009-08-27 15:34:49 +0000
+++ debian/changelog 2012-07-25 06:33:20 +0000
@@ -1,3 +1,12 @@
1python-iso8583 (1.2-0ubuntu1) quantal; urgency=low
2
3 * New upstream release.
4 * debian/rules: Update build structure to satisfy Lintian.
5 * Bump Standards-Version to 3.9.3.
6 * Add ${misc:Depends} to python-iso8583 binary.
7
8 -- Logan Rosen <logatronico@gmail.com> Wed, 25 Jul 2012 02:25:14 -0400
9
1python-iso8583 (1.1-1) unstable; urgency=low10python-iso8583 (1.1-1) unstable; urgency=low
211
3 * Initial release (Closes: #539097)12 * Initial release (Closes: #539097)
413
=== modified file 'debian/control'
--- debian/control 2009-08-27 15:34:49 +0000
+++ debian/control 2012-07-25 06:33:20 +0000
@@ -1,11 +1,12 @@
1Source: python-iso85831Source: python-iso8583
2Section: python2Section: python
3Priority: optional3Priority: optional
4Maintainer: Mauro Lizaur <mauro@cacavoladora.org>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5XSBC-Original-Maintainer: Mauro Lizaur <mauro@cacavoladora.org>
5Uploaders: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>6Uploaders: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
6Build-Depends: debhelper (>= 7)7Build-Depends: debhelper (>= 7)
7Build-Depends-Indep: python (>= 2.4), python-setuptools, python-support (>= 0.6.4)8Build-Depends-Indep: python (>= 2.4), python-setuptools, python-support (>= 0.6.4)
8Standards-Version: 3.8.39Standards-Version: 3.9.3
9Vcs-Svn: svn://svn.debian.org/python-modules/packages/python-iso8583/trunk10Vcs-Svn: svn://svn.debian.org/python-modules/packages/python-iso8583/trunk
10Vcs-Browser: http://svn.debian.org/wsvn/python-modules/packages/python-iso8583/trunk/?op=log11Vcs-Browser: http://svn.debian.org/wsvn/python-modules/packages/python-iso8583/trunk/?op=log
11Homepage: http://code.google.com/p/iso8583py/12Homepage: http://code.google.com/p/iso8583py/
@@ -13,7 +14,7 @@
1314
14Package: python-iso858315Package: python-iso8583
15Architecture: all16Architecture: all
16Depends: ${python:Depends}17Depends: ${python:Depends}, ${misc:Depends}
17Description: library for ISO 8583 transactions18Description: library for ISO 8583 transactions
18 This library provides a pure Python interface for electronic19 This library provides a pure Python interface for electronic
19 transactions using ISO 8583 ("Standard for Financial Transaction20 transactions using ISO 8583 ("Standard for Financial Transaction
2021
=== modified file 'debian/rules'
--- debian/rules 2009-08-27 15:34:49 +0000
+++ debian/rules 2012-07-25 06:33:20 +0000
@@ -6,7 +6,9 @@
6PYVERS=$(shell pyversions -r)6PYVERS=$(shell pyversions -r)
7d=debian/python-iso85837d=debian/python-iso8583
88
9build: build-stamp9build: build-arch build-indep
10build-arch: build-stamp
11build-indep: build-stamp
1012
11build-stamp: 13build-stamp:
12 dh_testdir14 dh_testdir
1315
=== modified file 'doc/ISO8583.ISO8583.html'
--- doc/ISO8583.ISO8583.html 2009-08-27 15:34:49 +0000
+++ doc/ISO8583.ISO8583.html 2012-07-25 06:33:20 +0000
@@ -6,7 +6,7 @@
6<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">6<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
7<tr bgcolor="#7799ee">7<tr bgcolor="#7799ee">
8<td valign=bottom>&nbsp;<br>8<td valign=bottom>&nbsp;<br>
9<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="ISO8583.html"><font color="#ffffff">ISO8583</font></a>.ISO8583</strong></big></big> (version 0.2)</font></td9<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="ISO8583.html"><font color="#ffffff">ISO8583</font></a>.ISO8583</strong></big></big> (version 1.2)</font></td
10><td align=right valign=bottom10><td align=right valign=bottom
11><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///C|/python25/lib/site-packages/iso8583/iso8583.py">c:\python25\lib\site-packages\iso8583\iso8583.py</a></font></td></tr></table>11><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///C|/python25/lib/site-packages/iso8583/iso8583.py">c:\python25\lib\site-packages\iso8583\iso8583.py</a></font></td></tr></table>
12 <p><tt>(C)&nbsp;Copyright&nbsp;2009&nbsp;Igor&nbsp;V.&nbsp;Custodio<br>12 <p><tt>(C)&nbsp;Copyright&nbsp;2009&nbsp;Igor&nbsp;V.&nbsp;Custodio<br>
@@ -48,7 +48,39 @@
48<font color="#000000" face="helvetica, arial"><a name="ISO8583">class <strong>ISO8583</strong></a></font></td></tr>48<font color="#000000" face="helvetica, arial"><a name="ISO8583">class <strong>ISO8583</strong></a></font></td></tr>
49 49
50<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>50<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
51<td colspan=2><tt>Main&nbsp;Class&nbsp;to&nbsp;work&nbsp;with&nbsp;<a href="#ISO8583">ISO8583</a>&nbsp;packages.<br>&nbsp;</tt></td></tr>51<td colspan=2><tt>Main&nbsp;Class&nbsp;to&nbsp;work&nbsp;with&nbsp;<a href="#ISO8583">ISO8583</a>&nbsp;packages.<br>
52Used&nbsp;to&nbsp;create,&nbsp;change,&nbsp;send,&nbsp;receive,&nbsp;parse&nbsp;or&nbsp;work&nbsp;with&nbsp;ISO8593&nbsp;Package&nbsp;version&nbsp;1993.<br>
53It's&nbsp;100%&nbsp;Python&nbsp;:)<br>
54Enjoy&nbsp;it!<br>
55Thanks&nbsp;to:&nbsp;Vulcanno&nbsp;IT&nbsp;Solutions&nbsp;&lt;<a href="http://www.vulcanno.com.br">http://www.vulcanno.com.br</a>&gt;<br>
56Licence:&nbsp;GPL&nbsp;Version&nbsp;3<br>
57More&nbsp;information:&nbsp;<a href="http://code.google.com/p/iso8583py/">http://code.google.com/p/iso8583py/</a><br>
58&nbsp;<br>
59Example:<br>
60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;<a href="#ISO8583">ISO8583</a>.<a href="#ISO8583">ISO8583</a>&nbsp;import&nbsp;<a href="#ISO8583">ISO8583</a><br>
61&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;<a href="#ISO8583">ISO8583</a>.ISOErrors&nbsp;import&nbsp;*<br>
62&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
63&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iso&nbsp;=&nbsp;<a href="#ISO8583">ISO8583</a>()<br>
64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try:<br>
65&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iso.<a href="#ISO8583-setMTI">setMTI</a>('0800')<br>
66&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iso.<a href="#ISO8583-setBit">setBit</a>(2,2)<br>
67&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iso.<a href="#ISO8583-setBit">setBit</a>(4,4)<br>
68&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iso.<a href="#ISO8583-setBit">setBit</a>(12,12)<br>
69&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iso.<a href="#ISO8583-setBit">setBit</a>(21,21)<br>
70&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iso.<a href="#ISO8583-setBit">setBit</a>(17,17)<br>
71&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iso.<a href="#ISO8583-setBit">setBit</a>(49,986)<br>
72&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iso.<a href="#ISO8583-setBit">setBit</a>(99,99)<br>
73&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;except&nbsp;ValueToLarge,&nbsp;e:<br>
74&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('Value&nbsp;too&nbsp;large&nbsp;:(&nbsp;%s'&nbsp;%&nbsp;e)<br>
75&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;except&nbsp;InvalidMTI,&nbsp;i:<br>
76&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('This&nbsp;MTI&nbsp;is&nbsp;wrong&nbsp;:(&nbsp;%s'&nbsp;%&nbsp;i)<br>
77&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
78&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('The&nbsp;Message&nbsp;Type&nbsp;Indication&nbsp;is&nbsp;=&nbsp;%s'&nbsp;%iso.<a href="#ISO8583-getMTI">getMTI</a>())&nbsp;<br>
79&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('The&nbsp;Bitmap&nbsp;is&nbsp;=&nbsp;%s'&nbsp;%iso.<a href="#ISO8583-getBitmap">getBitmap</a>())&nbsp;<br>
81&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iso.<a href="#ISO8583-showIsoBits">showIsoBits</a>();<br>
82&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('This&nbsp;is&nbsp;the&nbsp;<a href="#ISO8583">ISO8583</a>&nbsp;complete&nbsp;package&nbsp;%s'&nbsp;%&nbsp;iso.<a href="#ISO8583-getRawIso">getRawIso</a>())<br>
83&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('This&nbsp;is&nbsp;the&nbsp;<a href="#ISO8583">ISO8583</a>&nbsp;complete&nbsp;package&nbsp;to&nbsp;sent&nbsp;over&nbsp;the&nbsp;TCPIP&nbsp;network&nbsp;%s'&nbsp;%&nbsp;iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>())<br>&nbsp;</tt></td></tr>
52<tr><td>&nbsp;</td>84<tr><td>&nbsp;</td>
53<td width="100%">Methods defined here:<br>85<td width="100%">Methods defined here:<br>
54<dl><dt><a name="ISO8583-__cmp__"><strong>__cmp__</strong></a>(self, obj2)</dt><dd><tt>Method&nbsp;that&nbsp;compare&nbsp;two&nbsp;objects&nbsp;in&nbsp;"==",&nbsp;"!="&nbsp;and&nbsp;other&nbsp;things<br>86<dl><dt><a name="ISO8583-__cmp__"><strong>__cmp__</strong></a>(self, obj2)</dt><dd><tt>Method&nbsp;that&nbsp;compare&nbsp;two&nbsp;objects&nbsp;in&nbsp;"==",&nbsp;"!="&nbsp;and&nbsp;other&nbsp;things<br>
@@ -69,9 +101,9 @@
69&nbsp;<br>101&nbsp;<br>
70&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;'Is&nbsp;equivalent?'<br>102&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;'Is&nbsp;equivalent?'<br>
71&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;p1&nbsp;==&nbsp;p1:<br>103&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;p1&nbsp;==&nbsp;p1:<br>
72&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;'Yes&nbsp;:)'<br>104&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('Yes&nbsp;:)')<br>
73&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:<br>105&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:<br>
74&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;'Noooooooooo&nbsp;:('<br>106&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('Noooooooooo&nbsp;:(')<br>
75&nbsp;<br>107&nbsp;<br>
76@param:&nbsp;obj2&nbsp;-&gt;&nbsp;object&nbsp;that&nbsp;will&nbsp;be&nbsp;compared<br>108@param:&nbsp;obj2&nbsp;-&gt;&nbsp;object&nbsp;that&nbsp;will&nbsp;be&nbsp;compared<br>
77@return:&nbsp;&lt;0&nbsp;if&nbsp;is&nbsp;not&nbsp;equal,&nbsp;0&nbsp;if&nbsp;is&nbsp;equal</tt></dd></dl>109@return:&nbsp;&lt;0&nbsp;if&nbsp;is&nbsp;not&nbsp;equal,&nbsp;0&nbsp;if&nbsp;is&nbsp;equal</tt></dd></dl>
@@ -120,7 +152,7 @@
120&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>152&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
121&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v1&nbsp;=&nbsp;p1.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br>153&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v1&nbsp;=&nbsp;p1.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br>
122&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;v&nbsp;in&nbsp;v1:<br>154&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;v&nbsp;in&nbsp;v1:<br>
123&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;'Bit&nbsp;%s&nbsp;of&nbsp;type&nbsp;%s&nbsp;with&nbsp;value&nbsp;=&nbsp;%s'&nbsp;%&nbsp;(v['bit'],v['type'],v['value'])<br>155&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('Bit&nbsp;%s&nbsp;of&nbsp;type&nbsp;%s&nbsp;with&nbsp;value&nbsp;=&nbsp;%s'&nbsp;%&nbsp;(v['bit'],v['type'],v['value']))<br>
124&nbsp;<br>156&nbsp;<br>
125@return:&nbsp;array&nbsp;of&nbsp;values.</tt></dd></dl>157@return:&nbsp;array&nbsp;of&nbsp;values.</tt></dd></dl>
126158
@@ -146,7 +178,7 @@
146&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;netIso&nbsp;+=&nbsp;ascii<br>178&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;netIso&nbsp;+=&nbsp;ascii<br>
147&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Example:&nbsp;big-endian<br>179&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Example:&nbsp;big-endian<br>
148&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;To&nbsp;little-endian,&nbsp;replace&nbsp;'iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>()'&nbsp;with&nbsp;'iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>(False)'<br>180&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;To&nbsp;little-endian,&nbsp;replace&nbsp;'iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>()'&nbsp;with&nbsp;'iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>(False)'<br>
149&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;'This&nbsp;&lt;%s&gt;&nbsp;the&nbsp;same&nbsp;that&nbsp;&lt;%s&gt;'&nbsp;%&nbsp;(iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>(),netIso)<br>181&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('This&nbsp;&lt;%s&gt;&nbsp;the&nbsp;same&nbsp;that&nbsp;&lt;%s&gt;'&nbsp;%&nbsp;(iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>(),netIso))<br>
150&nbsp;<br>182&nbsp;<br>
151@param:&nbsp;bigEndian&nbsp;(True|False)&nbsp;-&gt;&nbsp;if&nbsp;you&nbsp;want&nbsp;that&nbsp;the&nbsp;size&nbsp;be&nbsp;represented&nbsp;in&nbsp;this&nbsp;way.&nbsp;<br>183@param:&nbsp;bigEndian&nbsp;(True|False)&nbsp;-&gt;&nbsp;if&nbsp;you&nbsp;want&nbsp;that&nbsp;the&nbsp;size&nbsp;be&nbsp;represented&nbsp;in&nbsp;this&nbsp;way.&nbsp;<br>
152@return:&nbsp;size&nbsp;+&nbsp;ASCII&nbsp;<a href="#ISO8583">ISO8583</a>&nbsp;package&nbsp;ready&nbsp;to&nbsp;go&nbsp;to&nbsp;the&nbsp;network!<br>184@return:&nbsp;size&nbsp;+&nbsp;ASCII&nbsp;<a href="#ISO8583">ISO8583</a>&nbsp;package&nbsp;ready&nbsp;to&nbsp;go&nbsp;to&nbsp;the&nbsp;network!<br>
@@ -162,7 +194,7 @@
162iso.<a href="#ISO8583-setBit">setBit</a>(17,17)<br>194iso.<a href="#ISO8583-setBit">setBit</a>(17,17)<br>
163iso.<a href="#ISO8583-setBit">setBit</a>(99,99)<br>195iso.<a href="#ISO8583-setBit">setBit</a>(99,99)<br>
164str&nbsp;=&nbsp;iso.<a href="#ISO8583-getRawIso">getRawIso</a>()<br>196str&nbsp;=&nbsp;iso.<a href="#ISO8583-getRawIso">getRawIso</a>()<br>
165print&nbsp;'This&nbsp;is&nbsp;the&nbsp;ASCII&nbsp;package&nbsp;%s'&nbsp;%&nbsp;str&nbsp;<br>197print&nbsp;('This&nbsp;is&nbsp;the&nbsp;ASCII&nbsp;package&nbsp;%s'&nbsp;%&nbsp;str)&nbsp;<br>
166output&nbsp;(print)&nbsp;-&gt;&nbsp;This&nbsp;is&nbsp;the&nbsp;ASCII&nbsp;package&nbsp;0800d010800000000000000000002000000001200000000000400001200170299<br>198output&nbsp;(print)&nbsp;-&gt;&nbsp;This&nbsp;is&nbsp;the&nbsp;ASCII&nbsp;package&nbsp;0800d010800000000000000000002000000001200000000000400001200170299<br>
167&nbsp;<br>199&nbsp;<br>
168@return:&nbsp;str&nbsp;with&nbsp;complete&nbsp;ASCII&nbsp;<a href="#ISO8583">ISO8583</a><br>200@return:&nbsp;str&nbsp;with&nbsp;complete&nbsp;ASCII&nbsp;<a href="#ISO8583">ISO8583</a><br>
@@ -205,7 +237,7 @@
205&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;'This&nbsp;ISO&nbsp;has&nbsp;bits:'<br>237&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;'This&nbsp;ISO&nbsp;has&nbsp;bits:'<br>
206&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v3&nbsp;=&nbsp;i2.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br>238&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v3&nbsp;=&nbsp;i2.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br>
207&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;v&nbsp;in&nbsp;v3:<br>239&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;v&nbsp;in&nbsp;v3:<br>
208&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;'Bit&nbsp;%s&nbsp;of&nbsp;type&nbsp;%s&nbsp;with&nbsp;value&nbsp;=&nbsp;%s'&nbsp;%&nbsp;(v['bit'],v['type'],v['value'])<br>240&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('Bit&nbsp;%s&nbsp;of&nbsp;type&nbsp;%s&nbsp;with&nbsp;value&nbsp;=&nbsp;%s'&nbsp;%&nbsp;(v['bit'],v['type'],v['value']))<br>
209&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>241&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
210@param:&nbsp;str&nbsp;-&gt;&nbsp;complete&nbsp;<a href="#ISO8583">ISO8583</a>&nbsp;string<br>242@param:&nbsp;str&nbsp;-&gt;&nbsp;complete&nbsp;<a href="#ISO8583">ISO8583</a>&nbsp;string<br>
211@raise:&nbsp;InvalidIso8583&nbsp;Exception</tt></dd></dl>243@raise:&nbsp;InvalidIso8583&nbsp;Exception</tt></dd></dl>
@@ -236,7 +268,7 @@
236#newIso.<a href="#ISO8583-setIsoContent">setIsoContent</a>(netIso[2:size])<br>268#newIso.<a href="#ISO8583-setIsoContent">setIsoContent</a>(netIso[2:size])<br>
237arr&nbsp;=&nbsp;newIso.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br>269arr&nbsp;=&nbsp;newIso.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br>
238for&nbsp;v&nbsp;in&nbsp;arr:<br>270for&nbsp;v&nbsp;in&nbsp;arr:<br>
239&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;'Bit&nbsp;%s&nbsp;Type&nbsp;%s&nbsp;Value&nbsp;=&nbsp;%s'&nbsp;%&nbsp;(v['bit'],v['type'],v['value'])<br>271&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;('Bit&nbsp;%s&nbsp;Type&nbsp;%s&nbsp;Value&nbsp;=&nbsp;%s'&nbsp;%&nbsp;(v['bit'],v['type'],v['value']))<br>
240&nbsp;<br>272&nbsp;<br>
241@param:&nbsp;iso&nbsp;-&gt;&nbsp;str&nbsp;that&nbsp;represents&nbsp;size&nbsp;+&nbsp;ASCII&nbsp;<a href="#ISO8583">ISO8583</a>&nbsp;package<br>273@param:&nbsp;iso&nbsp;-&gt;&nbsp;str&nbsp;that&nbsp;represents&nbsp;size&nbsp;+&nbsp;ASCII&nbsp;<a href="#ISO8583">ISO8583</a>&nbsp;package<br>
242@param:&nbsp;bigEndian&nbsp;(True|False)&nbsp;-&gt;&nbsp;Codification&nbsp;of&nbsp;the&nbsp;size.<br>274@param:&nbsp;bigEndian&nbsp;(True|False)&nbsp;-&gt;&nbsp;Codification&nbsp;of&nbsp;the&nbsp;size.<br>
@@ -287,7 +319,7 @@
287<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>319<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
288<td width="100%"><strong>__author__</strong> = 'Igor Vitorio Custodio &lt;igorvc@vulcanno.com.br&gt;'<br>320<td width="100%"><strong>__author__</strong> = 'Igor Vitorio Custodio &lt;igorvc@vulcanno.com.br&gt;'<br>
289<strong>__licence__</strong> = 'GPL V3'<br>321<strong>__licence__</strong> = 'GPL V3'<br>
290<strong>__version__</strong> = '0.2'</td></tr></table><p>322<strong>__version__</strong> = '1.2'</td></tr></table><p>
291<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">323<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
292<tr bgcolor="#7799ee">324<tr bgcolor="#7799ee">
293<td colspan=3 valign=bottom>&nbsp;<br>325<td colspan=3 valign=bottom>&nbsp;<br>
294326
=== added file 'doc/index.html'
--- doc/index.html 1970-01-01 00:00:00 +0000
+++ doc/index.html 2012-07-25 06:33:20 +0000
@@ -0,0 +1,10 @@
1<html>
2<head>
3<title>One second ...</title>
4<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5<meta http-equiv="refresh" content="0;URL=ISO8583.html">
6</head>
7
8<body>
9</body>
10</html>
0\ No newline at end of file11\ No newline at end of file
112
=== modified file 'examples/echoClient.py'
--- examples/echoClient.py 2009-08-27 15:34:49 +0000
+++ examples/echoClient.py 2012-07-25 06:33:20 +0000
@@ -26,7 +26,7 @@
2626
2727
28# Configure the client28# Configure the client
29serverIP = "192.168.0.100" 29serverIP = "192.168.0.103"
30serverPort = 858330serverPort = 8583
31numberEcho = 531numberEcho = 5
32timeBetweenEcho = 5 # in seconds32timeBetweenEcho = 5 # in seconds
@@ -50,7 +50,7 @@
50 continue50 continue
51 break51 break
52if s is None:52if s is None:
53 print 'Could not connect :('53 print ('Could not connect :(')
54 sys.exit(1)54 sys.exit(1)
55 55
56 56
@@ -67,19 +67,19 @@
67 try:67 try:
68 message = iso.getNetworkISO() 68 message = iso.getNetworkISO()
69 s.send(message)69 s.send(message)
70 print 'Sending ... %s' % message70 print ('Sending ... %s' % message)
71 ans = s.recv(2048)71 ans = s.recv(2048)
72 print "\nInput ASCII |%s|" % ans72 print ("\nInput ASCII |%s|" % ans)
73 isoAns = ISO8583()73 isoAns = ISO8583()
74 isoAns.setNetworkISO(ans)74 isoAns.setNetworkISO(ans)
75 v1 = isoAns.getBitsAndValues()75 v1 = isoAns.getBitsAndValues()
76 for v in v1:76 for v in v1:
77 print 'Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value'])77 print ('Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value']))
78 78
79 if isoAns.getMTI() == '0810':79 if isoAns.getMTI() == '0810':
80 print "\tThat's great !!! The server understand my message !!!"80 print ("\tThat's great !!! The server understand my message !!!")
81 else:81 else:
82 print "The server dosen't understand my message!"82 print ("The server dosen't understand my message!")
83 83
84 except InvalidIso8583, ii:84 except InvalidIso8583, ii:
85 print ii85 print ii
@@ -92,19 +92,19 @@
92 try:92 try:
93 message = iso.getNetworkISO(False) 93 message = iso.getNetworkISO(False)
94 s.send(message)94 s.send(message)
95 print 'Sending ... %s' % message95 print ('Sending ... %s' % message)
96 ans = s.recv(2048)96 ans = s.recv(2048)
97 print "\nInput ASCII |%s|" % ans97 print ("\nInput ASCII |%s|" % ans)
98 isoAns = ISO8583()98 isoAns = ISO8583()
99 isoAns.setNetworkISO(ans,False)99 isoAns.setNetworkISO(ans,False)
100 v1 = isoAns.getBitsAndValues()100 v1 = isoAns.getBitsAndValues()
101 for v in v1:101 for v in v1:
102 print 'Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value'])102 print ('Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value']))
103 103
104 if isoAns.getMTI() == '0810':104 if isoAns.getMTI() == '0810':
105 print "\tThat's great !!! The server understand my message !!!"105 print ("\tThat's great !!! The server understand my message !!!")
106 else:106 else:
107 print "The server dosen't understand my message!"107 print ("The server dosen't understand my message!")
108 108
109 except InvalidIso8583, ii:109 except InvalidIso8583, ii:
110 print ii110 print ii
@@ -114,6 +114,6 @@
114114
115 115
116 116
117print 'Closing...' 117print ('Closing...')
118s.close() 118s.close()
119 119
120\ No newline at end of file120\ No newline at end of file
121121
=== modified file 'examples/echoServer.py'
--- examples/echoServer.py 2009-08-27 15:34:49 +0000
+++ examples/echoServer.py 2012-07-25 06:33:20 +0000
@@ -23,7 +23,7 @@
23from socket import *23from socket import *
2424
25# Configure the server25# Configure the server
26serverIP = "192.168.0.100" 26serverIP = "192.168.0.103"
27serverPort = 858327serverPort = 8583
28maxConn = 528maxConn = 5
29bigEndian = True29bigEndian = True
@@ -46,7 +46,7 @@
46 # receive message46 # receive message
47 isoStr = connection.recv(2048) 47 isoStr = connection.recv(2048)
48 if isoStr:48 if isoStr:
49 print "\nInput ASCII |%s|" % isoStr49 print ("\nInput ASCII |%s|" % isoStr)
50 pack = ISO8583()50 pack = ISO8583()
51 #parse the iso51 #parse the iso
52 try:52 try:
@@ -57,12 +57,12 @@
57 57
58 v1 = pack.getBitsAndValues()58 v1 = pack.getBitsAndValues()
59 for v in v1:59 for v in v1:
60 print 'Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value'])60 print ('Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value']))
61 61
62 if pack.getMTI() == '0800':62 if pack.getMTI() == '0800':
63 print "\tThat's great !!! The client send a correct message !!!"63 print ("\tThat's great !!! The client send a correct message !!!")
64 else:64 else:
65 print "The client dosen't send the correct message!" 65 print ("The client dosen't send the correct message!")
66 break66 break
67 67
68 68
@@ -70,7 +70,7 @@
70 print ii70 print ii
71 break71 break
72 except:72 except:
73 print 'Something happened!!!!'73 print ('Something happened!!!!')
74 break74 break
75 75
76 #send answer76 #send answer
@@ -81,11 +81,11 @@
81 else:81 else:
82 ans = pack.getNetworkISO(False)82 ans = pack.getNetworkISO(False)
83 83
84 print 'Sending answer %s' % ans84 print ('Sending answer %s' % ans)
85 connection.send(ans)85 connection.send(ans)
86 86
87 else:87 else:
88 break88 break
89 # close socket 89 # close socket
90 connection.close() 90 connection.close()
91 print "Closed..."
92\ No newline at end of file91\ No newline at end of file
92 print ("Closed...")
93\ No newline at end of file93\ No newline at end of file
9494
=== modified file 'examples/example1.py'
--- examples/example1.py 2009-08-27 15:34:49 +0000
+++ examples/example1.py 2012-07-25 06:33:20 +0000
@@ -29,13 +29,13 @@
29p = ISO8583()29p = ISO8583()
30#some string describing the transation type30#some string describing the transation type
31transation = "200"31transation = "200"
32print 'Setting transation type to %s' % transation32print ('Setting transation type to %s' % transation)
33p.setTransationType(transation)33p.setTransationType(transation)
34# Is the same that:34# Is the same that:
35#p.setMTI(transation)35#p.setMTI(transation)
3636
37#Some tests and 37#Some tests and
38print 'Setting bits'38print ('Setting bits')
3939
40p.setBit(3,"100000")40p.setBit(3,"100000")
41p.setBit(4,1200)41p.setBit(4,1200)
@@ -53,47 +53,47 @@
53try:53try:
54 p.setBit(126,"00000000000000105")54 p.setBit(126,"00000000000000105")
55except ValueToLarge:55except ValueToLarge:
56 print '\t\tSomething happening!!!! The Exception! So, bit 126 is not set!!!!'56 print ('\t\tSomething happening!!!! The Exception! So, bit 126 is not set!!!!')
57 #if want more information ...57 #if want more information ...
58 #traceback.print_exc()58 #traceback.print_exc()
5959
60#show hex bitmap60#show hex bitmap
61print 'Bitmap in HEX'61print ('Bitmap in HEX')
62p.showBitmap()62p.showBitmap()
6363
64#Show bits64#Show bits
65print 'Bits with values'65print ('Bits with values')
66p.showIsoBits()66p.showIsoBits()
6767
68# Show raw ASCII ISO68# Show raw ASCII ISO
69print 'The package is -> '69print ('The package is -> ')
70p.showRawIso()70p.showRawIso()
7171
72# Getting bits...72# Getting bits...
73print '\n\n\n------------------------------------------\n'73print ('\n\n\n------------------------------------------\n')
7474
75print 'Getting bits'75print ('Getting bits')
76try:76try:
77 print 'Bit 7 is there? %s' % p.getBit(7)77 print ('Bit 7 is there? %s' % p.getBit(7))
78 print 'Bit 32 is there? %s' % p.getBit(32)78 print ('Bit 32 is there? %s' % p.getBit(32))
79except:79except:
80 print 'Something is bad...'80 print ('Something is bad...')
81 81
82# Testing exceptions... 82# Testing exceptions...
83try:83try:
84 print 'Bit 45 is there? %s' % p.getBit(45)84 print ('Bit 45 is there? %s' % p.getBit(45))
85except:85except:
86 print "No, this bit is not there :)" 86 print ("No, this bit is not there :)")
8787
88try:88try:
89 print 'Bit 27 is there? %s' % p.getBit(27)89 print ('Bit 27 is there? %s' % p.getBit(27))
90except BitNotSet, bns:90except BitNotSet, bns:
91 print bns 91 print bns
92 92
9393
94#More exceptions... 94#More exceptions...
95print '\n\n\n------------------------------------------\n'95print ('\n\n\n------------------------------------------\n')
96print 'Exeptions....'96print ('Exceptions....')
9797
98iso = ISO8583()98iso = ISO8583()
99try:99try:
@@ -106,9 +106,9 @@
106 iso.setBit(49,9861) # this bit is wrong ...106 iso.setBit(49,9861) # this bit is wrong ...
107 iso.setBit(99,99)107 iso.setBit(99,99)
108except ValueToLarge, e:108except ValueToLarge, e:
109 print 'Value too large :( %s' % e109 print ('Value too large :( %s' % e)
110except InvalidMTI, i:110except InvalidMTI, i:
111 print 'This MTI is wrong :( %s' % i111 print ('This MTI is wrong :( %s' % i)
112112
113113
114114
115115
=== modified file 'examples/example2.py'
--- examples/example2.py 2009-08-27 15:34:49 +0000
+++ examples/example2.py 2012-07-25 06:33:20 +0000
@@ -35,8 +35,8 @@
35p2.setBit(17,17)35p2.setBit(17,17)
36p2.setBit(99,99)36p2.setBit(99,99)
3737
38print 'The MTI is = %s' %p2.getMTI() 38print ('The MTI is = %s' %p2.getMTI())
39print 'The Bitmap is = %s' %p2.getBitmap() 39print ('The Bitmap is = %s' %p2.getBitmap())
4040
41#Showing bits...41#Showing bits...
42p2.showIsoBits();42p2.showIsoBits();
@@ -44,8 +44,8 @@
44#Save the ASCII ISO value without size44#Save the ASCII ISO value without size
45iso = p2.getRawIso()45iso = p2.getRawIso()
4646
47print '\n\n\n------------------------------------------\n'47print ('\n\n\n------------------------------------------\n')
48print 'This is the ISO <%s> that will be interpreted' % iso48print ('This is the ISO <%s> that will be interpreted' % iso)
4949
50# New ISO50# New ISO
51i = ISO8583()51i = ISO8583()
@@ -53,21 +53,21 @@
53i.setIsoContent(iso)53i.setIsoContent(iso)
5454
55# Showing that everything is ok55# Showing that everything is ok
56print 'The MTI is = %s' %i.getMTI() 56print ('The MTI is = %s' %i.getMTI())
57print 'The Bitmap is = %s' %i.getBitmap() 57print ('The Bitmap is = %s' %i.getBitmap())
58print 'Show bits inside the package'58print ('Show bits inside the package')
59i.showIsoBits()59i.showIsoBits()
6060
61# Using == to compare ISOS's61# Using == to compare ISOS's
62print 'Compare ISOs ...'62print ('Compare ISOs ...')
63if i == p2:63if i == p2:
64 print 'They are equivalent!'64 print ('They are equivalent!')
65 65
66else:66else:
67 print 'The are differente'67 print ('The are differente')
68 68
69# More example... 69# More example...
70print '\n\n\n------------------------------------------\n' 70print ('\n\n\n------------------------------------------\n')
7171
72i3=ISO8583()72i3=ISO8583()
73i3.setMTI('0800')73i3.setMTI('0800')
@@ -79,6 +79,6 @@
7979
80i3.showIsoBits()80i3.showIsoBits()
8181
82print 'This is the pack %s' %i3.getRawIso() 82print ('This is the pack %s' %i3.getRawIso())
8383
84 84
8585
=== modified file 'examples/example3.py'
--- examples/example3.py 2009-08-27 15:34:49 +0000
+++ examples/example3.py 2012-07-25 06:33:20 +0000
@@ -36,41 +36,41 @@
36p2.setBit(17,17)36p2.setBit(17,17)
37p2.setBit(49,986)37p2.setBit(49,986)
38p2.setBit(99,99)38p2.setBit(99,99)
39print 'MTI = %s' %p2.getMTI() 39print ('MTI = %s' %p2.getMTI())
40print 'Bitmap = %s' %p2.getBitmap() 40print ('Bitmap = %s' %p2.getBitmap())
41p2.showIsoBits();41p2.showIsoBits();
4242
4343
44iso = p2.getRawIso()44iso = p2.getRawIso()
45#Show debug information of the parsing function45#Show debug information of the parsing function
46print '\n\n\n------------------------------------------\n'46print ('\n\n\n------------------------------------------\n')
47print 'Parsing ... <%s> ' % iso47print ('Parsing ... <%s> ' % iso)
4848
4949
50i = ISO8583()50i = ISO8583()
51i.setIsoContent(iso)51i.setIsoContent(iso)
52#Show information ... to compare52#Show information ... to compare
53print 'MTI = %s' %i.getMTI() 53print ('MTI = %s' %i.getMTI())
54print 'Bitmap = %s' %i.getBitmap() 54print ('Bitmap = %s' %i.getBitmap())
55print 'Here we have bits'55print ('Here we have bits')
56i.showIsoBits()56i.showIsoBits()
5757
5858
59print 'This is the bits and values (1)'59print ('This is the bits and values (1)')
60v1 = p2.getBitsAndValues()60v1 = p2.getBitsAndValues()
61print '\n%s\n' %v161print ('\n%s\n' %v1)
6262
63print 'This is the bits and values (2)'63print ('This is the bits and values (2)')
64v2 = i.getBitsAndValues() 64v2 = i.getBitsAndValues()
65print '\n%s\n' %v265print ('\n%s\n' %v2)
6666
67print 'One way of printing the information ...!'67print ('One way of printing the information ...!')
68for v in v1:68for v in v1:
69 print 'Bit %s of type %s has value = %s' % (v['bit'],v['type'],v['value'])69 print ('Bit %s of type %s has value = %s' % (v['bit'],v['type'],v['value']))
7070
7171
72print 'Another way...'72print ('Another way...')
73for v in range(0,len(v2)):73for v in range(0,len(v2)):
74 print 'Bit %s of type %s has value = %s' % (v2[v]['bit'],v2[v]['type'],v2[v]['value'])74 print ('Bit %s of type %s has value = %s' % (v2[v]['bit'],v2[v]['type'],v2[v]['value']))
75 75
76 76
7777
=== modified file 'examples/example4.py'
--- examples/example4.py 2009-08-27 15:34:49 +0000
+++ examples/example4.py 2012-07-25 06:33:20 +0000
@@ -43,32 +43,33 @@
43'''43'''
44#i2 = ISO8583(debug=True)44#i2 = ISO8583(debug=True)
45i2 = ISO8583()45i2 = ISO8583()
46# in this case, we need to redefine a bit because default bit 42 is LL and in this especification is "N"
47# the rest remain, so we use get :)
48i2.redefineBit(42, '42', i2.getLargeBitName(42), 'N', i2.getBitLimit(42), i2.getBitValueType(42) )
49
5046
51iso2 = '0210B238000102C080040000000000000002100000000000001700010814465469421614465701081100301000000N399915444303500019991544986020 Value not allowed!!009000095492'47iso2 = '0210B238000102C080040000000000000002100000000000001700010814465469421614465701081100301000000N399915444303500019991544986020 Value not allowed!!009000095492'
52print '\n\n\n------------------------------------------\n'48print ('\n\n\n------------------------------------------\n')
53print 'This is the ISO <%s> parse it!' % iso249print ('This is the ISO <%s> parse it!' % iso2)
5450
55i2.setIsoContent(iso2)51i2.setIsoContent(iso2)
56print 'Bitmap = %s' %i2.getBitmap() 52print ('Bitmap = %s' %i2.getBitmap())
57print 'MTI = %s' %i2.getMTI() 53print ('MTI = %s' %i2.getMTI())
5854
59print 'Bits'55print ('Bits')
60v3 = i2.getBitsAndValues()56v3 = i2.getBitsAndValues()
61for v in v3:57for v in v3:
62 print '(1) Bit %s of type %s and value = %s' % (v['bit'],v['type'],v['value'])58 print ('(1) Bit %s of type %s and value = %s' % (v['bit'],v['type'],v['value']))
63 59
6460
61# in this case, we need to redefine a bit because default bit 42 is A and in this especification is "N"
62# the rest remain, so we use get's to copy original values :)
63i2.redefineBit(42, '42', i2.getLargeBitName(42), 'N', i2.getBitLimit(42), i2.getBitValueType(42) )
64print ('\nBit 42 redefined...\n')
65
65i3 = ISO8583(iso=iso2)66i3 = ISO8583(iso=iso2)
66print 'Bitmap = %s' %i3.getBitmap() 67print ('Bitmap = %s' %i3.getBitmap())
67print 'MTI = %s' %i3.getMTI() 68print ('MTI = %s' %i3.getMTI())
6869
69print 'Bits inside'70print ('Bits inside')
70v4 = i3.getBitsAndValues()71v4 = i3.getBitsAndValues()
71for v in v4:72for v in v4:
72 print '(2) Bit %s of type %s and value = %s' % (v['bit'],v['type'],v['value']) 73 print ('(2) Bit %s of type %s and value = %s' % (v['bit'],v['type'],v['value']))
7374
74 75
7576
=== modified file 'setup.py'
--- setup.py 2009-08-27 15:34:49 +0000
+++ setup.py 2012-07-25 06:33:20 +0000
@@ -1,8 +1,9 @@
1#!/usr/bin/env python1#!/usr/bin/env python
22
3from distutils.core import setup3from distutils.core import setup
4
4setup(name='ISO8583 Module',5setup(name='ISO8583 Module',
5 version='1.1',6 version='1.2',
6 description='ISO8583 LIBRARY',7 description='ISO8583 LIBRARY',
7 author='Igor V. Custodio',8 author='Igor V. Custodio',
8 author_email='igorvc@vulcanno.com.br',9 author_email='igorvc@vulcanno.com.br',

Subscribers

People subscribed via source and target branches

to all changes: