mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2024-11-22 14:12:07 +00:00
Fix orderData method
This commit is contained in:
parent
044bbba9e3
commit
5d4e9f8309
@ -78,7 +78,7 @@ module.exports = class Client {
|
|||||||
const returnedBusinessCode = res.businessCode();
|
const returnedBusinessCode = res.businessCode();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
orderData: xml,
|
orderData: xml.length ? xml.toString() : xml,
|
||||||
orderId: res.orderId(),
|
orderId: res.orderId(),
|
||||||
|
|
||||||
technicalCode: returnedTechnicalCode,
|
technicalCode: returnedTechnicalCode,
|
||||||
|
@ -47,7 +47,7 @@ module.exports = (xml, keys) => ({
|
|||||||
const decipher = crypto.createDecipheriv('aes-128-cbc', this.transactionKey(), DEFAULT_IV).setAutoPadding(false);
|
const decipher = crypto.createDecipheriv('aes-128-cbc', this.transactionKey(), DEFAULT_IV).setAutoPadding(false);
|
||||||
const data = Buffer.from(decipher.update(orderData, 'base64', 'binary') + decipher.final('binary'), 'binary');
|
const data = Buffer.from(decipher.update(orderData, 'base64', 'binary') + decipher.final('binary'), 'binary');
|
||||||
|
|
||||||
return zlib.inflateSync(data).toString();
|
return zlib.inflateSync(data);
|
||||||
},
|
},
|
||||||
|
|
||||||
transactionKey() {
|
transactionKey() {
|
||||||
@ -111,17 +111,8 @@ module.exports = (xml, keys) => ({
|
|||||||
return errors.technical[code].meaning;
|
return errors.technical[code].meaning;
|
||||||
},
|
},
|
||||||
|
|
||||||
/* returnCode(where = 'header') {
|
|
||||||
const select = xpath.useNamespaces({ xmlns: 'urn:org:ebics:H004' });
|
|
||||||
const node = where === 'header'
|
|
||||||
? select('//xmlns:header/xmlns:mutable/xmlns:ReturnCode', this.doc)
|
|
||||||
: select('//xmlns:body/xmlns:ReturnCode', this.doc);
|
|
||||||
|
|
||||||
return node.length ? node[0].textContent : '';
|
|
||||||
}, */
|
|
||||||
|
|
||||||
bankKeys() {
|
bankKeys() {
|
||||||
const orderData = this.orderData();
|
const orderData = this.orderData().toString();
|
||||||
if (!Object.keys(orderData).length) return {};
|
if (!Object.keys(orderData).length) return {};
|
||||||
|
|
||||||
const doc = new DOMParser().parseFromString(orderData, 'text/xml');
|
const doc = new DOMParser().parseFromString(orderData, 'text/xml');
|
||||||
|
Loading…
Reference in New Issue
Block a user