#2 corrected bank keys parsing

This commit is contained in:
vasyas 2019-06-27 00:13:44 +03:00
parent c571ef181b
commit 5f0b6cd374
2 changed files with 3 additions and 3 deletions

View File

@ -124,8 +124,8 @@ module.exports = (xml, keys) => ({
for (let i = 0; i < keyNodes.length; i++) { for (let i = 0; i < keyNodes.length; i++) {
const type = lastChild(keyNodes[i].parentNode).textContent; const type = lastChild(keyNodes[i].parentNode).textContent;
const modulus = xpath.select("//*[local-name(.)='Modulus']", keyNodes[i])[0].textContent; const modulus = xpath.select(".//*[local-name(.)='Modulus']", keyNodes[i])[0].textContent;
const exponent = xpath.select("//*[local-name(.)='Exponent']", keyNodes[i])[0].textContent; const exponent = xpath.select(".//*[local-name(.)='Exponent']", keyNodes[i])[0].textContent;
const mod = new BN(Buffer.from(modulus, 'base64'), 2).toBuffer(); const mod = new BN(Buffer.from(modulus, 'base64'), 2).toBuffer();
const exp = new BN(Buffer.from(exponent, 'base64')).toNumber(); const exp = new BN(Buffer.from(exponent, 'base64')).toNumber();

View File

@ -5,7 +5,7 @@ const H004Response = require('../lib/orders/H004/response');
describe('H004 response parsing', () => { describe('H004 response parsing', () => {
it('parses bank keys', () => { it('parses bank keys', () => {
const response = H004Response('', {}); const response = H004Response('<xml/>', {});
const x002mod = 'ntbX6WFjAJP5RyH4ogDG/26wZGzEJXsTudyvcgXmUdk1AExCNqArXDiSlGXpVNq4BKddUMFUmVOyvkdNckPRV2mk3uHNCE5T3tFKQI3FlwHSJHvPSpb9gtHnsK03jByMigWjhTKvsjIdfLVay5m5Bctxq9+5JMHwlNk7MlVXBQcqaFiHFFS1lPfA3Wk1bptPeeGyYcP0+U798oQWnCABKwS8hmYcp5xBtozGoRj9L/NDE68pdP8o/wTKNwT4Jo5nQKYfDsgO4R+z9vVv37Htp6bWhK8Jw3tpkcd3JnkYWx+Ylg0XBpg8LfjFhY2Jc7FqLlx0Bn0Y3PRLI1apxgC85w=='; const x002mod = 'ntbX6WFjAJP5RyH4ogDG/26wZGzEJXsTudy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