juks / iso-8583-socket-queue

ISO 8583 gateway
MIT License
194 stars 111 forks source link

Package errors #73

Open winstongeraldo opened 1 year ago

winstongeraldo commented 1 year ago

I run this the curl command on a HTTP Port I configured but when I send a command this is the error response I get, please can you help

2023-04-19 09:32:37 - info: Client http:::ffff:127.0.0.1:42188 connected 2023-04-19 09:32:37 - info: Client http:::ffff:127.0.0.1:42188 sent data 2023-04-19 09:32:37 - verbose:

http:::ffff:127.0.0.1:42188

 Message Type Indicator [0].......................1200
 Bitmap [1].......................................b230054108c080000000000006000000
 Processing Code [3]..............................401000
 Amount, Transaction [4]..........................50000
 Transmission Date and Time [7]...................0000000324
 System Trace Audit Number [11]...................000860
 Time, Local Transaction [12].....................000000200324
 Pos Entry Mode [22]..............................000 (Cardholder Auth Method: <Not Authenticat                                          ed>)
 Function Code [24]...............................200
 Unknown field [26]...............................5271
 Acquiring Institution Ident Code [32]............000202
 Retrieval Reference Number [37]..................008408000860
 Card Acceptor Terminal Identification [41].......11111111
 Merchant Id [42].................................333333333333333
 Currency code, transaction [49]..................967
 Unknown field [102]..............................0002021802687028001
 Unknown field [103]..............................0002040974538467

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

2023-04-19 09:32:37 - info: Writing to queue http:::ffff:127.0.0.1:42188 [0]
2023-04-19 09:32:37 - info: New queue item 0 2023-04-19 09:32:37 - info: Processing queue [pending 1 / total 1] 2023-04-19 09:32:37 - verbose: Queue keys dump: 0 2023-04-19 09:32:37 - info: Upstreaming data for http:::ffff:127.0.0.1:42188
/home/winston/git/iso-8583-socket-queue/lib/iso8583/lib/iso8583.js:62 throw new Error(errMsg + ': ' + e.message + " " + e.stack); ^

Error: Error packing data from bit 26 Packager: undefined: Cannot read property 'type' of undefined TypeError: Cannot read property 'type ' of undefined at ISO8583._pack (/home/winston/git/iso-8583-socket-queue/lib/iso8583/lib/iso8583.js:56:57) at ISO8583.packWithBinMask (/home/winston/git/iso-8583-socket-queue/lib/iso8583/lib/iso8583.js: 132:27) at Iso8583Packet.getMessage (/home/winston/git/iso-8583-socket-queue/lib/iso8583-packet/lib/iso 8583Packet.js:259:31) at Iso8583Packet.getRawMessage (/home/winston/git/iso-8583-socket-queue/lib/iso8583-packet/lib/ iso8583Packet.js:268:34) at Socket.socket.processQueue (/home/winston/git/iso-8583-socket-queue/lib/socketServer/lib/ups tream.js:204:50) at Upstream.sendData (/home/winston/git/iso-8583-socket-queue/lib/socketServer/lib/upstream.js: 93:19) at IncomingMessage. (/home/winston/git/iso-8583-socket-queue/lib/socketServer/lib/cl ientHttpServer.js:105:25) at IncomingMessage.emit (events.js:198:13) at IncomingMessage.Readable.read (_stream_readable.js:505:10) at flow (_stream_readable.js:974:34) at ISO8583._pack (/home/winston/git/iso-8583-socket-queue/lib/iso8583/lib/iso8583.js:62:13) at ISO8583.packWithBinMask (/home/winston/git/iso-8583-socket-queue/lib/iso8583/lib/iso8583.js: 132:27) at Iso8583Packet.getMessage (/home/winston/git/iso-8583-socket-queue/lib/iso8583-packet/lib/iso 8583Packet.js:259:31) at Iso8583Packet.getRawMessage (/home/winston/git/iso-8583-socket-queue/lib/iso8583-packet/lib/ iso8583Packet.js:268:34) at Socket.socket.processQueue (/home/winston/git/iso-8583-socket-queue/lib/socketServer/lib/ups tream.js:204:50) at Upstream.sendData (/home/winston/git/iso-8583-socket-queue/lib/socketServer/lib/upstream.js: 93:19) at IncomingMessage. (/home/winston/git/iso-8583-socket-queue/lib/socketServer/lib/cl ientHttpServer.js:105:25) at IncomingMessage.emit (events.js:198:13) at IncomingMessage.Readable.read (_stream_readable.js:505:10) at flow (_stream_readable.js:974:34)

juks commented 1 year ago

Hi!

You refer to the fields 102 and 103 that are not described in your configuration:

Unknown field [102]..............................0002021802687028001
Unknown field [103]..............................0002040974538467

You need to provide format configuration the same way other fields are described.

winstongeraldo commented 1 year ago

Hi!

You refer to the fields 102 and 103 that are not described in your configuration:

Unknown field [102]..............................0002021802687028001
Unknown field [103]..............................0002040974538467

You need to provide format configuration the same way other fields are described.

Where do I do that please, because i keep different errors, example below

http:::ffff:127.0.0.1:57048 ============================================================================================= ===

 [Echo Response]

 Message Type Indicator [0].......................1804
 Bitmap [1].......................................82200110000000000000000c00000000
 Transmission Date and Time [7]...................0000000603
 System Trace Audit Number [11]...................360976
 Function Code [24]...............................831
 Unknown field [28]...............................200603
 Unknown field [93]...............................1000000000
 Unknown field [94]...............................000204

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

