mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2024-11-21 21:52:07 +00:00
Fixes in Client.js and BankLetter.js
Add DOMParser constant in Client.js Fix ebicsRequest function in Client.js Some clean up in Client.js Fix registerHelper sha256 in BankLetters.js
This commit is contained in:
parent
1f947ff148
commit
e12f1f7ec1
@ -40,7 +40,7 @@ module.exports = class BankLetter {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handlebars.registerHelper("sha256", (k) => {
|
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(' ');
|
return digest.toUpperCase().match(/.{1,2}/g).join(' ');
|
||||||
});
|
});
|
||||||
|
@ -7,7 +7,7 @@ const $request = require("request");
|
|||||||
const BN = require('bn.js');
|
const BN = require('bn.js');
|
||||||
const xpath = require("xpath");
|
const xpath = require("xpath");
|
||||||
const NodeRSA = require("node-rsa");
|
const NodeRSA = require("node-rsa");
|
||||||
|
const DOMParser = require("xmldom").DOMParser;
|
||||||
|
|
||||||
const Key = require('./Key');
|
const Key = require('./Key');
|
||||||
const XMLSign = require('./middleware/XMLSign');
|
const XMLSign = require('./middleware/XMLSign');
|
||||||
@ -97,9 +97,7 @@ module.exports = class Client {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(path, letter.generate());
|
fs.writeFileSync(path, letter.generate());
|
||||||
console.log("Data written to file");
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -113,9 +111,7 @@ module.exports = class Client {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(path, JSON.stringify(data));
|
fs.writeFileSync(path, JSON.stringify(data));
|
||||||
console.log("Data written to file");
|
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
console.log(error);
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -154,16 +150,11 @@ module.exports = class Client {
|
|||||||
|
|
||||||
ebicsRequest(order) {
|
ebicsRequest(order) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const bbb = XMLSign.go(this, order);
|
|
||||||
$request.post({
|
$request.post({
|
||||||
url : this.url,
|
url : this.url,
|
||||||
body : bbb,
|
body : XMLSign.go(this, order),
|
||||||
headers: { 'Content-Type': 'text/xml' }
|
headers: { 'content-type': 'text/xml;charset=UTF-8' }
|
||||||
}, (err, res, data) => {
|
}, (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));
|
return err ? reject(err): resolve(ParseResponse.go(this, data));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user