diff --git a/lib/orders/GenericOrder.js b/lib/orders/GenericOrder.js index 0f07a44..b108102 100644 --- a/lib/orders/GenericOrder.js +++ b/lib/orders/GenericOrder.js @@ -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); }