New issue 5 by caente: Binary data on field 52
http://code.google.com/p/iso8583py/issues/detail?id=5
Hello, this is not an actual issue, I'm sorry, but didn't find another
place to ask:
I'm planning to use iso8583py in a django project as a middleware between
the mobile clients(who send http requests) and a JPOS who make the actual
connections with the Switch.
For that I need to send to the JPOS server a message with a binary field
52, where the 6 digits NIP goes, for that I do something like:
msg.setBit(52,123456)
msg.redefineBit(52, '52', msg.getLargeBitName(52), 'B', 6,"n" )
So far so good, in the JPOS server I got:
<field id="52" value="0000000000123456" type="binary"/>
The problem is: that value is not the binary representation of the NIP, in
java I would do:
msg.set(52, "123456".getBytes());
I have searched the web but I haven't found anything like that for python,
what do you use?
Ah, BTW, I wrote something like the ISOMUX of JPOS, I made it based on
Queue.Queue() and it have a really nice performance, when I test it a bit
more I will send it to you, in case it helps.
good luck
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
I found the solution:
import binascii
bin_nip = binascii.b2a_hex(nip)
So I recommend like this in redefineBit():
if bitType == "B":
self.setBit(bit,binascii.b2a_hex(self.getBit(bit)))
I guess that "B" means binary
And of course, here:
def __setBitTypeB(self, bit, value):
value = "%s" % binascii.b2a_hex(value)