Closed jeanSagaz closed 3 years ago
Hello @jeanSagaz thank you very much for your PR, so glad to receive my first PR in this project and congrats for your first contribution in Github π π . However we accept your PR but I think it would be clear to make Issue first.
Here the issue I'd suggest to you: 1. 'variableLength' support : 2. Bug with the '0810' message :
Don't forget to add description in each Issue. Cheers and Thank youu!
I'm sorry for the delay in opening the issue. Last week I was very busy. I have already opened two issues. I was thinking of opening another issue to explain in the readme how to use the new property and run the audit fix. Can be?
@jeanSagaz Sure, no worries. Yeah, I think we should update the documentation, since this PR was major changes and also we already updated the version of npm packages to 2.x.
Sure, @dependabot already notified me about security issue in some dependencies, so we should fix this issue too.
Feel free to opening a new issue & do some PR then. Appreciate your hard work to contribute on this project. Thank you ππ
I made some changes in your library 'iso8583-js'. I changed the files 'bitmapToHex.js' and 'iso8583.js'.
In the file 'bitmapToHex.js' I made two changes in the method 'wrapMsg' and 'unWrapMsg' they are: 1 - The first change in method 'wrapMsg' is: I made the field 'variableLength', because in my mapping I have this type of situation.
EXAMPLE OF CODE AFTER AND BEFORE For example, in the bit '32' there is the variable length '11' with value below: Iso message: 02103238000102E08000002000000000000100020400050061890421484902030648940900WW334830000000067283551SEMEAR VISA SIMULADOR BELO HORIZONTBR986 Now the new mapping interface is: [32, { bitmap: 32, variableLength: 11 }],
In the loop, I check if the data there is a variable length. Then I do a validation checking if the value length is bigger than the value of the property 'variableLength' and throw an exception. If the value is less than the value of the property 'variableLength', I pad it left with zeros in order to have the same length of the property 'variableLength'. BIT[32] = 489409 In this case the spect value is 06 and the property 'variableLength' has the maximum value 11.
2 - The second change is: There was a bug with the '0810' message, so I put the number '0' in the left when the first bit is bigger than 4. Nos demais casos quando o bit Γ© menor que 4 a biblioteca funciona de forma correta. In other cases when the bit is less than 4 the library works properly.
It was '081021800000200000000203203700203700020300' now it is '081002180000020000000203203700203700020300'. EXAMPLE OF CODE AFTER AND BEFORE
Wrong message: 081021800000200000000203203700203700020300 0810 1) 2180000020000000 2) 0203203700203700 020300 Bit maps: Mapa de bits: 21800000200000000203203700203700 = 00100001100000000000000000000000001000000000000000000000000000000000001000000011001000000011011100000000001000000011011100000000
BIT[03], BIT[08], BIT[09], BIT[35]
Correct message: 081002180000020000000203203700203700020300 0810 1) 0218000002000000 2) 0203203700203700 020300
Bit maps: 02180000020000000203203700203700 = 00000010000110000000000000000000000000100000000000000000000000000000001000000011001000000011011100000000001000000011011100000000
BIT[07], BIT[12], BIT[13], BIT[39]