Coder Social home page Coder Social logo

Bitmap 32 about iso_8583 HOT 17 CLOSED

zemuldo avatar zemuldo commented on July 20, 2024
Bitmap 32

from iso_8583.

Comments (17)

msaphira avatar msaphira commented on July 20, 2024 1

from iso_8583.

zemuldo avatar zemuldo commented on July 20, 2024

Can I see a sample of the iso message you want to convert?

from iso_8583.

msaphira avatar msaphira commented on July 20, 2024

This is the iso message i get from buffer and i want to convert it to json
70800822000000000000004000000000000001125161336000255301

I think my iso message will look like this after i convert it to json

{
"0":"0800",
"7":"1125161336",
"11":255,
"70":"301"
}

But this is what i got
{ '0': '0800',
'3': '040000',
'4': '000000000011',
'5': '251613360002',
'11': '55301'
.......

And it looks like the function read my secondary bitmap (17-32) as a data elements.

this is my code:

connection.on('data', function(data) {
let iso = new iso8583().getIsoJSON(data);
}

from iso_8583.

zemuldo avatar zemuldo commented on July 20, 2024

How are you passing the buffer to getIsoJSON? That method takes a buffer within which the bitmaps must be encoded in hexadecimal while in memory and will take 16 bytes. If you parse the buffer with bitmap encoded in another encoding, 16 bytes will have only the first bitmap. The two bitmaps each 8 bytes will take up 16 bytes.
Solution: parse the buffer as you get from the source. If you need to convert a string like the one above, this library doesn't support.
However if that's how your interface has to receive data, we can help u decode.

from iso_8583.

msaphira avatar msaphira commented on July 20, 2024

i'm using another library (socketQueue - https://github.com/juks/SocketQueue) to pass the buffer and it works when i use JReactive-8583 library (based in java - https://github.com/kpavlov/jreactive-8583).
Now i'm trying to do it in node js.
Can you give me example how to parse the buffer after i get it from the source?
Thank you :)

from iso_8583.

zemuldo avatar zemuldo commented on July 20, 2024

I have checked socketQueue - https://github.com/juks/SocketQueue, Here is what I have to say.
When using data from another source, the data must be encoded such that
2 bytes containe tcp length header indicator, 4 bytes contain the mti and next 16 bytes contain the bitmaps. Its also possible to have only 8 byte mti.

Here is an example from socketqueue example without leng indicator and only primary bitmap

msg = new Buffer('303830302220010000800000393930303030303832333135313731363030303030313833313030303030303031', 'hex');

Now parsing this using our iso package, you have to set lenHeader and secondary bitmap to false.

console.log(myIsoPack.getIsoJSON(msg, {lenHeader: false, }))

This gives

{ '0': '0800',
  '3': '990000',
  '7': '0823151716',
  '11': '000001',
  '24': '831',
  '41': '00000001' }

from iso_8583.

zemuldo avatar zemuldo commented on July 20, 2024

You have to check how the data you receive is encoded before the mti. That way i can help.

from iso_8583.

msaphira avatar msaphira commented on July 20, 2024

So this library cannot have secondary bitmap? which means that i cannot use data fields from 65-128?

If this library can have a secondary bitmap, would you please give me an example of buffer message with secondary bitmap?

i already tried the example you gave but i got an error message 'failed to unpack at get mti' .

thank you for your help :)

from iso_8583.

zemuldo avatar zemuldo commented on July 20, 2024

It supports both bitmaps. Versions below 2.5.7 do not support primary bitmap without secondary bitmap.
Here is a buffer with both bitmaps

<Buffer 00 26 31 32 30 30 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 36 34 37 36 31 37 33 39 30 30 31 30 31 30 31 31 39>

And here is a buffer with only primary

<Buffer 30 38 30 30 22 20 01 00 00 80 00 00 39 39 30 30 30 30 30 38 32 33 31 35 31 37 31 36 30 30 30 30 30 31 38 33 31 30 30 30 30 30 30 30 31>

from iso_8583.

zemuldo avatar zemuldo commented on July 20, 2024

To make things work, you have to ensure the buffer has a 2 byte length indicator before the mti. If your message starts with the mti then you have to disable the length indicator. check docs for that.

from iso_8583.

msaphira avatar msaphira commented on July 20, 2024

i'm still a bit confuse about this,

This is my buffer with secondary bitmap
<Buffer 00 37 30 38 30 30 38 32 32 30 30 30 30 30 30 30 30 30 30 30 30 30 30 34 30 30 30 30 30 30 30 30 30 30 30 30 30 30 31 32 31 32 30 31 31 38 34 33 30 30 ... >

it's already shown the two bytes of length indicator --> 00 37, and four bytes of mti --> 30 38 30 30

but how can i convert my 32 bytes bitmap to 16 bytes bitmap which contain primary and secondary bitmap?

should i encode all the iso message with Buffer.from(message, 'hex') or just encode the bitmap with Buffer.from(bitmap, 'hex') ?

from iso_8583.

msaphira avatar msaphira commented on July 20, 2024

i already found a way to convert my incoming buffer. Thank you for your help! :)

from iso_8583.

zemuldo avatar zemuldo commented on July 20, 2024

from iso_8583.

msaphira avatar msaphira commented on July 20, 2024
  1. i convert the buffer into string
  2. then i convert it again into buffer which encoded by 'hex'

can i ask you how to convert bitmap into iso 8583 with primary bitmap only?

and i want to know if i can convert buffer into json with custom format? can you give me an example of this?
i already tried
let message = new iso8583(customFormats).getIsoJson(data);

but nothing change, i still have the default format. Thank you!

from iso_8583.

zemuldo avatar zemuldo commented on July 20, 2024

I will give you an example here

from iso_8583.

zemuldo avatar zemuldo commented on July 20, 2024

@msaphira Are you still having this issue?

from iso_8583.

zemuldo avatar zemuldo commented on July 20, 2024

Awesome! You can always post the solution here for someone else who may face a similar issue.

from iso_8583.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.