Wednesday, April 21, 2010

ISO 8583 of 1993

This ISO is about financial transactions being automated. I will explain the basics for any layman to interpret and even implement their own interface.
We will use the example of an ATM machine which has to communicate to the bank and eventually allow/deny the ATM user make some inquiries or perform some financial transactions.
We will refer to the ATM machine as TRANSMASTER, while the bank's software taking requests from the ATM, as ATM-BRIDGE.
Normally, the transmaster sends requests to the bridge. The bridge decodes the request to understand what the transmaster wants. Then the bridge gives some response to the transmaster.
A standard transmaster request entails 3 major parts i.e. Message Type Identifier (MTI), Bitmap field and the Data.
MTI-4 characters just before the start of the bitmaps. It denotes what type of message is contained and the expected function to be carried out on the message (simply; message class)
Bitmap is a collection of hexadecimal characters (16 xters in the message). You have to change this bitmap into binary format (Hexadecimal to Binary - Now, that's simple. Google it if you're not familiar with it.)
After you have obtained your binary format of the bitmap, each numeric in the binary format has some meaning. All zeros represent the absence of that field in the message. All 1s represent presence of that field in the message:
Example using balance inquiry:
From Transmaster:
02881100E0340541AEE1A0000000000C1000000016429933267099503331000038773609091110041409102111019131461086011084407820006RTPSID374299332670995033=09101211576876700000925410387736189771000ATM0047 00020047       40nhif001>NAIROBI                       KE009AT01O222 KESKES05SACCO10RTPSID966605SACCO

Response from Bridge:
03511110E0340541AEE1A4000000000C1000000016429933267099503331000038773609091110041409102111019131461086011084407820006RTPSID374299332670995033=09101211576876700000925410387736189771000ATM0047 00020047       40nhif001>NAIROBI                       KE009AT01O222 KESKES0600001KESD0000000371340002KESC0000002014200003KESD00000000000005SACCO10RTPSID966605SACCO

Breakdown of transmaster message:
0288
1100 //message type identifier
E0340541AEE1A000 //bitmap 1
0000000C10000000 //bitmap 2
16429933267......  //message data

Google on how to know the start and end of a field in the message. Note that some fields have fixed length while others have variable length.

//HOW TO DECODE THE BITMAP TO BINARY, INSERT/REMOVE A FIELD THEN RECONSTRUCT THE NEW BITMAP
Design a simple table with 2 columns. 1 column contains a hexadecimal character while the other contains it's binary equivalent. See sample below:
Hexa:        Binary:

00000
10001
20010
30011
40100
50101
60110
70111
81000
91001
A1010
B1011
C1100
D1101
E1110
F1111
               
string temp="";
for(int i=0;i
 temp+=getBinary(bitmap.Substring(i,1));//assumes you have a method for querying the DB and returning the equivalent binary to a given hexa.

You now have your binary representation. To inser/remove a field, count upto that field and toggle the value as1(insesrt) or 0 (remove).

Do the reverse to obtain your new bitmap.

That should be a good one for a start. Contact me for more info (onyangofred@yahoo.com)