Merge lp:~logan/ubuntu/quantal/python-iso8583/new-upstream into lp:ubuntu/quantal/python-iso8583
- Quantal (12.10)
- new-upstream
- Merge into quantal
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Barry Warsaw (community) | Approve | ||
Ubuntu branches | Pending | ||
Review via email: mp+116588@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ISO8583/ISO8583.py' | |||
2 | --- ISO8583/ISO8583.py 2009-08-27 15:34:49 +0000 | |||
3 | +++ ISO8583/ISO8583.py 2012-07-25 06:33:20 +0000 | |||
4 | @@ -16,8 +16,19 @@ | |||
5 | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
6 | 17 | 17 | ||
7 | 18 | """ | 18 | """ |
10 | 19 | """ | 19 | |
11 | 20 | ISO8583 Class. | 20 | __author__ = 'Igor Vitorio Custodio <igorvc@vulcanno.com.br>' |
12 | 21 | __version__= '1.2' | ||
13 | 22 | __licence__ = 'GPL V3' | ||
14 | 23 | |||
15 | 24 | |||
16 | 25 | |||
17 | 26 | from ISOErrors import * | ||
18 | 27 | import struct | ||
19 | 28 | |||
20 | 29 | |||
21 | 30 | class ISO8583: | ||
22 | 31 | """Main Class to work with ISO8583 packages. | ||
23 | 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. |
24 | 22 | It's 100% Python :) | 33 | It's 100% Python :) |
25 | 23 | Enjoy it! | 34 | Enjoy it! |
26 | @@ -40,32 +51,18 @@ | |||
27 | 40 | iso.setBit(49,986) | 51 | iso.setBit(49,986) |
28 | 41 | iso.setBit(99,99) | 52 | iso.setBit(99,99) |
29 | 42 | except ValueToLarge, e: | 53 | except ValueToLarge, e: |
31 | 43 | print 'Value too large :( %s' % e | 54 | print ('Value too large :( %s' % e) |
32 | 44 | except InvalidMTI, i: | 55 | except InvalidMTI, i: |
34 | 45 | print 'This MTI is wrong :( %s' % i | 56 | print ('This MTI is wrong :( %s' % i) |
35 | 46 | 57 | ||
37 | 47 | print 'The Message Type Indication is = %s' %iso.getMTI() | 58 | print ('The Message Type Indication is = %s' %iso.getMTI()) |
38 | 48 | 59 | ||
40 | 49 | print 'The Bitmap is = %s' %iso.getBitmap() | 60 | print ('The Bitmap is = %s' %iso.getBitmap()) |
41 | 50 | iso.showIsoBits(); | 61 | iso.showIsoBits(); |
44 | 51 | print 'This is the ISO8583 complete package %s' % iso.getRawIso() | 62 | print ('This is the ISO8583 complete package %s' % iso.getRawIso()) |
45 | 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()) |
46 | 53 | 64 | ||
47 | 54 | """ | 65 | """ |
48 | 55 | |||
49 | 56 | __author__ = 'Igor Vitorio Custodio <igorvc@vulcanno.com.br>' | ||
50 | 57 | __version__= '0.2' | ||
51 | 58 | __licence__ = 'GPL V3' | ||
52 | 59 | |||
53 | 60 | |||
54 | 61 | |||
55 | 62 | from ISOErrors import * | ||
56 | 63 | import struct | ||
57 | 64 | |||
58 | 65 | |||
59 | 66 | class ISO8583: | ||
60 | 67 | """Main Class to work with ISO8583 packages. | ||
61 | 68 | """ | ||
62 | 69 | #Attributes | 66 | #Attributes |
63 | 70 | # Bitsto be set 00000000 -> _BIT_POSITION_1 ... _BIT_POSITION_8 | 67 | # Bitsto be set 00000000 -> _BIT_POSITION_1 ... _BIT_POSITION_8 |
64 | 71 | _BIT_POSITION_1 = 128 # 10 00 00 00 | 68 | _BIT_POSITION_1 = 128 # 10 00 00 00 |
65 | @@ -130,7 +127,7 @@ | |||
66 | 130 | _BITS_VALUE_TYPE[37] = ['37','Retrieval reference number','N',12,'an'] | 127 | _BITS_VALUE_TYPE[37] = ['37','Retrieval reference number','N',12,'an'] |
67 | 131 | _BITS_VALUE_TYPE[38] = ['38','Approval code','N',6,'an'] | 128 | _BITS_VALUE_TYPE[38] = ['38','Approval code','N',6,'an'] |
68 | 132 | _BITS_VALUE_TYPE[39] = ['39','Action code','A',2,'an'] | 129 | _BITS_VALUE_TYPE[39] = ['39','Action code','A',2,'an'] |
70 | 133 | _BITS_VALUE_TYPE[40] = ['40','Service code','N3',3,'an'] | 130 | _BITS_VALUE_TYPE[40] = ['40','Service code','N',3,'an'] |
71 | 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'] |
72 | 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'] |
73 | 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'] |
74 | @@ -191,7 +188,7 @@ | |||
75 | 191 | _BITS_VALUE_TYPE[98] = ['98','Payee','ANS',25,'ans'] | 188 | _BITS_VALUE_TYPE[98] = ['98','Payee','ANS',25,'ans'] |
76 | 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'] |
77 | 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'] |
79 | 194 | _BITS_VALUE_TYPE[101] = ['101','File name','ASN',17,'ans'] | 191 | _BITS_VALUE_TYPE[101] = ['101','File name','ANS',17,'ans'] |
80 | 195 | _BITS_VALUE_TYPE[102] = ['102','Account identification 1','LL',28,'ans'] | 192 | _BITS_VALUE_TYPE[102] = ['102','Account identification 1','LL',28,'ans'] |
81 | 196 | _BITS_VALUE_TYPE[103] = ['103','Account identification 2','LL',28,'ans'] | 193 | _BITS_VALUE_TYPE[103] = ['103','Account identification 2','LL',28,'ans'] |
82 | 197 | _BITS_VALUE_TYPE[104] = ['104','Transaction description','LLL',100,'ans'] | 194 | _BITS_VALUE_TYPE[104] = ['104','Transaction description','LLL',100,'ans'] |
83 | @@ -332,7 +329,7 @@ | |||
84 | 332 | """ | 329 | """ |
85 | 333 | 330 | ||
86 | 334 | if self.DEBUG == True: | 331 | if self.DEBUG == True: |
88 | 335 | print 'Init bitmap' | 332 | print ('Init bitmap') |
89 | 336 | 333 | ||
90 | 337 | if len(self.BITMAP) == 16: | 334 | if len(self.BITMAP) == 16: |
91 | 338 | for cont in range(0,16): | 335 | for cont in range(0,16): |
92 | @@ -349,7 +346,7 @@ | |||
93 | 349 | It's a internal method, so don't call! | 346 | It's a internal method, so don't call! |
94 | 350 | """ | 347 | """ |
95 | 351 | if self.DEBUG == True: | 348 | if self.DEBUG == True: |
97 | 352 | print 'Init bitmap_values' | 349 | print ('Init bitmap_values') |
98 | 353 | 350 | ||
99 | 354 | if len(self.BITMAP_VALUES) == 128: | 351 | if len(self.BITMAP_VALUES) == 128: |
100 | 355 | for cont in range(0,128): | 352 | for cont in range(0,128): |
101 | @@ -370,7 +367,7 @@ | |||
102 | 370 | @raise: BitInexistent Exception, ValueToLarge Exception | 367 | @raise: BitInexistent Exception, ValueToLarge Exception |
103 | 371 | """ | 368 | """ |
104 | 372 | if self.DEBUG == True: | 369 | if self.DEBUG == True: |
106 | 373 | print 'Setting bit inside bitmap bit[%s] = %s' % (bit, value) | 370 | print ('Setting bit inside bitmap bit[%s] = %s') % (bit, value) |
107 | 374 | 371 | ||
108 | 375 | if bit < 1 or bit > 128: | 372 | if bit < 1 or bit > 128: |
109 | 376 | raise BitInexistent("Bit number %s dosen't exist!" % bit) | 373 | raise BitInexistent("Bit number %s dosen't exist!" % bit) |
110 | @@ -441,7 +438,7 @@ | |||
111 | 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: |
112 | 442 | # Only has the first bitmap | 439 | # Only has the first bitmap |
113 | 443 | if self.DEBUG == True: | 440 | if self.DEBUG == True: |
115 | 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]))) |
116 | 445 | 442 | ||
117 | 446 | tm = hex(self.BITMAP[c])[2:] | 443 | tm = hex(self.BITMAP[c])[2:] |
118 | 447 | if len(tm) != 2: | 444 | if len(tm) != 2: |
119 | @@ -451,7 +448,7 @@ | |||
120 | 451 | break | 448 | break |
121 | 452 | else: # second bitmap | 449 | else: # second bitmap |
122 | 453 | if self.DEBUG == True: | 450 | if self.DEBUG == True: |
124 | 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]))) |
125 | 455 | 452 | ||
126 | 456 | tm = hex(self.BITMAP[c])[2:] | 453 | tm = hex(self.BITMAP[c])[2:] |
127 | 457 | if len(tm) != 2: | 454 | if len(tm) != 2: |
128 | @@ -476,7 +473,7 @@ | |||
129 | 476 | for x in range(0,32,2): | 473 | for x in range(0,32,2): |
130 | 477 | if (int(bitmap[0:2],16) & self._BIT_POSITION_1) != self._BIT_POSITION_1: # Only 1 bitmap | 474 | if (int(bitmap[0:2],16) & self._BIT_POSITION_1) != self._BIT_POSITION_1: # Only 1 bitmap |
131 | 478 | if self.DEBUG == True: | 475 | if self.DEBUG == True: |
133 | 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))) |
134 | 480 | 477 | ||
135 | 481 | self.BITMAP_HEX += bitmap[x:x+2] | 478 | self.BITMAP_HEX += bitmap[x:x+2] |
136 | 482 | self.BITMAP[cont] = int(bitmap[x:x+2],16) | 479 | self.BITMAP[cont] = int(bitmap[x:x+2],16) |
137 | @@ -484,7 +481,7 @@ | |||
138 | 484 | break | 481 | break |
139 | 485 | else: # Second bitmap | 482 | else: # Second bitmap |
140 | 486 | if self.DEBUG == True: | 483 | if self.DEBUG == True: |
142 | 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))) |
143 | 488 | 485 | ||
144 | 489 | self.BITMAP_HEX += bitmap[x:x+2] | 486 | self.BITMAP_HEX += bitmap[x:x+2] |
145 | 490 | self.BITMAP[cont] = int(bitmap[x:x+2],16) | 487 | self.BITMAP[cont] = int(bitmap[x:x+2],16) |
146 | @@ -499,7 +496,7 @@ | |||
147 | 499 | @param: bitmap -> bitmap str to be analized and translated to "bits" | 496 | @param: bitmap -> bitmap str to be analized and translated to "bits" |
148 | 500 | """ | 497 | """ |
149 | 501 | bits = self.__inicializeBitsFromBitmapStr(bitmap) | 498 | bits = self.__inicializeBitsFromBitmapStr(bitmap) |
151 | 502 | print 'Bits inside %s = %s' % (bitmap,bits) | 499 | print ('Bits inside %s = %s' % (bitmap,bits)) |
152 | 503 | ################################################################################################ | 500 | ################################################################################################ |
153 | 504 | 501 | ||
154 | 505 | ################################################################################################ | 502 | ################################################################################################ |
155 | @@ -513,23 +510,23 @@ | |||
156 | 513 | for c in range(0,16): | 510 | for c in range(0,16): |
157 | 514 | for d in range(1,9): | 511 | for d in range(1,9): |
158 | 515 | if self.DEBUG == True: | 512 | if self.DEBUG == True: |
160 | 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]) )) |
161 | 517 | if (self.BITMAP[c] & self._TMP[d]) == self._TMP[d]: | 514 | if (self.BITMAP[c] & self._TMP[d]) == self._TMP[d]: |
162 | 518 | if d == 1: # e o 8 bit | 515 | if d == 1: # e o 8 bit |
163 | 519 | if self.DEBUG == True: | 516 | if self.DEBUG == True: |
165 | 520 | print 'Bit %s is present !!!' % ((c +1)* 8) | 517 | print ('Bit %s is present !!!' % ((c +1)* 8)) |
166 | 521 | bits.append((c +1)* 8) | 518 | bits.append((c +1)* 8) |
167 | 522 | self.BITMAP_VALUES[(c +1)* 8] = 'X' | 519 | self.BITMAP_VALUES[(c +1)* 8] = 'X' |
168 | 523 | else: | 520 | else: |
169 | 524 | if (c == 0) & (d == 2): # Continuation bit | 521 | if (c == 0) & (d == 2): # Continuation bit |
170 | 525 | if self.DEBUG == True: | 522 | if self.DEBUG == True: |
172 | 526 | print 'Bit 1 is present !!!' | 523 | print ('Bit 1 is present !!!') |
173 | 527 | 524 | ||
174 | 528 | bits.append(1) | 525 | bits.append(1) |
175 | 529 | 526 | ||
176 | 530 | else: | 527 | else: |
177 | 531 | if self.DEBUG == True: | 528 | if self.DEBUG == True: |
179 | 532 | print 'Bit %s is present !!!' % (c * 8 + d - 1) | 529 | print ('Bit %s is present !!!' % (c * 8 + d - 1)) |
180 | 533 | 530 | ||
181 | 534 | bits.append(c * 8 + d - 1) | 531 | bits.append(c * 8 + d - 1) |
182 | 535 | self.BITMAP_VALUES[c * 8 + d - 1] = 'X' | 532 | self.BITMAP_VALUES[c * 8 + d - 1] = 'X' |
183 | @@ -549,23 +546,23 @@ | |||
184 | 549 | for c in range(0,16): | 546 | for c in range(0,16): |
185 | 550 | for d in range(1,9): | 547 | for d in range(1,9): |
186 | 551 | if self.DEBUG == True: | 548 | if self.DEBUG == True: |
188 | 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]) )) |
189 | 553 | if (self.BITMAP[c] & self._TMP[d]) == self._TMP[d]: | 550 | if (self.BITMAP[c] & self._TMP[d]) == self._TMP[d]: |
190 | 554 | if d == 1: # e o 8 bit | 551 | if d == 1: # e o 8 bit |
191 | 555 | if self.DEBUG == True: | 552 | if self.DEBUG == True: |
193 | 556 | print 'Bit %s is present !!!' % ((c +1)* 8) | 553 | print ('Bit %s is present !!!' % ((c +1)* 8)) |
194 | 557 | 554 | ||
195 | 558 | bits.append((c +1)* 8) | 555 | bits.append((c +1)* 8) |
196 | 559 | else: | 556 | else: |
197 | 560 | if (c == 0) & (d == 2): # Continuation bit | 557 | if (c == 0) & (d == 2): # Continuation bit |
198 | 561 | if self.DEBUG == True: | 558 | if self.DEBUG == True: |
200 | 562 | print 'Bit 1 is present !!!' | 559 | print ('Bit 1 is present !!!') |
201 | 563 | 560 | ||
202 | 564 | bits.append(1) | 561 | bits.append(1) |
203 | 565 | 562 | ||
204 | 566 | else: | 563 | else: |
205 | 567 | if self.DEBUG == True: | 564 | if self.DEBUG == True: |
207 | 568 | print 'Bit %s is present !!!' % (c * 8 + d - 1) | 565 | print ('Bit %s is present !!!' % (c * 8 + d - 1)) |
208 | 569 | 566 | ||
209 | 570 | bits.append(c * 8 + d - 1) | 567 | bits.append(c * 8 + d - 1) |
210 | 571 | 568 | ||
211 | @@ -735,7 +732,7 @@ | |||
212 | 735 | """ | 732 | """ |
213 | 736 | 733 | ||
214 | 737 | for cont in range(0,128): | 734 | for cont in range(0,128): |
216 | 738 | if self.BITMAP_VALUES[cont] <> self._BIT_DEFAULT_VALUE: | 735 | if self.BITMAP_VALUES[cont] != self._BIT_DEFAULT_VALUE: |
217 | 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]) ) |
218 | 740 | 737 | ||
219 | 741 | 738 | ||
220 | @@ -777,7 +774,7 @@ | |||
221 | 777 | iso.setBit(17,17) | 774 | iso.setBit(17,17) |
222 | 778 | iso.setBit(99,99) | 775 | iso.setBit(99,99) |
223 | 779 | str = iso.getRawIso() | 776 | str = iso.getRawIso() |
225 | 780 | print 'This is the ASCII package %s' % str | 777 | print ('This is the ASCII package %s' % str) |
226 | 781 | output (print) -> This is the ASCII package 0800d010800000000000000000002000000001200000000000400001200170299 | 778 | output (print) -> This is the ASCII package 0800d010800000000000000000002000000001200000000000400001200170299 |
227 | 782 | 779 | ||
228 | 783 | @return: str with complete ASCII ISO8583 | 780 | @return: str with complete ASCII ISO8583 |
229 | @@ -795,7 +792,7 @@ | |||
230 | 795 | resp += self.BITMAP_HEX | 792 | resp += self.BITMAP_HEX |
231 | 796 | 793 | ||
232 | 797 | for cont in range(0,128): | 794 | for cont in range(0,128): |
234 | 798 | if self.BITMAP_VALUES[cont] <> self._BIT_DEFAULT_VALUE: | 795 | if self.BITMAP_VALUES[cont] != self._BIT_DEFAULT_VALUE: |
235 | 799 | resp = "%s%s"%(resp, self.BITMAP_VALUES[cont]) | 796 | resp = "%s%s"%(resp, self.BITMAP_VALUES[cont]) |
236 | 800 | 797 | ||
237 | 801 | return resp | 798 | return resp |
238 | @@ -822,7 +819,7 @@ | |||
239 | 822 | """ | 819 | """ |
240 | 823 | 820 | ||
241 | 824 | if self.DEBUG == True: | 821 | if self.DEBUG == True: |
243 | 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)) |
244 | 826 | 823 | ||
245 | 827 | #validating bit position | 824 | #validating bit position |
246 | 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: |
247 | @@ -831,10 +828,10 @@ | |||
248 | 831 | #need to validate if the type and size is compatible! example slimit = 100 and type = LL | 828 | #need to validate if the type and size is compatible! example slimit = 100 and type = LL |
249 | 832 | 829 | ||
250 | 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": |
252 | 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" : |
253 | 835 | self._BITS_VALUE_TYPE[bit] = [smallStr, largeStr, bitType, size, valueType] | 832 | self._BITS_VALUE_TYPE[bit] = [smallStr, largeStr, bitType, size, valueType] |
254 | 836 | if self.DEBUG == True: | 833 | if self.DEBUG == True: |
256 | 837 | print 'Bit %d redefined!' % bit | 834 | print ('Bit %d redefined!' % bit) |
257 | 838 | 835 | ||
258 | 839 | else: | 836 | else: |
259 | 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)) |
260 | @@ -855,7 +852,7 @@ | |||
261 | 855 | self.MESSAGE_TYPE_INDICATION = iso[0:4] | 852 | self.MESSAGE_TYPE_INDICATION = iso[0:4] |
262 | 856 | 853 | ||
263 | 857 | if self.DEBUG == True: | 854 | if self.DEBUG == True: |
265 | 858 | print 'MTI found was %s' % self.MESSAGE_TYPE_INDICATION | 855 | print ('MTI found was %s' % self.MESSAGE_TYPE_INDICATION) |
266 | 859 | 856 | ||
267 | 860 | 857 | ||
268 | 861 | ################################################################################################ | 858 | ################################################################################################ |
269 | @@ -907,40 +904,40 @@ | |||
270 | 907 | """ | 904 | """ |
271 | 908 | 905 | ||
272 | 909 | if self.DEBUG == True: | 906 | if self.DEBUG == True: |
274 | 910 | print 'This is the input string <%s>' % strWithoutMtiBitmap | 907 | print ('This is the input string <%s>' % strWithoutMtiBitmap) |
275 | 911 | 908 | ||
276 | 912 | offset = 0; | 909 | offset = 0; |
277 | 913 | # jump bit 1 because it was alread defined in the "__inicializeBitsFromBitmapStr" | 910 | # jump bit 1 because it was alread defined in the "__inicializeBitsFromBitmapStr" |
278 | 914 | for cont in range(2,128): | 911 | for cont in range(2,128): |
280 | 915 | if self.BITMAP_VALUES[cont] <> self._BIT_DEFAULT_VALUE: | 912 | if self.BITMAP_VALUES[cont] != self._BIT_DEFAULT_VALUE: |
281 | 916 | if self.DEBUG == True: | 913 | if self.DEBUG == True: |
283 | 917 | print 'String = %s offset = %s bit = %s' % (strWithoutMtiBitmap[offset:],offset,cont) | 914 | print ('String = %s offset = %s bit = %s' % (strWithoutMtiBitmap[offset:],offset,cont)) |
284 | 918 | 915 | ||
285 | 919 | if self.getBitType(cont) == 'LL': | 916 | if self.getBitType(cont) == 'LL': |
286 | 920 | valueSize = int(strWithoutMtiBitmap[offset:offset +2]) | 917 | valueSize = int(strWithoutMtiBitmap[offset:offset +2]) |
287 | 921 | if self.DEBUG == True: | 918 | if self.DEBUG == True: |
289 | 922 | print 'Size of the message in LL = %s' %valueSize | 919 | print ('Size of the message in LL = %s' %valueSize) |
290 | 923 | 920 | ||
291 | 924 | if valueSize > self.getBitLimit(cont): | 921 | if valueSize > self.getBitLimit(cont): |
292 | 925 | raise ValueToLarge("This bit is larger than the especification!") | 922 | raise ValueToLarge("This bit is larger than the especification!") |
293 | 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] |
294 | 927 | 924 | ||
295 | 928 | if self.DEBUG == True: | 925 | if self.DEBUG == True: |
297 | 929 | print '\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont]) | 926 | print ('\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont])) |
298 | 930 | 927 | ||
299 | 931 | offset += valueSize + 2 | 928 | offset += valueSize + 2 |
300 | 932 | 929 | ||
301 | 933 | if self.getBitType(cont) == 'LLL': | 930 | if self.getBitType(cont) == 'LLL': |
302 | 934 | valueSize = int(strWithoutMtiBitmap[offset:offset +3]) | 931 | valueSize = int(strWithoutMtiBitmap[offset:offset +3]) |
303 | 935 | if self.DEBUG == True: | 932 | if self.DEBUG == True: |
305 | 936 | print 'Size of the message in LLL = %s' %valueSize | 933 | print ('Size of the message in LLL = %s' %valueSize) |
306 | 937 | 934 | ||
307 | 938 | if valueSize > self.getBitLimit(cont): | 935 | if valueSize > self.getBitLimit(cont): |
308 | 939 | raise ValueToLarge("This bit is larger than the especification!") | 936 | raise ValueToLarge("This bit is larger than the especification!") |
309 | 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] |
310 | 941 | 938 | ||
311 | 942 | if self.DEBUG == True: | 939 | if self.DEBUG == True: |
313 | 943 | print '\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont]) | 940 | print ('\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont])) |
314 | 944 | 941 | ||
315 | 945 | offset += valueSize + 3 | 942 | offset += valueSize + 3 |
316 | 946 | 943 | ||
317 | @@ -951,11 +948,11 @@ | |||
318 | 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] |
319 | 952 | # offset += valueSize + 4 | 949 | # offset += valueSize + 4 |
320 | 953 | 950 | ||
322 | 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' : |
323 | 955 | self.BITMAP_VALUES[cont] = strWithoutMtiBitmap[offset:self.getBitLimit(cont)+offset] | 952 | self.BITMAP_VALUES[cont] = strWithoutMtiBitmap[offset:self.getBitLimit(cont)+offset] |
324 | 956 | 953 | ||
325 | 957 | if self.DEBUG == True: | 954 | if self.DEBUG == True: |
327 | 958 | print '\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont]) | 955 | print ('\tSetting bit %s value %s' % (cont,self.BITMAP_VALUES[cont])) |
328 | 959 | 956 | ||
329 | 960 | offset += self.getBitLimit(cont) | 957 | offset += self.getBitLimit(cont) |
330 | 961 | 958 | ||
331 | @@ -979,7 +976,7 @@ | |||
332 | 979 | print 'This ISO has bits:' | 976 | print 'This ISO has bits:' |
333 | 980 | v3 = i2.getBitsAndValues() | 977 | v3 = i2.getBitsAndValues() |
334 | 981 | for v in v3: | 978 | for v in v3: |
336 | 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'])) |
337 | 983 | 980 | ||
338 | 984 | @param: str -> complete ISO8583 string | 981 | @param: str -> complete ISO8583 string |
339 | 985 | @raise: InvalidIso8583 Exception | 982 | @raise: InvalidIso8583 Exception |
340 | @@ -987,18 +984,18 @@ | |||
341 | 987 | if len(iso) < 20: | 984 | if len(iso) < 20: |
342 | 988 | raise InvalidIso8583('This is not a valid iso!!') | 985 | raise InvalidIso8583('This is not a valid iso!!') |
343 | 989 | if self.DEBUG == True: | 986 | if self.DEBUG == True: |
345 | 990 | print 'ASCII to process <%s>' % iso | 987 | print ('ASCII to process <%s>' % iso) |
346 | 991 | 988 | ||
347 | 992 | self.__setMTIFromStr(iso) | 989 | self.__setMTIFromStr(iso) |
348 | 993 | isoT = iso[4:] | 990 | isoT = iso[4:] |
349 | 994 | self.__getBitmapFromStr(isoT) | 991 | self.__getBitmapFromStr(isoT) |
350 | 995 | self.__inicializeBitsFromBitmapStr(self.BITMAP_HEX) | 992 | self.__inicializeBitsFromBitmapStr(self.BITMAP_HEX) |
351 | 996 | if self.DEBUG == True: | 993 | if self.DEBUG == True: |
353 | 997 | print 'This is the array of bits (before) %s ' % self.BITMAP_VALUES | 994 | print ('This is the array of bits (before) %s ' % self.BITMAP_VALUES) |
354 | 998 | 995 | ||
355 | 999 | self.__getBitFromStr(iso[4+len(self.BITMAP_HEX):]) | 996 | self.__getBitFromStr(iso[4+len(self.BITMAP_HEX):]) |
356 | 1000 | if self.DEBUG == True: | 997 | if self.DEBUG == True: |
358 | 1001 | print 'This is the array of bits (after) %s ' % self.BITMAP_VALUES | 998 | print ('This is the array of bits (after) %s ' % self.BITMAP_VALUES) |
359 | 1002 | 999 | ||
360 | 1003 | 1000 | ||
361 | 1004 | ################################################################################################ | 1001 | ################################################################################################ |
362 | @@ -1024,9 +1021,9 @@ | |||
363 | 1024 | 1021 | ||
364 | 1025 | print 'Is equivalent?' | 1022 | print 'Is equivalent?' |
365 | 1026 | if p1 == p1: | 1023 | if p1 == p1: |
367 | 1027 | print 'Yes :)' | 1024 | print ('Yes :)') |
368 | 1028 | else: | 1025 | else: |
370 | 1029 | print 'Noooooooooo :(' | 1026 | print ('Noooooooooo :(') |
371 | 1030 | 1027 | ||
372 | 1031 | @param: obj2 -> object that will be compared | 1028 | @param: obj2 -> object that will be compared |
373 | 1032 | @return: <0 if is not equal, 0 if is equal | 1029 | @return: <0 if is not equal, 0 if is equal |
374 | @@ -1059,13 +1056,13 @@ | |||
375 | 1059 | 1056 | ||
376 | 1060 | v1 = p1.getBitsAndValues() | 1057 | v1 = p1.getBitsAndValues() |
377 | 1061 | for v in v1: | 1058 | for v in v1: |
379 | 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'])) |
380 | 1063 | 1060 | ||
381 | 1064 | @return: array of values. | 1061 | @return: array of values. |
382 | 1065 | """ | 1062 | """ |
383 | 1066 | ret = [] | 1063 | ret = [] |
384 | 1067 | for cont in range(2,128): | 1064 | for cont in range(2,128): |
386 | 1068 | if self.BITMAP_VALUES[cont] <> self._BIT_DEFAULT_VALUE: | 1065 | if self.BITMAP_VALUES[cont] != self._BIT_DEFAULT_VALUE: |
387 | 1069 | _TMP = {} | 1066 | _TMP = {} |
388 | 1070 | _TMP['bit'] = "%d" % cont | 1067 | _TMP['bit'] = "%d" % cont |
389 | 1071 | _TMP['type'] = self.getBitType(cont) | 1068 | _TMP['type'] = self.getBitType(cont) |
390 | @@ -1091,7 +1088,7 @@ | |||
391 | 1091 | arr = self.__getBitsFromBitmap() | 1088 | arr = self.__getBitsFromBitmap() |
392 | 1092 | 1089 | ||
393 | 1093 | if self.DEBUG == True: | 1090 | if self.DEBUG == True: |
395 | 1094 | print 'This is the array of bits inside the bitmap %s' % arr | 1091 | print ('This is the array of bits inside the bitmap %s' % arr) |
396 | 1095 | 1092 | ||
397 | 1096 | for v in arr: | 1093 | for v in arr: |
398 | 1097 | if v == bit: | 1094 | if v == bit: |
399 | @@ -1124,7 +1121,7 @@ | |||
400 | 1124 | netIso += ascii | 1121 | netIso += ascii |
401 | 1125 | # Example: big-endian | 1122 | # Example: big-endian |
402 | 1126 | # To little-endian, replace 'iso.getNetworkISO()' with 'iso.getNetworkISO(False)' | 1123 | # To little-endian, replace 'iso.getNetworkISO()' with 'iso.getNetworkISO(False)' |
404 | 1127 | print 'This <%s> the same that <%s>' % (iso.getNetworkISO(),netIso) | 1124 | print ('This <%s> the same that <%s>' % (iso.getNetworkISO(),netIso)) |
405 | 1128 | 1125 | ||
406 | 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. |
407 | 1130 | @return: size + ASCII ISO8583 package ready to go to the network! | 1127 | @return: size + ASCII ISO8583 package ready to go to the network! |
408 | @@ -1137,11 +1134,11 @@ | |||
409 | 1137 | if bigEndian: | 1134 | if bigEndian: |
410 | 1138 | netIso = struct.pack('!h',len(asciiIso)) | 1135 | netIso = struct.pack('!h',len(asciiIso)) |
411 | 1139 | if self.DEBUG == True: | 1136 | if self.DEBUG == True: |
413 | 1140 | print 'Pack Big-endian' | 1137 | print ('Pack Big-endian') |
414 | 1141 | else: | 1138 | else: |
415 | 1142 | netIso = struct.pack('<h',len(asciiIso)) | 1139 | netIso = struct.pack('<h',len(asciiIso)) |
416 | 1143 | if self.DEBUG == True: | 1140 | if self.DEBUG == True: |
418 | 1144 | print 'Pack Little-endian' | 1141 | print ('Pack Little-endian') |
419 | 1145 | 1142 | ||
420 | 1146 | netIso += asciiIso | 1143 | netIso += asciiIso |
421 | 1147 | 1144 | ||
422 | @@ -1174,7 +1171,7 @@ | |||
423 | 1174 | #newIso.setIsoContent(netIso[2:size]) | 1171 | #newIso.setIsoContent(netIso[2:size]) |
424 | 1175 | arr = newIso.getBitsAndValues() | 1172 | arr = newIso.getBitsAndValues() |
425 | 1176 | for v in arr: | 1173 | for v in arr: |
427 | 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'])) |
428 | 1178 | 1175 | ||
429 | 1179 | @param: iso -> str that represents size + ASCII ISO8583 package | 1176 | @param: iso -> str that represents size + ASCII ISO8583 package |
430 | 1180 | @param: bigEndian (True|False) -> Codification of the size. | 1177 | @param: bigEndian (True|False) -> Codification of the size. |
431 | @@ -1188,11 +1185,11 @@ | |||
432 | 1188 | if bigEndian: | 1185 | if bigEndian: |
433 | 1189 | size = struct.unpack('!h',size) | 1186 | size = struct.unpack('!h',size) |
434 | 1190 | if self.DEBUG == True: | 1187 | if self.DEBUG == True: |
436 | 1191 | print 'Unpack Big-endian' | 1188 | print ('Unpack Big-endian') |
437 | 1192 | else: | 1189 | else: |
438 | 1193 | size = struct.unpack('<h',size) | 1190 | size = struct.unpack('<h',size) |
439 | 1194 | if self.DEBUG == True: | 1191 | if self.DEBUG == True: |
441 | 1195 | print 'Unpack Little-endian' | 1192 | print ('Unpack Little-endian') |
442 | 1196 | 1193 | ||
443 | 1197 | if len(iso) != (size[0] + 2): | 1194 | if len(iso) != (size[0] + 2): |
444 | 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])) |
445 | 1199 | 1196 | ||
446 | === modified file 'PKG-INFO' | |||
447 | --- PKG-INFO 2009-08-27 15:34:49 +0000 | |||
448 | +++ PKG-INFO 2012-07-25 06:33:20 +0000 | |||
449 | @@ -1,6 +1,6 @@ | |||
450 | 1 | Metadata-Version: 1.0 | 1 | Metadata-Version: 1.0 |
451 | 2 | Name: ISO8583 Module | 2 | Name: ISO8583 Module |
453 | 3 | Version: 1.1 | 3 | Version: 1.2 |
454 | 4 | Summary: ISO8583 LIBRARY | 4 | Summary: ISO8583 LIBRARY |
455 | 5 | Home-page: http://www.vulcanno.com.br/python | 5 | Home-page: http://www.vulcanno.com.br/python |
456 | 6 | Author: Igor V. Custodio | 6 | Author: Igor V. Custodio |
457 | 7 | 7 | ||
458 | === added file 'TODO' | |||
459 | --- TODO 1970-01-01 00:00:00 +0000 | |||
460 | +++ TODO 2012-07-25 06:33:20 +0000 | |||
461 | @@ -0,0 +1,74 @@ | |||
462 | 1 | Add: | ||
463 | 2 | |||
464 | 3 | - create a unsetBit(bitNumber) method to delete a value of a bit inside the object | ||
465 | 4 | |||
466 | 5 | - create a ISO8583Util Class that give some util method like: | ||
467 | 6 | - intToBCD | ||
468 | 7 | - BCDToInt | ||
469 | 8 | - getTimeGMT (to bit 12) | ||
470 | 9 | - GetDateType (to bit 13) | ||
471 | 10 | |||
472 | 11 | Fix: | ||
473 | 12 | |||
474 | 13 | - ... | ||
475 | 14 | |||
476 | 15 | Think about: | ||
477 | 16 | |||
478 | 17 | - Improve ... improve ... improve | ||
479 | 18 | |||
480 | 19 | - Add support to "BCD" sizes in LL LLL types. | ||
481 | 20 | ASCII LL size and ASCII value inside '123456' -> '06123456' | ||
482 | 21 | BCD LL size and ASCII value inside '123456' -> '\x06' + '123456' | ||
483 | 22 | ASCII LLL size and ASCII value inside '123456' -> '006123456' | ||
484 | 23 | BCD LLL size and ASCII value inside '123456' -> '\x00\x06' + '123456' | ||
485 | 24 | |||
486 | 25 | - Improve support to "binary" data | ||
487 | 26 | i.setBit(3,'\x00\x01\x02') | ||
488 | 27 | |||
489 | 28 | - Make sense setBit(1,'xxx') ? | ||
490 | 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... | ||
491 | 30 | But .. Today work :) by the way ... xxx is ignored... | ||
492 | 31 | |||
493 | 32 | - It's important separate the size and the value of LL and LLL types? | ||
494 | 33 | Example, bit 2 is LL: | ||
495 | 34 | Today -> i.setBit(2,'123') -> i.getBit(2) -> 03123 | ||
496 | 35 | Think -> i.setBit(2,'123') -> i.getBit(2) -> 123 | ||
497 | 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)) ... | ||
498 | 37 | If the partner send a ISO8583 with wrong size? | ||
499 | 38 | |||
500 | 39 | - Make a XML builder that convert a ISO8583 to a XML object and a XML to ISO8583... | ||
501 | 40 | <ISO8583> | ||
502 | 41 | <mti>0200</mti> | ||
503 | 42 | <bitmap>600000000000000</bitmap> | ||
504 | 43 | <bits> | ||
505 | 44 | <bit> | ||
506 | 45 | <number>2</number> | ||
507 | 46 | <value>03123</value> | ||
508 | 47 | <type>LL</type> | ||
509 | 48 | </bit> | ||
510 | 49 | <bit> | ||
511 | 50 | <number>3</number> | ||
512 | 51 | <value>300000</value> | ||
513 | 52 | <type>N</type> | ||
514 | 53 | </bit> | ||
515 | 54 | </bits> | ||
516 | 55 | </ISO8583> | ||
517 | 56 | |||
518 | 57 | - Use log4Python to improve debug information | ||
519 | 58 | |||
520 | 59 | - Support Python V3 | ||
521 | 60 | |||
522 | 61 | - Improve errors: | ||
523 | 62 | - validate values | ||
524 | 63 | |||
525 | 64 | - Improve the package name / structure | ||
526 | 65 | - today: FROM ISO8583.ISO8583 import ISO8583 | ||
527 | 66 | - future: FROM iso8583 import ISO8583 | ||
528 | 67 | |||
529 | 68 | - Create more examples | ||
530 | 69 | |||
531 | 70 | - Create benchmarks with JPOS | ||
532 | 71 | |||
533 | 72 | - Support EBCDIC ... | ||
534 | 73 | |||
535 | 74 | - ... | ||
536 | 0 | \ No newline at end of file | 75 | \ No newline at end of file |
537 | 1 | 76 | ||
538 | === modified file 'debian/changelog' | |||
539 | --- debian/changelog 2009-08-27 15:34:49 +0000 | |||
540 | +++ debian/changelog 2012-07-25 06:33:20 +0000 | |||
541 | @@ -1,3 +1,12 @@ | |||
542 | 1 | python-iso8583 (1.2-0ubuntu1) quantal; urgency=low | ||
543 | 2 | |||
544 | 3 | * New upstream release. | ||
545 | 4 | * debian/rules: Update build structure to satisfy Lintian. | ||
546 | 5 | * Bump Standards-Version to 3.9.3. | ||
547 | 6 | * Add ${misc:Depends} to python-iso8583 binary. | ||
548 | 7 | |||
549 | 8 | -- Logan Rosen <logatronico@gmail.com> Wed, 25 Jul 2012 02:25:14 -0400 | ||
550 | 9 | |||
551 | 1 | python-iso8583 (1.1-1) unstable; urgency=low | 10 | python-iso8583 (1.1-1) unstable; urgency=low |
552 | 2 | 11 | ||
553 | 3 | * Initial release (Closes: #539097) | 12 | * Initial release (Closes: #539097) |
554 | 4 | 13 | ||
555 | === modified file 'debian/control' | |||
556 | --- debian/control 2009-08-27 15:34:49 +0000 | |||
557 | +++ debian/control 2012-07-25 06:33:20 +0000 | |||
558 | @@ -1,11 +1,12 @@ | |||
559 | 1 | Source: python-iso8583 | 1 | Source: python-iso8583 |
560 | 2 | Section: python | 2 | Section: python |
561 | 3 | Priority: optional | 3 | Priority: optional |
563 | 4 | Maintainer: Mauro Lizaur <mauro@cacavoladora.org> | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
564 | 5 | XSBC-Original-Maintainer: Mauro Lizaur <mauro@cacavoladora.org> | ||
565 | 5 | Uploaders: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org> | 6 | Uploaders: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org> |
566 | 6 | Build-Depends: debhelper (>= 7) | 7 | Build-Depends: debhelper (>= 7) |
567 | 7 | Build-Depends-Indep: python (>= 2.4), python-setuptools, python-support (>= 0.6.4) | 8 | Build-Depends-Indep: python (>= 2.4), python-setuptools, python-support (>= 0.6.4) |
569 | 8 | Standards-Version: 3.8.3 | 9 | Standards-Version: 3.9.3 |
570 | 9 | Vcs-Svn: svn://svn.debian.org/python-modules/packages/python-iso8583/trunk | 10 | Vcs-Svn: svn://svn.debian.org/python-modules/packages/python-iso8583/trunk |
571 | 10 | Vcs-Browser: http://svn.debian.org/wsvn/python-modules/packages/python-iso8583/trunk/?op=log | 11 | Vcs-Browser: http://svn.debian.org/wsvn/python-modules/packages/python-iso8583/trunk/?op=log |
572 | 11 | Homepage: http://code.google.com/p/iso8583py/ | 12 | Homepage: http://code.google.com/p/iso8583py/ |
573 | @@ -13,7 +14,7 @@ | |||
574 | 13 | 14 | ||
575 | 14 | Package: python-iso8583 | 15 | Package: python-iso8583 |
576 | 15 | Architecture: all | 16 | Architecture: all |
578 | 16 | Depends: ${python:Depends} | 17 | Depends: ${python:Depends}, ${misc:Depends} |
579 | 17 | Description: library for ISO 8583 transactions | 18 | Description: library for ISO 8583 transactions |
580 | 18 | This library provides a pure Python interface for electronic | 19 | This library provides a pure Python interface for electronic |
581 | 19 | transactions using ISO 8583 ("Standard for Financial Transaction | 20 | transactions using ISO 8583 ("Standard for Financial Transaction |
582 | 20 | 21 | ||
583 | === modified file 'debian/rules' | |||
584 | --- debian/rules 2009-08-27 15:34:49 +0000 | |||
585 | +++ debian/rules 2012-07-25 06:33:20 +0000 | |||
586 | @@ -6,7 +6,9 @@ | |||
587 | 6 | PYVERS=$(shell pyversions -r) | 6 | PYVERS=$(shell pyversions -r) |
588 | 7 | d=debian/python-iso8583 | 7 | d=debian/python-iso8583 |
589 | 8 | 8 | ||
591 | 9 | build: build-stamp | 9 | build: build-arch build-indep |
592 | 10 | build-arch: build-stamp | ||
593 | 11 | build-indep: build-stamp | ||
594 | 10 | 12 | ||
595 | 11 | build-stamp: | 13 | build-stamp: |
596 | 12 | dh_testdir | 14 | dh_testdir |
597 | 13 | 15 | ||
598 | === modified file 'doc/ISO8583.ISO8583.html' | |||
599 | --- doc/ISO8583.ISO8583.html 2009-08-27 15:34:49 +0000 | |||
600 | +++ doc/ISO8583.ISO8583.html 2012-07-25 06:33:20 +0000 | |||
601 | @@ -6,7 +6,7 @@ | |||
602 | 6 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> | 6 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> |
603 | 7 | <tr bgcolor="#7799ee"> | 7 | <tr bgcolor="#7799ee"> |
604 | 8 | <td valign=bottom> <br> | 8 | <td valign=bottom> <br> |
606 | 9 | <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="ISO8583.html"><font color="#ffffff">ISO8583</font></a>.ISO8583</strong></big></big> (version 0.2)</font></td | 9 | <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="ISO8583.html"><font color="#ffffff">ISO8583</font></a>.ISO8583</strong></big></big> (version 1.2)</font></td |
607 | 10 | ><td align=right valign=bottom | 10 | ><td align=right valign=bottom |
608 | 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> |
609 | 12 | <p><tt>(C) Copyright 2009 Igor V. Custodio<br> | 12 | <p><tt>(C) Copyright 2009 Igor V. Custodio<br> |
610 | @@ -48,7 +48,39 @@ | |||
611 | 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> |
612 | 49 | 49 | ||
613 | 50 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> | 50 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
615 | 51 | <td colspan=2><tt>Main Class to work with <a href="#ISO8583">ISO8583</a> packages.<br> </tt></td></tr> | 51 | <td colspan=2><tt>Main Class to work with <a href="#ISO8583">ISO8583</a> packages.<br> |
616 | 52 | Used to create, change, send, receive, parse or work with ISO8593 Package version 1993.<br> | ||
617 | 53 | It's 100% Python :)<br> | ||
618 | 54 | Enjoy it!<br> | ||
619 | 55 | Thanks to: Vulcanno IT Solutions <<a href="http://www.vulcanno.com.br">http://www.vulcanno.com.br</a>><br> | ||
620 | 56 | Licence: GPL Version 3<br> | ||
621 | 57 | More information: <a href="http://code.google.com/p/iso8583py/">http://code.google.com/p/iso8583py/</a><br> | ||
622 | 58 | <br> | ||
623 | 59 | Example:<br> | ||
624 | 60 | from <a href="#ISO8583">ISO8583</a>.<a href="#ISO8583">ISO8583</a> import <a href="#ISO8583">ISO8583</a><br> | ||
625 | 61 | from <a href="#ISO8583">ISO8583</a>.ISOErrors import *<br> | ||
626 | 62 | <br> | ||
627 | 63 | iso = <a href="#ISO8583">ISO8583</a>()<br> | ||
628 | 64 | try:<br> | ||
629 | 65 | iso.<a href="#ISO8583-setMTI">setMTI</a>('0800')<br> | ||
630 | 66 | iso.<a href="#ISO8583-setBit">setBit</a>(2,2)<br> | ||
631 | 67 | iso.<a href="#ISO8583-setBit">setBit</a>(4,4)<br> | ||
632 | 68 | iso.<a href="#ISO8583-setBit">setBit</a>(12,12)<br> | ||
633 | 69 | iso.<a href="#ISO8583-setBit">setBit</a>(21,21)<br> | ||
634 | 70 | iso.<a href="#ISO8583-setBit">setBit</a>(17,17)<br> | ||
635 | 71 | iso.<a href="#ISO8583-setBit">setBit</a>(49,986)<br> | ||
636 | 72 | iso.<a href="#ISO8583-setBit">setBit</a>(99,99)<br> | ||
637 | 73 | except ValueToLarge, e:<br> | ||
638 | 74 | print ('Value too large :( %s' % e)<br> | ||
639 | 75 | except InvalidMTI, i:<br> | ||
640 | 76 | print ('This MTI is wrong :( %s' % i)<br> | ||
641 | 77 | <br> | ||
642 | 78 | print ('The Message Type Indication is = %s' %iso.<a href="#ISO8583-getMTI">getMTI</a>()) <br> | ||
643 | 79 | <br> | ||
644 | 80 | print ('The Bitmap is = %s' %iso.<a href="#ISO8583-getBitmap">getBitmap</a>()) <br> | ||
645 | 81 | iso.<a href="#ISO8583-showIsoBits">showIsoBits</a>();<br> | ||
646 | 82 | print ('This is the <a href="#ISO8583">ISO8583</a> complete package %s' % iso.<a href="#ISO8583-getRawIso">getRawIso</a>())<br> | ||
647 | 83 | print ('This is the <a href="#ISO8583">ISO8583</a> complete package to sent over the TCPIP network %s' % iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>())<br> </tt></td></tr> | ||
648 | 52 | <tr><td> </td> | 84 | <tr><td> </td> |
649 | 53 | <td width="100%">Methods defined here:<br> | 85 | <td width="100%">Methods defined here:<br> |
650 | 54 | <dl><dt><a name="ISO8583-__cmp__"><strong>__cmp__</strong></a>(self, obj2)</dt><dd><tt>Method that compare two objects in "==", "!=" and other things<br> | 86 | <dl><dt><a name="ISO8583-__cmp__"><strong>__cmp__</strong></a>(self, obj2)</dt><dd><tt>Method that compare two objects in "==", "!=" and other things<br> |
651 | @@ -69,9 +101,9 @@ | |||
652 | 69 | <br> | 101 | <br> |
653 | 70 | print 'Is equivalent?'<br> | 102 | print 'Is equivalent?'<br> |
654 | 71 | if p1 == p1:<br> | 103 | if p1 == p1:<br> |
656 | 72 | print 'Yes :)'<br> | 104 | print ('Yes :)')<br> |
657 | 73 | else:<br> | 105 | else:<br> |
659 | 74 | print 'Noooooooooo :('<br> | 106 | print ('Noooooooooo :(')<br> |
660 | 75 | <br> | 107 | <br> |
661 | 76 | @param: obj2 -> object that will be compared<br> | 108 | @param: obj2 -> object that will be compared<br> |
662 | 77 | @return: <0 if is not equal, 0 if is equal</tt></dd></dl> | 109 | @return: <0 if is not equal, 0 if is equal</tt></dd></dl> |
663 | @@ -120,7 +152,7 @@ | |||
664 | 120 | <br> | 152 | <br> |
665 | 121 | v1 = p1.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br> | 153 | v1 = p1.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br> |
666 | 122 | for v in v1:<br> | 154 | for v in v1:<br> |
668 | 123 | print 'Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value'])<br> | 155 | print ('Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value']))<br> |
669 | 124 | <br> | 156 | <br> |
670 | 125 | @return: array of values.</tt></dd></dl> | 157 | @return: array of values.</tt></dd></dl> |
671 | 126 | 158 | ||
672 | @@ -146,7 +178,7 @@ | |||
673 | 146 | netIso += ascii<br> | 178 | netIso += ascii<br> |
674 | 147 | # Example: big-endian<br> | 179 | # Example: big-endian<br> |
675 | 148 | # To little-endian, replace 'iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>()' with 'iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>(False)'<br> | 180 | # To little-endian, replace 'iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>()' with 'iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>(False)'<br> |
677 | 149 | print 'This <%s> the same that <%s>' % (iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>(),netIso)<br> | 181 | print ('This <%s> the same that <%s>' % (iso.<a href="#ISO8583-getNetworkISO">getNetworkISO</a>(),netIso))<br> |
678 | 150 | <br> | 182 | <br> |
679 | 151 | @param: bigEndian (True|False) -> if you want that the size be represented in this way. <br> | 183 | @param: bigEndian (True|False) -> if you want that the size be represented in this way. <br> |
680 | 152 | @return: size + ASCII <a href="#ISO8583">ISO8583</a> package ready to go to the network!<br> | 184 | @return: size + ASCII <a href="#ISO8583">ISO8583</a> package ready to go to the network!<br> |
681 | @@ -162,7 +194,7 @@ | |||
682 | 162 | iso.<a href="#ISO8583-setBit">setBit</a>(17,17)<br> | 194 | iso.<a href="#ISO8583-setBit">setBit</a>(17,17)<br> |
683 | 163 | iso.<a href="#ISO8583-setBit">setBit</a>(99,99)<br> | 195 | iso.<a href="#ISO8583-setBit">setBit</a>(99,99)<br> |
684 | 164 | str = iso.<a href="#ISO8583-getRawIso">getRawIso</a>()<br> | 196 | str = iso.<a href="#ISO8583-getRawIso">getRawIso</a>()<br> |
686 | 165 | print 'This is the ASCII package %s' % str <br> | 197 | print ('This is the ASCII package %s' % str) <br> |
687 | 166 | output (print) -> This is the ASCII package 0800d010800000000000000000002000000001200000000000400001200170299<br> | 198 | output (print) -> This is the ASCII package 0800d010800000000000000000002000000001200000000000400001200170299<br> |
688 | 167 | <br> | 199 | <br> |
689 | 168 | @return: str with complete ASCII <a href="#ISO8583">ISO8583</a><br> | 200 | @return: str with complete ASCII <a href="#ISO8583">ISO8583</a><br> |
690 | @@ -205,7 +237,7 @@ | |||
691 | 205 | print 'This ISO has bits:'<br> | 237 | print 'This ISO has bits:'<br> |
692 | 206 | v3 = i2.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br> | 238 | v3 = i2.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br> |
693 | 207 | for v in v3:<br> | 239 | for v in v3:<br> |
695 | 208 | print 'Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value'])<br> | 240 | print ('Bit %s of type %s with value = %s' % (v['bit'],v['type'],v['value']))<br> |
696 | 209 | <br> | 241 | <br> |
697 | 210 | @param: str -> complete <a href="#ISO8583">ISO8583</a> string<br> | 242 | @param: str -> complete <a href="#ISO8583">ISO8583</a> string<br> |
698 | 211 | @raise: InvalidIso8583 Exception</tt></dd></dl> | 243 | @raise: InvalidIso8583 Exception</tt></dd></dl> |
699 | @@ -236,7 +268,7 @@ | |||
700 | 236 | #newIso.<a href="#ISO8583-setIsoContent">setIsoContent</a>(netIso[2:size])<br> | 268 | #newIso.<a href="#ISO8583-setIsoContent">setIsoContent</a>(netIso[2:size])<br> |
701 | 237 | arr = newIso.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br> | 269 | arr = newIso.<a href="#ISO8583-getBitsAndValues">getBitsAndValues</a>()<br> |
702 | 238 | for v in arr:<br> | 270 | for v in arr:<br> |
704 | 239 | print 'Bit %s Type %s Value = %s' % (v['bit'],v['type'],v['value'])<br> | 271 | print ('Bit %s Type %s Value = %s' % (v['bit'],v['type'],v['value']))<br> |
705 | 240 | <br> | 272 | <br> |
706 | 241 | @param: iso -> str that represents size + ASCII <a href="#ISO8583">ISO8583</a> package<br> | 273 | @param: iso -> str that represents size + ASCII <a href="#ISO8583">ISO8583</a> package<br> |
707 | 242 | @param: bigEndian (True|False) -> Codification of the size.<br> | 274 | @param: bigEndian (True|False) -> Codification of the size.<br> |
708 | @@ -287,7 +319,7 @@ | |||
709 | 287 | <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> | 319 | <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> |
710 | 288 | <td width="100%"><strong>__author__</strong> = 'Igor Vitorio Custodio <igorvc@vulcanno.com.br>'<br> | 320 | <td width="100%"><strong>__author__</strong> = 'Igor Vitorio Custodio <igorvc@vulcanno.com.br>'<br> |
711 | 289 | <strong>__licence__</strong> = 'GPL V3'<br> | 321 | <strong>__licence__</strong> = 'GPL V3'<br> |
713 | 290 | <strong>__version__</strong> = '0.2'</td></tr></table><p> | 322 | <strong>__version__</strong> = '1.2'</td></tr></table><p> |
714 | 291 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | 323 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
715 | 292 | <tr bgcolor="#7799ee"> | 324 | <tr bgcolor="#7799ee"> |
716 | 293 | <td colspan=3 valign=bottom> <br> | 325 | <td colspan=3 valign=bottom> <br> |
717 | 294 | 326 | ||
718 | === added file 'doc/index.html' | |||
719 | --- doc/index.html 1970-01-01 00:00:00 +0000 | |||
720 | +++ doc/index.html 2012-07-25 06:33:20 +0000 | |||
721 | @@ -0,0 +1,10 @@ | |||
722 | 1 | <html> | ||
723 | 2 | <head> | ||
724 | 3 | <title>One second ...</title> | ||
725 | 4 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | ||
726 | 5 | <meta http-equiv="refresh" content="0;URL=ISO8583.html"> | ||
727 | 6 | </head> | ||
728 | 7 | |||
729 | 8 | <body> | ||
730 | 9 | </body> | ||
731 | 10 | </html> | ||
732 | 0 | \ No newline at end of file | 11 | \ No newline at end of file |
733 | 1 | 12 | ||
734 | === modified file 'examples/echoClient.py' | |||
735 | --- examples/echoClient.py 2009-08-27 15:34:49 +0000 | |||
736 | +++ examples/echoClient.py 2012-07-25 06:33:20 +0000 | |||
737 | @@ -26,7 +26,7 @@ | |||
738 | 26 | 26 | ||
739 | 27 | 27 | ||
740 | 28 | # Configure the client | 28 | # Configure the client |
742 | 29 | serverIP = "192.168.0.100" | 29 | serverIP = "192.168.0.103" |
743 | 30 | serverPort = 8583 | 30 | serverPort = 8583 |
744 | 31 | numberEcho = 5 | 31 | numberEcho = 5 |
745 | 32 | timeBetweenEcho = 5 # in seconds | 32 | timeBetweenEcho = 5 # in seconds |
746 | @@ -50,7 +50,7 @@ | |||
747 | 50 | continue | 50 | continue |
748 | 51 | break | 51 | break |
749 | 52 | if s is None: | 52 | if s is None: |
751 | 53 | print 'Could not connect :(' | 53 | print ('Could not connect :(') |
752 | 54 | sys.exit(1) | 54 | sys.exit(1) |
753 | 55 | 55 | ||
754 | 56 | 56 | ||
755 | @@ -67,19 +67,19 @@ | |||
756 | 67 | try: | 67 | try: |
757 | 68 | message = iso.getNetworkISO() | 68 | message = iso.getNetworkISO() |
758 | 69 | s.send(message) | 69 | s.send(message) |
760 | 70 | print 'Sending ... %s' % message | 70 | print ('Sending ... %s' % message) |
761 | 71 | ans = s.recv(2048) | 71 | ans = s.recv(2048) |
763 | 72 | print "\nInput ASCII |%s|" % ans | 72 | print ("\nInput ASCII |%s|" % ans) |
764 | 73 | isoAns = ISO8583() | 73 | isoAns = ISO8583() |
765 | 74 | isoAns.setNetworkISO(ans) | 74 | isoAns.setNetworkISO(ans) |
766 | 75 | v1 = isoAns.getBitsAndValues() | 75 | v1 = isoAns.getBitsAndValues() |
767 | 76 | for v in v1: | 76 | for v in v1: |
769 | 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'])) |
770 | 78 | 78 | ||
771 | 79 | if isoAns.getMTI() == '0810': | 79 | if isoAns.getMTI() == '0810': |
773 | 80 | print "\tThat's great !!! The server understand my message !!!" | 80 | print ("\tThat's great !!! The server understand my message !!!") |
774 | 81 | else: | 81 | else: |
776 | 82 | print "The server dosen't understand my message!" | 82 | print ("The server dosen't understand my message!") |
777 | 83 | 83 | ||
778 | 84 | except InvalidIso8583, ii: | 84 | except InvalidIso8583, ii: |
779 | 85 | print ii | 85 | print ii |
780 | @@ -92,19 +92,19 @@ | |||
781 | 92 | try: | 92 | try: |
782 | 93 | message = iso.getNetworkISO(False) | 93 | message = iso.getNetworkISO(False) |
783 | 94 | s.send(message) | 94 | s.send(message) |
785 | 95 | print 'Sending ... %s' % message | 95 | print ('Sending ... %s' % message) |
786 | 96 | ans = s.recv(2048) | 96 | ans = s.recv(2048) |
788 | 97 | print "\nInput ASCII |%s|" % ans | 97 | print ("\nInput ASCII |%s|" % ans) |
789 | 98 | isoAns = ISO8583() | 98 | isoAns = ISO8583() |
790 | 99 | isoAns.setNetworkISO(ans,False) | 99 | isoAns.setNetworkISO(ans,False) |
791 | 100 | v1 = isoAns.getBitsAndValues() | 100 | v1 = isoAns.getBitsAndValues() |
792 | 101 | for v in v1: | 101 | for v in v1: |
794 | 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'])) |
795 | 103 | 103 | ||
796 | 104 | if isoAns.getMTI() == '0810': | 104 | if isoAns.getMTI() == '0810': |
798 | 105 | print "\tThat's great !!! The server understand my message !!!" | 105 | print ("\tThat's great !!! The server understand my message !!!") |
799 | 106 | else: | 106 | else: |
801 | 107 | print "The server dosen't understand my message!" | 107 | print ("The server dosen't understand my message!") |
802 | 108 | 108 | ||
803 | 109 | except InvalidIso8583, ii: | 109 | except InvalidIso8583, ii: |
804 | 110 | print ii | 110 | print ii |
805 | @@ -114,6 +114,6 @@ | |||
806 | 114 | 114 | ||
807 | 115 | 115 | ||
808 | 116 | 116 | ||
810 | 117 | print 'Closing...' | 117 | print ('Closing...') |
811 | 118 | s.close() | 118 | s.close() |
812 | 119 | 119 | ||
813 | 120 | \ No newline at end of file | 120 | \ No newline at end of file |
814 | 121 | 121 | ||
815 | === modified file 'examples/echoServer.py' | |||
816 | --- examples/echoServer.py 2009-08-27 15:34:49 +0000 | |||
817 | +++ examples/echoServer.py 2012-07-25 06:33:20 +0000 | |||
818 | @@ -23,7 +23,7 @@ | |||
819 | 23 | from socket import * | 23 | from socket import * |
820 | 24 | 24 | ||
821 | 25 | # Configure the server | 25 | # Configure the server |
823 | 26 | serverIP = "192.168.0.100" | 26 | serverIP = "192.168.0.103" |
824 | 27 | serverPort = 8583 | 27 | serverPort = 8583 |
825 | 28 | maxConn = 5 | 28 | maxConn = 5 |
826 | 29 | bigEndian = True | 29 | bigEndian = True |
827 | @@ -46,7 +46,7 @@ | |||
828 | 46 | # receive message | 46 | # receive message |
829 | 47 | isoStr = connection.recv(2048) | 47 | isoStr = connection.recv(2048) |
830 | 48 | if isoStr: | 48 | if isoStr: |
832 | 49 | print "\nInput ASCII |%s|" % isoStr | 49 | print ("\nInput ASCII |%s|" % isoStr) |
833 | 50 | pack = ISO8583() | 50 | pack = ISO8583() |
834 | 51 | #parse the iso | 51 | #parse the iso |
835 | 52 | try: | 52 | try: |
836 | @@ -57,12 +57,12 @@ | |||
837 | 57 | 57 | ||
838 | 58 | v1 = pack.getBitsAndValues() | 58 | v1 = pack.getBitsAndValues() |
839 | 59 | for v in v1: | 59 | for v in v1: |
841 | 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'])) |
842 | 61 | 61 | ||
843 | 62 | if pack.getMTI() == '0800': | 62 | if pack.getMTI() == '0800': |
845 | 63 | print "\tThat's great !!! The client send a correct message !!!" | 63 | print ("\tThat's great !!! The client send a correct message !!!") |
846 | 64 | else: | 64 | else: |
848 | 65 | print "The client dosen't send the correct message!" | 65 | print ("The client dosen't send the correct message!") |
849 | 66 | break | 66 | break |
850 | 67 | 67 | ||
851 | 68 | 68 | ||
852 | @@ -70,7 +70,7 @@ | |||
853 | 70 | print ii | 70 | print ii |
854 | 71 | break | 71 | break |
855 | 72 | except: | 72 | except: |
857 | 73 | print 'Something happened!!!!' | 73 | print ('Something happened!!!!') |
858 | 74 | break | 74 | break |
859 | 75 | 75 | ||
860 | 76 | #send answer | 76 | #send answer |
861 | @@ -81,11 +81,11 @@ | |||
862 | 81 | else: | 81 | else: |
863 | 82 | ans = pack.getNetworkISO(False) | 82 | ans = pack.getNetworkISO(False) |
864 | 83 | 83 | ||
866 | 84 | print 'Sending answer %s' % ans | 84 | print ('Sending answer %s' % ans) |
867 | 85 | connection.send(ans) | 85 | connection.send(ans) |
868 | 86 | 86 | ||
869 | 87 | else: | 87 | else: |
870 | 88 | break | 88 | break |
871 | 89 | # close socket | 89 | # close socket |
872 | 90 | connection.close() | 90 | connection.close() |
873 | 91 | print "Closed..." | ||
874 | 92 | \ No newline at end of file | 91 | \ No newline at end of file |
875 | 92 | print ("Closed...") | ||
876 | 93 | \ No newline at end of file | 93 | \ No newline at end of file |
877 | 94 | 94 | ||
878 | === modified file 'examples/example1.py' | |||
879 | --- examples/example1.py 2009-08-27 15:34:49 +0000 | |||
880 | +++ examples/example1.py 2012-07-25 06:33:20 +0000 | |||
881 | @@ -29,13 +29,13 @@ | |||
882 | 29 | p = ISO8583() | 29 | p = ISO8583() |
883 | 30 | #some string describing the transation type | 30 | #some string describing the transation type |
884 | 31 | transation = "200" | 31 | transation = "200" |
886 | 32 | print 'Setting transation type to %s' % transation | 32 | print ('Setting transation type to %s' % transation) |
887 | 33 | p.setTransationType(transation) | 33 | p.setTransationType(transation) |
888 | 34 | # Is the same that: | 34 | # Is the same that: |
889 | 35 | #p.setMTI(transation) | 35 | #p.setMTI(transation) |
890 | 36 | 36 | ||
891 | 37 | #Some tests and | 37 | #Some tests and |
893 | 38 | print 'Setting bits' | 38 | print ('Setting bits') |
894 | 39 | 39 | ||
895 | 40 | p.setBit(3,"100000") | 40 | p.setBit(3,"100000") |
896 | 41 | p.setBit(4,1200) | 41 | p.setBit(4,1200) |
897 | @@ -53,47 +53,47 @@ | |||
898 | 53 | try: | 53 | try: |
899 | 54 | p.setBit(126,"00000000000000105") | 54 | p.setBit(126,"00000000000000105") |
900 | 55 | except ValueToLarge: | 55 | except ValueToLarge: |
902 | 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!!!!') |
903 | 57 | #if want more information ... | 57 | #if want more information ... |
904 | 58 | #traceback.print_exc() | 58 | #traceback.print_exc() |
905 | 59 | 59 | ||
906 | 60 | #show hex bitmap | 60 | #show hex bitmap |
908 | 61 | print 'Bitmap in HEX' | 61 | print ('Bitmap in HEX') |
909 | 62 | p.showBitmap() | 62 | p.showBitmap() |
910 | 63 | 63 | ||
911 | 64 | #Show bits | 64 | #Show bits |
913 | 65 | print 'Bits with values' | 65 | print ('Bits with values') |
914 | 66 | p.showIsoBits() | 66 | p.showIsoBits() |
915 | 67 | 67 | ||
916 | 68 | # Show raw ASCII ISO | 68 | # Show raw ASCII ISO |
918 | 69 | print 'The package is -> ' | 69 | print ('The package is -> ') |
919 | 70 | p.showRawIso() | 70 | p.showRawIso() |
920 | 71 | 71 | ||
921 | 72 | # Getting bits... | 72 | # Getting bits... |
923 | 73 | print '\n\n\n------------------------------------------\n' | 73 | print ('\n\n\n------------------------------------------\n') |
924 | 74 | 74 | ||
926 | 75 | print 'Getting bits' | 75 | print ('Getting bits') |
927 | 76 | try: | 76 | try: |
930 | 77 | print 'Bit 7 is there? %s' % p.getBit(7) | 77 | print ('Bit 7 is there? %s' % p.getBit(7)) |
931 | 78 | print 'Bit 32 is there? %s' % p.getBit(32) | 78 | print ('Bit 32 is there? %s' % p.getBit(32)) |
932 | 79 | except: | 79 | except: |
934 | 80 | print 'Something is bad...' | 80 | print ('Something is bad...') |
935 | 81 | 81 | ||
936 | 82 | # Testing exceptions... | 82 | # Testing exceptions... |
937 | 83 | try: | 83 | try: |
939 | 84 | print 'Bit 45 is there? %s' % p.getBit(45) | 84 | print ('Bit 45 is there? %s' % p.getBit(45)) |
940 | 85 | except: | 85 | except: |
942 | 86 | print "No, this bit is not there :)" | 86 | print ("No, this bit is not there :)") |
943 | 87 | 87 | ||
944 | 88 | try: | 88 | try: |
946 | 89 | print 'Bit 27 is there? %s' % p.getBit(27) | 89 | print ('Bit 27 is there? %s' % p.getBit(27)) |
947 | 90 | except BitNotSet, bns: | 90 | except BitNotSet, bns: |
948 | 91 | print bns | 91 | print bns |
949 | 92 | 92 | ||
950 | 93 | 93 | ||
951 | 94 | #More exceptions... | 94 | #More exceptions... |
954 | 95 | print '\n\n\n------------------------------------------\n' | 95 | print ('\n\n\n------------------------------------------\n') |
955 | 96 | print 'Exeptions....' | 96 | print ('Exceptions....') |
956 | 97 | 97 | ||
957 | 98 | iso = ISO8583() | 98 | iso = ISO8583() |
958 | 99 | try: | 99 | try: |
959 | @@ -106,9 +106,9 @@ | |||
960 | 106 | iso.setBit(49,9861) # this bit is wrong ... | 106 | iso.setBit(49,9861) # this bit is wrong ... |
961 | 107 | iso.setBit(99,99) | 107 | iso.setBit(99,99) |
962 | 108 | except ValueToLarge, e: | 108 | except ValueToLarge, e: |
964 | 109 | print 'Value too large :( %s' % e | 109 | print ('Value too large :( %s' % e) |
965 | 110 | except InvalidMTI, i: | 110 | except InvalidMTI, i: |
967 | 111 | print 'This MTI is wrong :( %s' % i | 111 | print ('This MTI is wrong :( %s' % i) |
968 | 112 | 112 | ||
969 | 113 | 113 | ||
970 | 114 | 114 | ||
971 | 115 | 115 | ||
972 | === modified file 'examples/example2.py' | |||
973 | --- examples/example2.py 2009-08-27 15:34:49 +0000 | |||
974 | +++ examples/example2.py 2012-07-25 06:33:20 +0000 | |||
975 | @@ -35,8 +35,8 @@ | |||
976 | 35 | p2.setBit(17,17) | 35 | p2.setBit(17,17) |
977 | 36 | p2.setBit(99,99) | 36 | p2.setBit(99,99) |
978 | 37 | 37 | ||
981 | 38 | print 'The MTI is = %s' %p2.getMTI() | 38 | print ('The MTI is = %s' %p2.getMTI()) |
982 | 39 | print 'The Bitmap is = %s' %p2.getBitmap() | 39 | print ('The Bitmap is = %s' %p2.getBitmap()) |
983 | 40 | 40 | ||
984 | 41 | #Showing bits... | 41 | #Showing bits... |
985 | 42 | p2.showIsoBits(); | 42 | p2.showIsoBits(); |
986 | @@ -44,8 +44,8 @@ | |||
987 | 44 | #Save the ASCII ISO value without size | 44 | #Save the ASCII ISO value without size |
988 | 45 | iso = p2.getRawIso() | 45 | iso = p2.getRawIso() |
989 | 46 | 46 | ||
992 | 47 | print '\n\n\n------------------------------------------\n' | 47 | print ('\n\n\n------------------------------------------\n') |
993 | 48 | print 'This is the ISO <%s> that will be interpreted' % iso | 48 | print ('This is the ISO <%s> that will be interpreted' % iso) |
994 | 49 | 49 | ||
995 | 50 | # New ISO | 50 | # New ISO |
996 | 51 | i = ISO8583() | 51 | i = ISO8583() |
997 | @@ -53,21 +53,21 @@ | |||
998 | 53 | i.setIsoContent(iso) | 53 | i.setIsoContent(iso) |
999 | 54 | 54 | ||
1000 | 55 | # Showing that everything is ok | 55 | # Showing that everything is ok |
1004 | 56 | print 'The MTI is = %s' %i.getMTI() | 56 | print ('The MTI is = %s' %i.getMTI()) |
1005 | 57 | print 'The Bitmap is = %s' %i.getBitmap() | 57 | print ('The Bitmap is = %s' %i.getBitmap()) |
1006 | 58 | print 'Show bits inside the package' | 58 | print ('Show bits inside the package') |
1007 | 59 | i.showIsoBits() | 59 | i.showIsoBits() |
1008 | 60 | 60 | ||
1009 | 61 | # Using == to compare ISOS's | 61 | # Using == to compare ISOS's |
1011 | 62 | print 'Compare ISOs ...' | 62 | print ('Compare ISOs ...') |
1012 | 63 | if i == p2: | 63 | if i == p2: |
1014 | 64 | print 'They are equivalent!' | 64 | print ('They are equivalent!') |
1015 | 65 | 65 | ||
1016 | 66 | else: | 66 | else: |
1018 | 67 | print 'The are differente' | 67 | print ('The are differente') |
1019 | 68 | 68 | ||
1020 | 69 | # More example... | 69 | # More example... |
1022 | 70 | print '\n\n\n------------------------------------------\n' | 70 | print ('\n\n\n------------------------------------------\n') |
1023 | 71 | 71 | ||
1024 | 72 | i3=ISO8583() | 72 | i3=ISO8583() |
1025 | 73 | i3.setMTI('0800') | 73 | i3.setMTI('0800') |
1026 | @@ -79,6 +79,6 @@ | |||
1027 | 79 | 79 | ||
1028 | 80 | i3.showIsoBits() | 80 | i3.showIsoBits() |
1029 | 81 | 81 | ||
1031 | 82 | print 'This is the pack %s' %i3.getRawIso() | 82 | print ('This is the pack %s' %i3.getRawIso()) |
1032 | 83 | 83 | ||
1033 | 84 | 84 | ||
1034 | 85 | 85 | ||
1035 | === modified file 'examples/example3.py' | |||
1036 | --- examples/example3.py 2009-08-27 15:34:49 +0000 | |||
1037 | +++ examples/example3.py 2012-07-25 06:33:20 +0000 | |||
1038 | @@ -36,41 +36,41 @@ | |||
1039 | 36 | p2.setBit(17,17) | 36 | p2.setBit(17,17) |
1040 | 37 | p2.setBit(49,986) | 37 | p2.setBit(49,986) |
1041 | 38 | p2.setBit(99,99) | 38 | p2.setBit(99,99) |
1044 | 39 | print 'MTI = %s' %p2.getMTI() | 39 | print ('MTI = %s' %p2.getMTI()) |
1045 | 40 | print 'Bitmap = %s' %p2.getBitmap() | 40 | print ('Bitmap = %s' %p2.getBitmap()) |
1046 | 41 | p2.showIsoBits(); | 41 | p2.showIsoBits(); |
1047 | 42 | 42 | ||
1048 | 43 | 43 | ||
1049 | 44 | iso = p2.getRawIso() | 44 | iso = p2.getRawIso() |
1050 | 45 | #Show debug information of the parsing function | 45 | #Show debug information of the parsing function |
1053 | 46 | print '\n\n\n------------------------------------------\n' | 46 | print ('\n\n\n------------------------------------------\n') |
1054 | 47 | print 'Parsing ... <%s> ' % iso | 47 | print ('Parsing ... <%s> ' % iso) |
1055 | 48 | 48 | ||
1056 | 49 | 49 | ||
1057 | 50 | i = ISO8583() | 50 | i = ISO8583() |
1058 | 51 | i.setIsoContent(iso) | 51 | i.setIsoContent(iso) |
1059 | 52 | #Show information ... to compare | 52 | #Show information ... to compare |
1063 | 53 | print 'MTI = %s' %i.getMTI() | 53 | print ('MTI = %s' %i.getMTI()) |
1064 | 54 | print 'Bitmap = %s' %i.getBitmap() | 54 | print ('Bitmap = %s' %i.getBitmap()) |
1065 | 55 | print 'Here we have bits' | 55 | print ('Here we have bits') |
1066 | 56 | i.showIsoBits() | 56 | i.showIsoBits() |
1067 | 57 | 57 | ||
1068 | 58 | 58 | ||
1070 | 59 | print 'This is the bits and values (1)' | 59 | print ('This is the bits and values (1)') |
1071 | 60 | v1 = p2.getBitsAndValues() | 60 | v1 = p2.getBitsAndValues() |
1073 | 61 | print '\n%s\n' %v1 | 61 | print ('\n%s\n' %v1) |
1074 | 62 | 62 | ||
1076 | 63 | print 'This is the bits and values (2)' | 63 | print ('This is the bits and values (2)') |
1077 | 64 | v2 = i.getBitsAndValues() | 64 | v2 = i.getBitsAndValues() |
1079 | 65 | print '\n%s\n' %v2 | 65 | print ('\n%s\n' %v2) |
1080 | 66 | 66 | ||
1082 | 67 | print 'One way of printing the information ...!' | 67 | print ('One way of printing the information ...!') |
1083 | 68 | for v in v1: | 68 | for v in v1: |
1088 | 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'])) |
1089 | 70 | 70 | ||
1090 | 71 | 71 | ||
1091 | 72 | print 'Another way...' | 72 | print ('Another way...') |
1092 | 73 | for v in range(0,len(v2)): | 73 | for v in range(0,len(v2)): |
1094 | 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'])) |
1095 | 75 | 75 | ||
1096 | 76 | 76 | ||
1097 | 77 | 77 | ||
1098 | === modified file 'examples/example4.py' | |||
1099 | --- examples/example4.py 2009-08-27 15:34:49 +0000 | |||
1100 | +++ examples/example4.py 2012-07-25 06:33:20 +0000 | |||
1101 | @@ -43,32 +43,33 @@ | |||
1102 | 43 | ''' | 43 | ''' |
1103 | 44 | #i2 = ISO8583(debug=True) | 44 | #i2 = ISO8583(debug=True) |
1104 | 45 | i2 = ISO8583() | 45 | i2 = ISO8583() |
1105 | 46 | # in this case, we need to redefine a bit because default bit 42 is LL and in this especification is "N" | ||
1106 | 47 | # the rest remain, so we use get :) | ||
1107 | 48 | i2.redefineBit(42, '42', i2.getLargeBitName(42), 'N', i2.getBitLimit(42), i2.getBitValueType(42) ) | ||
1108 | 49 | |||
1109 | 50 | 46 | ||
1110 | 51 | iso2 = '0210B238000102C080040000000000000002100000000000001700010814465469421614465701081100301000000N399915444303500019991544986020 Value not allowed!!009000095492' | 47 | iso2 = '0210B238000102C080040000000000000002100000000000001700010814465469421614465701081100301000000N399915444303500019991544986020 Value not allowed!!009000095492' |
1113 | 52 | print '\n\n\n------------------------------------------\n' | 48 | print ('\n\n\n------------------------------------------\n') |
1114 | 53 | print 'This is the ISO <%s> parse it!' % iso2 | 49 | print ('This is the ISO <%s> parse it!' % iso2) |
1115 | 54 | 50 | ||
1116 | 55 | i2.setIsoContent(iso2) | 51 | i2.setIsoContent(iso2) |
1119 | 56 | print 'Bitmap = %s' %i2.getBitmap() | 52 | print ('Bitmap = %s' %i2.getBitmap()) |
1120 | 57 | print 'MTI = %s' %i2.getMTI() | 53 | print ('MTI = %s' %i2.getMTI()) |
1121 | 58 | 54 | ||
1123 | 59 | print 'Bits' | 55 | print ('Bits') |
1124 | 60 | v3 = i2.getBitsAndValues() | 56 | v3 = i2.getBitsAndValues() |
1125 | 61 | for v in v3: | 57 | for v in v3: |
1127 | 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'])) |
1128 | 63 | 59 | ||
1129 | 64 | 60 | ||
1130 | 61 | # in this case, we need to redefine a bit because default bit 42 is A and in this especification is "N" | ||
1131 | 62 | # the rest remain, so we use get's to copy original values :) | ||
1132 | 63 | i2.redefineBit(42, '42', i2.getLargeBitName(42), 'N', i2.getBitLimit(42), i2.getBitValueType(42) ) | ||
1133 | 64 | print ('\nBit 42 redefined...\n') | ||
1134 | 65 | |||
1135 | 65 | i3 = ISO8583(iso=iso2) | 66 | i3 = ISO8583(iso=iso2) |
1138 | 66 | print 'Bitmap = %s' %i3.getBitmap() | 67 | print ('Bitmap = %s' %i3.getBitmap()) |
1139 | 67 | print 'MTI = %s' %i3.getMTI() | 68 | print ('MTI = %s' %i3.getMTI()) |
1140 | 68 | 69 | ||
1142 | 69 | print 'Bits inside' | 70 | print ('Bits inside') |
1143 | 70 | v4 = i3.getBitsAndValues() | 71 | v4 = i3.getBitsAndValues() |
1144 | 71 | for v in v4: | 72 | for v in v4: |
1146 | 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'])) |
1147 | 73 | 74 | ||
1148 | 74 | 75 | ||
1149 | 75 | 76 | ||
1150 | === modified file 'setup.py' | |||
1151 | --- setup.py 2009-08-27 15:34:49 +0000 | |||
1152 | +++ setup.py 2012-07-25 06:33:20 +0000 | |||
1153 | @@ -1,8 +1,9 @@ | |||
1154 | 1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
1155 | 2 | 2 | ||
1156 | 3 | from distutils.core import setup | 3 | from distutils.core import setup |
1157 | 4 | |||
1158 | 4 | setup(name='ISO8583 Module', | 5 | setup(name='ISO8583 Module', |
1160 | 5 | version='1.1', | 6 | version='1.2', |
1161 | 6 | description='ISO8583 LIBRARY', | 7 | description='ISO8583 LIBRARY', |
1162 | 7 | author='Igor V. Custodio', | 8 | author='Igor V. Custodio', |
1163 | 8 | author_email='igorvc@vulcanno.com.br', | 9 | author_email='igorvc@vulcanno.com.br', |
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.