def to_str(self): iso = ISO8583() iso.setMTI(self.mti) iso.setBit(3, self.precessing_code) iso.setBit(7, self.trans_datetime) iso.setBit(11, self.sys_trace_id) iso.setBit(12, self.deal_time) iso.setBit(13, self.deal_date) iso.setBit(18, self.merchant_type) iso.setBit(32, self.acquire_institute_code) iso.setBit(33, self.forward_institute_code) iso.setBit(41, self.term_id) iso.setBit(42, self.merchant_id) iso.setBit(62, self.service.to_str()) iso.setBit(128, self.mac) data = iso.getRawIso() return data
def load(self): iso = ISO8583(iso=self.msg) self.mti = iso.getMTI() self.precessing_code = iso.getBit(3) self.trans_datetime = iso.getBit(7) self.sys_trace_id = iso.getBit(11) self.deal_time = iso.getBit(12) self.deal_date = iso.getBit(13) self.merchant_type = iso.getBit(18) self.acquire_institute_code = iso.getBit(32) self.forward_institute_code = iso.getBit(33) self.ack_code = iso.getBit(39) self.term_id = iso.getBit(41) self.merchant_id = iso.getBit(42) service_data = iso.getBit(62) self.service.load(service_data) self.mac = iso.getBit(128)
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ from posplat.ISO8583.ISO1583_BIT62 import ISO8583_BIT62 from posplat.ISO8583.ISO8583 import ISO8583 from posplat.ISO8583.ISOErrors import * import traceback import os os.system(['clear', 'cls'][os.name == 'nt']) # Testing some funcionalities p2 = ISO8583() p2.setMTI('0800') p2.setBit(2, 2) p2.setBit(4, 4) p2.setBit(12, 12) p2.setBit(17, 17) p2.setBit(99, 99) print('The MTI is = %s' % p2.getMTI()) print('The Bitmap is = %s' % p2.getBitmap()) # Showing bits... p2.showIsoBits() #Save the ASCII ISO value without size iso = p2.getRawIso()
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ from posplat.ISO8583.ISO8583 import ISO8583 from posplat.ISO8583.ISOErrors import * import traceback # Clean the shell import os os.system(['clear', 'cls'][os.name == 'nt']) # get new object p = ISO8583() #some string describing the transation type transation = "200" print('Setting transation type to %s' % transation) p.setTransationType(transation) # Is the same that: #p.setMTI(transation) #Some tests and print('Setting bits') p.setBit(3, "100000") p.setBit(4, 1200) p.setBit(7, "1207231505") p.setBit(11, 12) p.setBit(12, "231505")
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 0123456789012345 ----------------------------------------------- ---------------- 00 30 32 31 30 42 32 33 38 30 30 30 31 30 32 43 30 0210B238000102C0 01 38 30 30 34 30 30 30 30 30 30 30 30 30 30 30 30 8004000000000000 02 30 30 30 32 31 30 30 30 30 30 30 30 30 30 30 30 0002100000000000 03 30 30 31 37 30 30 30 31 30 38 31 34 34 36 35 34 0017000108144654 04 36 39 34 32 31 36 31 34 34 36 35 37 30 31 30 38 6942161446570108 05 31 31 30 30 33 30 31 30 30 30 30 30 30 4e 33 39 1100301000000N39 06 39 39 31 35 34 34 34 33 30 33 35 30 30 30 31 39 9915444303500019 07 39 39 31 35 34 34 39 38 36 30 32 30 20 56 61 6c 991544986020 Val 08 6f 72 20 6e 61 6f 20 70 65 72 6d 69 74 69 21 21 ue not allowed!! 09 30 30 39 30 30 30 30 39 35 34 39 32 009000095492 ''' # i2 = ISO8583(debug=True) i2 = ISO8583() iso2 = '0210B238000102C080040000000000000002100000000000001700010814465469421614465701081100301000000N399915444303500019991544986020 Value not allowed!!009000095492' print('\n\n\n------------------------------------------\n') print('This is the ISO <%s> parse it!' % iso2) i2.setIsoContent(iso2) print('Bitmap = %s' % i2.getBitmap()) print('MTI = %s' % i2.getMTI()) print('Bits') v3 = i2.getBitsAndValues() for v in v3: print('(1) Bit %s of type %s and value = %s' % (v['bit'], v['type'], v['value']))
along with this program. If not, see <http://www.gnu.org/licenses/>. """ from posplat.ISO8583.ISO8583 import ISO8583 from posplat.ISO8583.ISOErrors import * import traceback import os os.system(['clear', 'cls'][os.name == 'nt']) # Enable Debug Information # It's print a lot of information ... So only use if you are developping the library! p2 = ISO8583(debug=True) p2.setMTI('0800') p2.setBit(2, 2) p2.setBit(4, 4) p2.setBit(12, 12) p2.setBit(21, 21) p2.setBit(17, 17) p2.setBit(49, 986) p2.setBit(99, 99) print('MTI = %s' % p2.getMTI()) print('Bitmap = %s' % p2.getBitmap()) p2.showIsoBits() iso = p2.getRawIso() # Show debug information of the parsing function print('\n\n\n------------------------------------------\n')
s = socket.socket(af, socktype, proto) except socket.error, msg: s = None continue try: s.connect(sa) except socket.error, msg: s.close() s = None continue break if s is None: print('Could not connect :(') sys.exit(1) iso = ISO8583() iso.setMTI('0800') iso.setBit(3, '300000') iso.setBit(24, '045') iso.setBit(41, '11111111') iso.setBit(42, '222222222222222') iso.setBit(63, 'This is a Test Message') try: message = iso.getNetworkISO() s.send(message) print('Sending ... %s' % message) ans = s.recv(204800) print("\nInput ASCII |%s|" % ans) isoAns = ISO8583() isoAns.setNetworkISO(ans) v1 = isoAns.getBitsAndValues()
# bind it to the server port s.bind((serverIP, serverPort)) # Configure it to accept up to N simultaneous Clients waiting... s.listen(maxConn) # Run forever while 1: #wait new Client Connection connection, address = s.accept() while 1: # receive message isoStr = connection.recv(2048) if isoStr: print ("\nInput ASCII |%s|" % isoStr) pack = ISO8583() #parse the iso try: if bigEndian: pack.setNetworkISO(isoStr) else: pack.setNetworkISO(isoStr, False) v1 = pack.getBitsAndValues() for v in v1: print ('Bit %s of type %s with value = %s' % (v['bit'], v['type'], v['value'])) if pack.getMTI() == '0800': print ("\tThat's great !!! The client send a correct message !!!") else: print ("The client dosen't send the correct message!")