2023-04-20 11:34:06 - info: Writing to queue http:::ffff:127.0.0.1:57048 [0]
2023-04-20 11:34:06 - info: New queue item 0 2023-04-20 11:34:06 - info: Processing queue [pending 1 / total 1] 2023-04-20 11:34:06 - verbose: Queue keys dump: 0 2023-04-20 11:34:06 - info: Upstreaming data for http:::ffff:127.0.0.1:57048
/home/winston/git/iso-8583-socket-queue/lib/iso8583/lib/iso8583.js:62 throw new Error(errMsg + ': ' + e.message + " " + e.stack); ^

Error: Error packing data from bit 28 Packager: undefined: Cannot read property 'type' of undefined TypeError: Cannot read property 'type' of undefined at ISO8583._pack (/home/winston/git/iso-8583-socket-queue/lib/iso8583/lib/iso8583.js:56:5 7) at ISO8583.packWithBinMask (/home/winston/git/iso-8583-socket-queue/lib/iso8583/lib/iso85 83.js:132:27) at Iso8583Packet.getMessage (/home/winston/git/iso-8583-socket-queue/lib/iso8583-packet/l ib/iso8583Packet.js:259:31) at Iso8583Packet.getRawMessage (/home/winston/git/iso-8583-socket-queue/lib/iso8583-packe t/lib/iso8583Packet.js:268:34) at Socket.socket.processQueue (/home/winston/git/iso-8583-socket-queue/lib/socketServer/l ib/upstream.js:204:50) at Upstream.sendData (/home/winston/git/iso-8583-socket-queue/lib/socketServer/lib/upstre am.js:93:19) at IncomingMessage. (/home/winston/git/iso-8583-socket-queue/lib/socketServer/ lib/clientHttpServer.js:105:25) at IncomingMessage.emit (events.js:198:13) at IncomingMessage.Readable.read (_stream_readable.js:505:10) at flow (_stream_readable.js:974:34) at ISO8583._pack (/home/winston/git/iso-8583-socket-queue/lib/iso8583/lib/iso8583.js:62:1 3) at ISO8583.packWithBinMask (/home/winston/git/iso-8583-socket-queue/lib/iso8583/lib/iso85 83.js:132:27) at Iso8583Packet.getMessage (/home/winston/git/iso-8583-socket-queue/lib/iso8583-packet/l ib/iso8583Packet.js:259:31) at Iso8583Packet.getRawMessage (/home/winston/git/iso-8583-socket-queue/lib/iso8583-packe t/lib/iso8583Packet.js:268:34) at Socket.socket.processQueue (/home/winston/git/iso-8583-socket-queue/lib/socketServer/l ib/upstream.js:204:50) at Upstream.sendData (/home/winston/git/iso-8583-socket-queue/lib/socketServer/lib/upstre am.js:93:19) at IncomingMessage. (/home/winston/git/iso-8583-socket-queue/lib/socketServer/ lib/clientHttpServer.js:105:25) at IncomingMessage.emit (events.js:198:13) at IncomingMessage.Readable.read (_stream_readable.js:505:10) at flow (_stream_readable.js:974:34)

juks commented 1 year ago

It is here: https://github.com/juks/iso-8583-socket-queue/blob/master/lib/iso8583/lib/packager/smartVista.js

I suggest you get familiar with the source code first, no need to rush.

winstongeraldo commented 1 year ago

Thanks for your help for the last time. Can you assist me understand this error too?

especially where it says socket not connected and how do i resolve that?

http:::ffff:127.0.0.1:41128

 [Echo Response]

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

2023-04-26 09:44:08 - info: Writing to queue http:::ffff:127.0.0.1:41128 [0]
2023-04-26 09:44:08 - info: New queue item 1 2023-04-26 09:44:08 - info: Processing queue [pending 1 / total 1] 2023-04-26 09:44:08 - verbose: Queue keys dump: 1 2023-04-26 09:44:08 - info: Upstreaming data for http:::ffff:127.0.0.1:41128
2023-04-26 09:44:08 - verbose: [00611804...] 2023-04-26 09:44:13 - info: Got data from ISO-host (64b) 2023-04-26 09:44:13 - verbose: [..ISO858...] 2023-04-26 09:44:13 - info: Processing queue [pending 0 / total 1] 2023-04-26 09:44:13 - verbose: Queue keys dump: 1 2023-04-26 09:44:18 - info: Upstream 2023-04-26 09:44:18 - info: Upstream 2023-04-26 09:44:18 - info: Dropping all active clients 2023-04-26 09:44:18 - info: Connecting to upstream server 10.23.223.101:5044
2023-04-26 09:44:18 - info: Processing queue [pending 0 / total 1] 2023-04-26 09:44:18 - verbose: Queue keys dump: 1 2023-04-26 09:44:18 - info: Socket is not connected yet... 2023-04-26 09:44:18 - info: Client http:::ffff:127.0.0.1:41128 event
2023-04-26 09:44:18 - verbose: Releasing terminal null with the key 1
2023-04-26 09:44:18 - info: Warning: client http:::ffff:127.0.0.1:41128 [queue id 1] terminated activity

juks commented 1 year ago

info: Socket is not connected yet...

It means there is no connection to upstream host for the moment. So after 10 second waiting for connection timeout occurs.

winstongeraldo commented 1 year ago

I realized the application uses the loop-back IP 127.0.0.1 with different port numbers to communicate with the upstream server when sending the ISO message over to the upstream server. per the configuration on the upstream server, it only allows traffic from a specific IP Address which is the IP of the system.

Is there a way I can modify the IP in the code?

juks commented 1 year ago

You can use options to set the upstream host ip and other parameters https://github.com/juks/iso-8583-socket-queue/blob/master/parameters.js