s-a / iso-8583

:credit_card: A native Node module to process ISO 8583 Financial transaction card originated messages
Other
76 stars 30 forks source link

Field 35 (Track2) not returning in the right format #6

Open iespiga opened 7 years ago

iespiga commented 7 years ago

Hello,

I was testing this module, to unpack some ISO message (1987 format).

However when Track2 field is decoded, it shows a unreadable data. It seems to me it's been interpreted as ASCII instead of BCD. Then rest of the fields are mess up (like terminal id on field 41).

Track2 format on ISO is very particular because it's not full BCD, because has a especial charter in between ('='). The format it's somethig like this: 5127420812420393=18022011329147300000.

Is there anyway to handle this?

Regards Ian.

s-a commented 7 years ago

@paulpps do you have an idea? I am involved in so many projects right now and it is difficult to find time to contribute here.

paulpps commented 7 years ago

If it is BCD it looks like the definition needs to be changed to numeric. For BCD track 2 data the '=' symbol is encode as hex D.

See https://www.magtek.com/content/documentationfiles/d99800004.pdf for formats.

Currently, the parser is treating the data as binary which would result in unreadable data in string form. You could convert it after the parsing from BCD->String (IE: 0x3701.... => 0x33373031.....).