Closed MFaridAli closed 1 year ago
Yeah, ISO8583 is a real PITA to work with. What exactly are you trying to do? What's your source ISO? IIRC the bitmap needs to be in hex before you addISO
, if you have a binary bitmap you'll need to convert using something like:
private function _unpack_bitmap($iso)
{
$bitmap = substr($iso, 4,8);
$this->_log(__METHOD__.' bitmap:'.$bitmap);
$bitmap = bin2hex($bitmap);
$this->_log(__METHOD__.' bin2hex:bitmap:'.$bitmap);
return substr($iso, 0,4).$bitmap.substr($iso, 12);
}
and going the other way
private function _pack_bitmap($iso)
{
$bitmap = substr($iso, 4,16);
$this->_log(__METHOD__.' bitmap:'.$bitmap);
$bitmap = hex2bin($bitmap);
$this->_log(__METHOD__.' hex2bin:bitmap:'.$bitmap);
return substr($iso, 0,4).$bitmap.substr($iso, 20);
}
Not sure why this isn't part of the library, I just took the original and built my implementation around it's limitations. Once I got it working for my project I kinda forgot all about it. If you can add that in, I'll happily accept a PR.
Hey @MFaridAli did you solve your issue?
not yet, I am very confused, because on my other computer with the Ubuntu OS it's work. now i use osx
I believe I can answer this. MFaridAli must be running PHP 7.1 and up.
Since 7.1, the string will not be converted to array automatically. This the result is in string, instead of intended array on getData();
So you need to change the _clear function from
$this->_data = '';
Into:
$this->_data = array();
It will solve the problems. And since the change is quite minimal. I believe I don't need to fork this yeah?
$jakres = new JAK8583(); $jakres->addISO($hasil); $de=$jakres->getData(); $rc=$de;
result ??? ? ??? ? ? ? ? ? ?? ??