juks / iso-8583-socket-queue

ISO 8583 gateway
MIT License
195 stars 111 forks source link

Bitmap in Hex #27

Closed rustamin closed 6 years ago

rustamin commented 6 years ago

Hallo @juks,

I got problem with bitmap[1]. Our host bank use smartVista. Message type and the field packaged correctly, use hex format but our host bank only accept Bitmap[1] sent with hex format instead of text. I read overides config in parameters.js, but I can figure out which type should I use so Bitmap converted to hex. Thank you so much.

juks commented 6 years ago

Hi.

Please use --overrides=1:bitmap-hex:8

rustamin commented 6 years ago

My apologize, I try use it, in self test. Thank you.

Can I ask more question? Our host bank send echo request, in log it said

2018-03-26 11:03:39 - info: Upstream error: ISO host sent data with no client connected! Ignoring...

ISO host says
================================================================================================

     [Echo Request]

     Message Type Indicator [0].......................0800
     Bitmap [1].......................................82200000000000000400000000000000
     Transmission Date and Time [7]...................0326040339
     System Trace Audit Number [11]...................017827
     Network Management Information Code [70].........301

================================================================================================ 

Does SocketQueue do auto reply for echo request?

I try to send echo request without using terminalId[41] to to our host bank. I got response from our host bank but I got the same log '2018-03-26 10:52:49 - info: Upstream error: ISO host sent data with no client connected! Ignoring... Can you give guidance?

rustamin commented 6 years ago

I think I found my solution in this issue. I have to use only field 11 as message key, --queueMessageKeyFields=11. Thanks.

rustamin commented 6 years ago

I successfully got response when I sent echo request, but It is failed to response echo request from the ISO host.

2018-03-26 12:06:39 - info: Upstream error: ISO host sent data with no client connected! Ignoring...

Request from the ISO host has no terminalId

juks commented 6 years ago

Hi!

Do client and host fields 11 (STAN) match? Could you please provide the entire request-response log?

rustamin commented 6 years ago
2018-03-26 16:26:50 - info: Got data from ISO-host (58b)                         
2018-03-26 16:26:50 - verbose: [.8080082...]                         
2018-03-26 16:26:50 - info: Upstream error: ISO host sent data with no client connected! Ignoring...

ISO host says
================================================================================================

     [Echo Request]

     Message Type Indicator [0].......................0800
     Bitmap [1].......................................82200000000000000400000000000000
     Transmission Date and Time [7]...................0326092650
     System Trace Audit Number [11]...................018358
     Network Management Information Code [70].........301

================================================================================================

The ISO host send echo request, but socketQueue doesn't reply automatically. I am trying to implement auto reply just like in echoServer

juks commented 6 years ago

I don't quite understand. Why does echo message respose has MTI 0800 instead of 0810? I mean could you provide log data since when client connects and sends his first message?

rustamin commented 6 years ago

When client connect and send echo request to host bank, it works properly, client got response from host bank.

2018-03-26 16:38:04 - info: Important: starting...                         
2018-03-26 16:38:04 - info: Remote host configuration name: smartVista                         
2018-03-26 16:38:04 - info: Connecting to upstream server 10.xx.xx.xx:xxx
2018-03-26 16:38:04 - info: Relay HTTP server is now running on port 6060                         
2018-03-26 16:38:04 - info: Connected to upstream 10.xx.xx.xx:xxx!                         
2018-03-26 16:38:04 - info: Processing queue [pending 0 / total 0]                         
2018-03-26 16:38:04 - info: The queue is empty                         
2018-03-26 16:38:05 - info: New HTTP socket                         
2018-03-26 16:38:05 - info: Client http:::ffff:127.0.0.1:38592 connected                         
2018-03-26 16:38:05 - info: Client http:::ffff:127.0.0.1:38592 sent data                         
http:::ffff:127.0.0.1:38592
================================================================================================

     [Echo Request]

     Message Type Indicator [0].......................0800
     Bitmap [1].......................................82200000000000000400000000000000
     Transmission Date and Time [7]...................0326160340
     System Trace Audit Number [11]...................009275
     Network Management Information Code [70].........301

================================================================================================

2018-03-26 16:38:05 - info: Writing to queue http:::ffff:127.0.0.1:38592 [0]                         
2018-03-26 16:38:05 - info: New queue item 1                         
2018-03-26 16:38:05 - info: Processing queue [pending 1 / total 1]                         
2018-03-26 16:38:05 - verbose: Queue keys dump: 1                         
2018-03-26 16:38:05 - info: Upstreaming data forhttp:::ffff:127.0.0.1:38592                         
2018-03-26 16:38:05 - verbose: [.7080082...]
2018-03-26 16:38:05 - info: Got data from ISO-host (60b)                         
2018-03-26 16:38:05 - verbose: [..081082...]                         
2018-03-26 16:38:05 - info: Parsed data for http:::ffff:127.0.0.1:38592                         
2018-03-26 16:38:05 - verbose: 

ISO host to http:::ffff:127.0.0.1:38592
================================================================================================

     [Echo Response <faulty>]

     Message Type Indicator [0].......................0810
     Bitmap [1].......................................82200000020000000400000000000000
     Transmission Date and Time [7]...................0326093805
     System Trace Audit Number [11]...................009275
     Response code [39]...............................3 (Successful Transaction)
     Network Management Information Code [70].........1

================================================================================================

2018-03-26 16:38:05 - info: Processing queue [pending 0 / total 0]                         
2018-03-26 16:38:05 - info: The queue is empty                         

But when host bank send echo request, socketQueue doesn't auto reply to host bank.

My problem is the same as niko95kus problem.

juks commented 6 years ago

Now I see. Right now it is implemented so that SQ only dispatches messages from ISO host to one of the active clients on the pool. It does not respond to the echo messages send by the upstream.

But you can implement it here by your self: https://github.com/juks/SocketQueue/blob/2f7b6519fce1c615be84ffdd672dae8cdbb35878/lib/socketServer/lib/upstream.js#L223

By the way, what kind of ISO host system is this?

rustamin commented 6 years ago

Oh, thank you. I implement socketBank replyPackage() in socket.on('data', function (data) {

Our ISO host using smartVista

juks commented 6 years ago

Ok. I will consider this feature and let you know when it is done. This will not take long. Could you please open a new issue for this (Implement upstream echo response)?

Something like upstreamEcho in https://github.com/juks/SocketQueue/blob/master/lib/iso8583/lib/logic/smartVista.js.