From 8f9d51966bc8ee513fb7d42a9dbd9c62235007a0 Mon Sep 17 00:00:00 2001 From: "TPSONLINE\\Saad.Siddiqui" Date: Fri, 15 Sep 2023 11:09:41 +0100 Subject: [PATCH 1/3] minor changes to 127.1 ,if bitmap is customized --- src/pack/assemble127_extensions.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pack/assemble127_extensions.ts b/src/pack/assemble127_extensions.ts index 76ad777..eedbb60 100644 --- a/src/pack/assemble127_extensions.ts +++ b/src/pack/assemble127_extensions.ts @@ -14,7 +14,14 @@ function assembleKeyValueString(self: ISO8583): DefaultError | Buffer { if (mtiCheck && validate && state) { const bitmaps_127 = self.assembleBitMap_127(); const bmpsHex = self.getBitMapHex_127_ext(); - let buff = Buffer.alloc(8, bmpsHex, 'hex'); + const 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); From 66e48f254013b4958f360c90ef375f9139e60599 Mon Sep 17 00:00:00 2001 From: "TPSONLINE\\Saad.Siddiqui" Date: Fri, 15 Sep 2023 17:00:51 +0100 Subject: [PATCH 2/3] unpack 127 for bitmap ascii --- src/unpack/unpack_127_1_63.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/unpack/unpack_127_1_63.ts b/src/unpack/unpack_127_1_63.ts index 96ab221..46ba792 100644 --- a/src/unpack/unpack_127_1_63.ts +++ b/src/unpack/unpack_127_1_63.ts @@ -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); From 03424313d10ac4a9969eeafcfdfad93171865662 Mon Sep 17 00:00:00 2001 From: msaadsiddiqui <99405066+msaadsiddiqui@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:21:15 +0100 Subject: [PATCH 3/3] Update assemble127_extensions.ts --- src/pack/assemble127_extensions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pack/assemble127_extensions.ts b/src/pack/assemble127_extensions.ts index eedbb60..74c8743 100644 --- a/src/pack/assemble127_extensions.ts +++ b/src/pack/assemble127_extensions.ts @@ -14,7 +14,7 @@ function assembleKeyValueString(self: ISO8583): DefaultError | Buffer { if (mtiCheck && validate && state) { const bitmaps_127 = self.assembleBitMap_127(); const bmpsHex = self.getBitMapHex_127_ext(); - const buff = Buffer.alloc(8, bmpsHex, 'hex'); + let buff = Buffer.alloc(8, bmpsHex, 'hex'); if(self.formats['127.1'] != undefined) { if (self.formats['127.1'].ContentType === 'an')