forked from zemuldo/iso_8583
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: variable binary field encode decode as hex
- Loading branch information
Arun Rajput
authored and
Arun Rajput
committed
Aug 27, 2022
1 parent
8da6be8
commit 54dc08b
Showing
3 changed files
with
64 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import test from 'ava'; | ||
import iso8583 from '../lib/8583.js'; | ||
|
||
/* | ||
Support custom iso 8583 formats | ||
Support Case: Binary var field encode decode | ||
*/ | ||
test('iso8583 Ext - binary var field must be encoded', t => { | ||
const format = { | ||
2: { | ||
ContentType: 'b', | ||
Label: 'F1', | ||
LenType: 'llvar', | ||
MaxLen: 99 | ||
}, | ||
|
||
}; | ||
const data = { | ||
0: '0800', | ||
'2': '1004000000000000303030303030303030343048' | ||
// #2 this is prepard by encodng subfields - 8bytes bitmap followed by subfields data | ||
}; | ||
let isopack = new iso8583(data, format); | ||
let buff = isopack.getRawMessage(); | ||
const iso1 = new iso8583(undefined, format).getIsoJSON(buff, {lenHeader: false}); | ||
t.deepEqual(iso1, data); | ||
let isopack1 = new iso8583(iso1); | ||
t.is(isopack1.Msg['2'], '1004000000000000303030303030303030343048'); | ||
|
||
}); |