Skip to content

Commit

Permalink
Msaadsiddiqui patch 1 (#137)
Browse files Browse the repository at this point in the history
* minor changes to 127.1 ,if bitmap is customized

* unpack 127 for bitmap ascii

* Update assemble127_extensions.ts

---------

Co-authored-by: TPSONLINE\Saad.Siddiqui <[email protected]>
  • Loading branch information
msaadsiddiqui and TPSONLINE\Saad.Siddiqui committed Sep 25, 2023
1 parent 0ec901a commit 54b6589
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/pack/assemble127_extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ function assembleKeyValueString(self: ISO8583): DefaultError | Buffer {
const bitmaps_127 = self.assembleBitMap_127();
const bmpsHex = self.getBitMapHex_127_ext();
let buff = Buffer.alloc(8, bmpsHex, 'hex');
if(self.formats['127.1'] != undefined)
{
if (self.formats['127.1'].ContentType === 'an')
{
buff = Buffer.alloc(16, bmpsHex, 'ascii')
}
}
const fieldkv = [];
for (let i = 0; i < bitmaps_127.length; i++) {
const field = '127.' + (Number(i) + 1);
Expand Down
22 changes: 20 additions & 2 deletions src/unpack/unpack_127_1_63.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,26 @@ export default function (slice_127, isoJSON) {
return unpackKeyValueStringField(this, slice_127, isoJSON);
}
slice_127 = slice_127.slice(6, slice_127.length);
const bitmap = T.getHex(slice_127.slice(0, 8).toString('hex')).split('').map(Number);
slice_127 = slice_127.slice(8, slice_127.length);
//const bitmap = T.getHex(slice_127.slice(0, 8).toString('hex')).split('').map(Number);
let bitmap = "";
if(this.formats['127.1'] != undefined)
{
if (this.formats['127.1'].ContentType === 'an')
{
bitmap = T.getHex(slice_127.slice(0, 16).toString('ascii'))
.split('')
.map(Number);
slice_127 = slice_127.slice(16, slice_127.length);
}
}
else
{
bitmap = T.getHex(slice_127.slice(0, 8).toString('hex'))
.split('')
.map(Number);
slice_127 = slice_127.slice(8, slice_127.length);
}

for (let i = 0; i < 40; i++) {
if (bitmap[i] === 1) {
const subField = '127.' + (i + 1);
Expand Down

0 comments on commit 54b6589

Please sign in to comment.