diff --git a/lib/BankLetter.js b/lib/BankLetter.js index cc495e9..aa3ae9f 100644 --- a/lib/BankLetter.js +++ b/lib/BankLetter.js @@ -40,7 +40,7 @@ module.exports = class BankLetter { }); handlebars.registerHelper("sha256", (k) => { - const digest = Buffer(k.publicDigest(), 'base64').toString('HEX'); + const digest = Buffer.from(k.publicDigest(), 'base64').toString('HEX'); return digest.toUpperCase().match(/.{1,2}/g).join(' '); }); diff --git a/lib/Client.js b/lib/Client.js index 9df7a60..5abcd9c 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -7,7 +7,7 @@ const $request = require("request"); const BN = require('bn.js'); const xpath = require("xpath"); const NodeRSA = require("node-rsa"); - +const DOMParser = require("xmldom").DOMParser; const Key = require('./Key'); const XMLSign = require('./middleware/XMLSign'); @@ -97,9 +97,7 @@ module.exports = class Client { try { fs.writeFileSync(path, letter.generate()); - console.log("Data written to file"); } catch (error) { - console.log(error); throw error; } }; @@ -113,9 +111,7 @@ module.exports = class Client { try { fs.writeFileSync(path, JSON.stringify(data)); - console.log("Data written to file"); } catch(error) { - console.log(error); throw error; } }; @@ -154,16 +150,11 @@ module.exports = class Client { ebicsRequest(order) { return new Promise((resolve, reject) => { - const bbb = XMLSign.go(this, order); $request.post({ url : this.url, - body : bbb, - headers: { 'Content-Type': 'text/xml' } + body : XMLSign.go(this, order), + headers: { 'content-type': 'text/xml;charset=UTF-8' } }, (err, res, data) => { - const b = data; // keep this for debugging purposes - const r = ParseResponse.go(this, data); // keep this for debugging purposes - const rXML = r.toXML(); // keep this for debugging purposes - return err ? reject(err): resolve(ParseResponse.go(this, data)); }); });