Update GenericOrder.js file

Add toTransferXML method
Add encryptedOrderData method
Clean some lines
This commit is contained in:
Vladislav Hristov 2018-05-31 12:01:21 +03:00
parent 7979999466
commit 140c2ccd69

View File

@ -1,9 +1,9 @@
'use strict';
// const randHex = require('../../lib/utils').randHex;
const crypto = require("crypto");
const crypto = require("crypto");
const js2xmlparser = require('js2xmlparser');
const consts = require('../consts');
const consts = require('../consts');
module.exports = class GenericOrder {
constructor(client) {
@ -24,8 +24,6 @@ module.exports = class GenericOrder {
doubleQuotes: true,
indent: '',
newline: '',
// indent: "\t",
// newline: "\r\n",
pretty: true
}
};
@ -137,6 +135,45 @@ module.exports = class GenericOrder {
return js2xmlparser.parse(this.root(), xmlObj, this.xmlOptions);
}
toTransferXML(){
const xmlObj = {
"@": {
"xmlns:ds": "http://www.w3.org/2000/09/xmldsig#",
xmlns: "urn:org:ebics:H004",
Version: "H004",
Revision: "1"
},
header: {
"@": { authenticate: true },
static: {
HostID: this.hostId,
TransactionID: this.transactionId
},
mutable: {
TransactionPhase: 'Transfer',
SegmentNumber: {
"@": { lastSegment: true },
"#": 1
}
}
},
AuthSignature: this.authSignature(),
body: {
DataTransfer: {
OrderData: this.encryptedOrderData()
}
}
};
return js2xmlparser.parse(this.root(), xmlObj, this.xmlOptions);
}
encryptedOrderData() {
}
toXML() {
return js2xmlparser.parse(this.root(), this._schema, this.xmlOptions);
}