thanks in advance for your help.
Walid.
http://www.nabble.com/file/p21174238/ISOMsg%2Bfrom%2BGemalto%2BPOS.doc
ISOMsg+from+Gemalto+POS.doc
--
View this message in context: http://www.nabble.com/Financial-message-with-stx-etx-and-lrc-tp21174238p21174238.html
Sent from the jPOS - Users mailing list archive at Nabble.com.
Example Send to Server:
STX: 02
Length: 008A0000
0x60: 60
TPDU: 00000000
MSGID: 0200
BITMAP: 3220448120E08008 {3,4,7,11,18,22,25,32,35,41,42,43,49,61}
MSG:
3- PCode (6): 000000
4- Amount (12): 000000000900
7- Transaction Date & Time (10): 1226105446
11- Trace (6): 000000
18- Merchant Type (4): 5999
22- POS Entry Mode (3): 0902
25- POS Condition Code (2): 001
32- Acquiring Inst ID (10): 0 0000402974
35- Track II (37): 32 601xxxxxxxxxxxxxDxxxxxxxxxxxxxxx
41- TermID (8): 3030303030313032 (00000102)
42- TermLoc (15): 303030343232303030303031303032 (000422000001002)
43- Merchant Name (40):
4D45524348414E5420544553542053484C554D4245524745414348524146494548202020204C424E
49- Currency Code (3): 0840
61- Terminal Serial Number (10): 30313044363038313030333936 (010 D608100396)
ETX: 03
LRC: F1
where:
posistion 0 : STX
posistion 1-->4 : length
posistion 5 :0x60
posistion 6-->9 : TPDU
posistion 10-->11 : MsgID
posistion 12-->19 : BitMap
posistion 20-->msglen -2 : msg data
posistion msglen -1 : ETX
posistion msglen : LRC.
Please advice
wshehab wrote:
>
> Dear all,
> i am trying to send a message from pos teminal connected to jpos server.
> you can find attached the message specification and a sample message
> also.i tried may channels and packager but i did not find any useful one
> to my case. could any one assist me and provide me with the rigth channel
> and how it works.
>
> thanks in advance for your help.
>
> Walid.
>
> http://www.nabble.com/file/p21174238/ISOMsg%2Bfrom%2BGemalto%2BPOS.doc
> ISOMsg+from+Gemalto+POS.doc
>
--
View this message in context: http://www.nabble.com/Financial-message-with-stx-etx-and-lrc-tp21174238p21174383.html
> you can find attached the message specification and a sample message
> also.
Not attached, but the target of a link given(got it).
> i tried may channels and packager but i did not find any useful one
> to my case. could any one assist me and provide me with the rigth
> channel and how it works.
Your Channel will need to absorb everything not truly part of the
message, so that it ma pass the message bytes down to the packager...
So the STX is skipped ahead of reading the length,
the padding bytes following the length are skipped,
I would include the 0x60 + TPDU in the header processing, reading the
whole message an stripping of the ETX +LRC (checking it here) before
passing the message bytes to the ISOMsg/packager to unpack.
Things 'wrong' with your 'example':-
- I can't get the length to match the data.
- Your example data do not match the field lengths (DE22 shows (3), but
holds '0902')
- It is not obvious if your message is character or a binary form, which
might help towards the length abnormality if you have a mix.
- In 61 you have the length repeated in the character representation of
the number, but it is absent from the 42 repeat whereas 32 is missing
the 1 so has a typo?!
- You need to sort out the lengths - DE 35 as an example is not 37
bytes, but perhaps this is the maximum length rather than the actual?
Things you need to ascertain sooner rather than later:-
- What is the format of the length field and does it represent the
length of just the message, or the whole packet (STX->ETX) or something
else.
- What is the algorithm for checking and making the LRC.
- The format of each field (check the specification) - this will help
you pick or make a packager.
So in summary. You will need a custom Channel to handle the packing
around the message, but I would think an existing packager would be a
close fit, once you get the field formats.
Do you have any control of the terminal message format or transport? Is
this the serial conversation sent of TCP/IP? I wonder if the
terminal(s) can be reconfigured?
--
Mark
wshehab wrote:
>
> Dear all,
> i am trying to send a message from pos teminal connected to jpos server.
> you can find attached the message specification and a sample message
> also.i tried may channels and packager but i did not find any useful one
> to my case. could any one assist me and provide me with the rigth channel
> and how it works.
>
> thanks in advance for your help.
>
> Walid.
>
> http://www.nabble.com/file/p21174238/ISOMsg%2Bfrom%2BGemalto%2BPOS.doc
> ISOMsg+from+Gemalto+POS.doc
>
--
View this message in context: http://www.nabble.com/Financial-message-with-stx-etx-and-lrc-tp21174238p21182411.html
>>> Do you have any control of the terminal message format or
>>> transport? Is this the serial conversation sent of TCP/IP? I
>>> wonder if the terminal(s) can be reconfigured?
>>>
>> i wrote the terminal application before to send message another
>> interface (oasis switch) using the modem dial up, but now im trying
>> to use the tcp/ip to send it to jpos server.
TCP/IP does not need the STX,ETX nor LRC.
Do you have the option of throwing them away before the send?
It is easy to modify a Channel to cope with them, but it might be easier
for you if you got rid of them (if you can).
Does the terminal have an option to send over TCP/IP directly itself
(the Gemalto website I looked at suggested that the terminals I skimmed
through probably could).
--
Mark
... where the above code is called is where you need to add the
processing of the STX, ETX etc...
...skipping an STX is as simple as reading a byte from the stream at the
right time. You may not need to keep this byte for later reference, but
it is worth checking it holds the expected value.
--
Mark
POS -> modem connected server (with his code) -> jPOS active server...
This way his server code could strip the unnessesary padding to make his
work easier.
If of course it is possible to ask the POS devices to talk straight
TCP/IP, then we loose a couple of middle men and reduce the work.
I understand your point Chhil, but for all we know, Walid might have a
single POS device.
8)
--
Mark
Hi Shehab,I am trying to use a usb modem and perform ISO8583 transaction with a NAC,The dial up can connect and call is successful , butwhen i send the iso8583 packet as in the given code below, it is not detected by NAC.Should i use any STX ETX and LRC for the data.The NAC is taking the data midway , ie; the data captured at NAC starts always from 0x01, why is it so ?My format of sending data currently is LL1 LL2 0x60 NII1 NII2 NII3 NII4 MTI ......LL is length bytes,NII is NII bytes ,MTI is message type identifier etc..Please give any inputs.Thanks,Code for reference,import java.io.*;//import javax.comm.*;import gnu.io.*;import java.util.*;public class PortWriter implements SerialPortEventListener{static Enumeration ports;static CommPortIdentifier pID;static OutputStream outStream;static InputStream inStream;SerialPort serPort;static String messageToSend = "ATD315";static boolean writeFlag = false;String line;static BufferedReader bos;static OutputStream fos = null;static FileOutputStream output = null;static DataOutputStream dout = null;public PortWriter() throws Exception{serPort = (SerialPort)pID.open("PortWriter",120000);serPort.setSerialPortParams(9600, SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);inStream = serPort.getInputStream();outStream = serPort.getOutputStream();try {serPort.addEventListener(this);}catch (TooManyListenersException e) {System.out.print(e);}serPort.notifyOnDataAvailable(true);serPort.notifyOnCarrierDetect(true);serPort.notifyOnDataAvailable(true);serPort.notifyOnBreakInterrupt(true);serPort.notifyOnCTS(true);serPort.notifyOnDSR(true);serPort.notifyOnFramingError(true);serPort.notifyOnOutputEmpty(true);serPort.notifyOnOverrunError(true);serPort.notifyOnParityError(true);serPort.notifyOnRingIndicator(true);}private static final char[] HEX_CHARS = "0123456789abcdef".toCharArray();public static String asHex(byte[] buf){char[] chars = new char[2 * buf.length];for (int i = 0; i < buf.length; ++i){chars[2 * i] = HEX_CHARS[(buf[i] & 0xF0) >>> 4];chars[2 * i + 1] = HEX_CHARS[buf[i] & 0x0F];}return new String(chars);}public void portclose(){this.serPort.close();}public void serialEvent(SerialPortEvent event) {switch(event.getEventType()){case SerialPortEvent.DATA_AVAILABLE:handleData();System.out.println("handle data event");break;case SerialPortEvent.OE:case SerialPortEvent.FE:case SerialPortEvent.PE:case SerialPortEvent.DSR:System.out.println("Data set ready.");break;case SerialPortEvent.OUTPUT_BUFFER_EMPTY:System.out.println("Ignored event");break;case SerialPortEvent.BI:System.out.println("Break Interrupt");break;case SerialPortEvent.CTS:System.out.println("Clear to send");break;case SerialPortEvent.RI:System.out.println("Pick up the receiver.");if( event.getNewValue() ){System.out.println("Ring Indicator On");}else{ System.out.println("Ring Indicator Off");} break;case SerialPortEvent.CD:if( event.getNewValue() ) {System.out.println("Connected");// try to send data iso8583byte isoreq[] = {0x00,(byte) 0xBA,0x60,0x00,0x08,(byte) 0x80,0x62,0x02,0x00,0x32,0x24,0x05,(byte) 0x80,0x20,(byte) 0xC0,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x03,0x11,0x11,0x33,0x34,0x00,0x00,0x04,0x03,0x11,0x00,0x51,0x00,0x08,0x00,0x38,0x45,0x70,0x66,0x37,0x63,0x35,0x50,0x02,(byte) 0xD1,0x40,0x62,0x01,0x15,0x54,0x30,0x30,0x00,0x00,0x0F,0x39,0x37,0x36,0x35,0x34,0x33,0x32,0x31,0x35,0x33,0x32,0x31,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,(byte) 0x99,(byte) 0x9F,0x26,0x08,(byte) 0xBA,0x53,0x2B,0x11,0x5D,(byte) 0xC7,(byte) 0x86,0x1D,(byte) 0x82,0x02,0x5C,0x00,(byte) 0x9F,0x36,0x02,0x02,(byte) 0xC9,(byte) 0x9F,0x07,0x02,(byte) 0xFF,0x00,(byte) 0x9F,0x27,0x01,(byte) 0x80,(byte) 0x8E,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x03,0x02,0x03,0x1F,0x00,(byte) 0x9F,0x34,0x03,0x1E,0x03,0x00,(byte) 0x9F,0x0D,0x05,(byte) 0xD0,0x60,0x04,(byte) 0x88,0x00,(byte) 0x9F,0x0E,0x05,0x00,0x10,0x00,0x00,0x00,(byte) 0x9F,0x0F,0x05,(byte) 0xD0,0x60,0x04,(byte) 0x98,0x00,(byte) 0x9F,0x10,0x07,0x06,0x01,0x0A,0x03,(byte) 0xA0,0x28,0x00,(byte) 0x95,0x05,(byte) 0x80,0x00,0x00,0x00,0x00,(byte) 0x9F,0x37,0x04,(byte) 0x8E,0x4B,0x4D,0x2D,0x00,0x01,0x34};String isoreqs = asHex(isoreq);try {//byte tempb[] = {0x00,0x56};//this.outStream.write(ts.getBytes());this.outStream.write(isoreq1);//this.outStream.write(isoreqs.getBytes());this.serPort.setRTS( ! this.serPort.isRTS() );this.serPort.setDTR( ! this.serPort.isDTR() );this.outStream.flush();try {Thread.sleep(50);} catch (InterruptedException e) {// TODO Auto-generated catch blocke.printStackTrace();}} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}}private String asHex(char[] buf) {// TODO Auto-generated method stubchar[] chars = new char[2 * buf.length];for (int i = 0; i < buf.length; ++i){chars[2 * i] = HEX_CHARS[(buf[i] & 0xF0) >>> 4];chars[2 * i + 1] = HEX_CHARS[buf[i] & 0x0F];}return new String(chars);}public void handleData(){// System.out.println(writeFlag);System.out.print("Inside serial event");try{fos = new FileOutputStream("rmn.txt",true);bos = new BufferedReader(new FileReader("rmn.txt"));dout = new DataOutputStream(fos);int avail = inStream.available();byte[] response = new byte[avail];StringBuffer strbuf = new StringBuffer();inStream.read(response, 0, avail);for (int i = 0; i < avail; i++){fos.write((char)response[i]);System.out.println(response[i]);}if(!writeFlag){while((line = bos.readLine())!=null){// dout.flush();if(line.equals("CONNECT 9600")){writeFlag = true;System.out.println("connect"); break;} } } if(writeFlag){ } }catch(IOException ie1){System.out.println("File " +ie1);}// catch(InterruptedException ie1){System.out.println("File " +ie1);}}public static void main(String[] args) throws Exception{ports = CommPortIdentifier.getPortIdentifiers();while(ports.hasMoreElements()){pID = (CommPortIdentifier)ports.nextElement();System.out.println("Port " + pID.getName());if (pID.getPortType() == CommPortIdentifier.PORT_SERIAL){if (pID.getName().equals("COM11")){PortWriter pWriter = new PortWriter();System.out.println("COM11 found");messageToSend = "ATE\r\n";// messageToSend = "ATO\r\n";// try {//outStream.write(messageToSend.getBytes());// } catch (IOException e1) {// TODO Auto-generated catch block//e1.printStackTrace();// }// outStream.write(messageToSend.getBytes());// pWriter.portclose();//0380231886//20703632// byte rb[] = {'A','T','D','3','1','5','\r','\n'};// byte rb[] = {'A','T','D','9','8','0','2','3','1','8','8','6','\r','\n'};// byte rb[] = {'A','T','D','9','2','0','7','0','3','6','3','2','\r','\n'};byte rb[] = {'A','T','D','T','9',',','8','0','2','4','8','6','8','4','\r','\n'};messageToSend = "ATD315\r\n";// outStream.write(messageToSend.getBytes());outStream.write(rb);break;
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.
Please support jPOS, contact: sa...@jpos.org
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.