mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2024-11-22 06:02:09 +00:00
clean up the code
This commit is contained in:
parent
10111878fa
commit
d5d80ee1b8
@ -7,8 +7,6 @@ const crypto = require('crypto');
|
|||||||
module.exports = class OrderBuilder {
|
module.exports = class OrderBuilder {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._transactionKey = crypto.randomBytes(16);
|
this._transactionKey = crypto.randomBytes(16);
|
||||||
this._root = {};
|
|
||||||
this._body = {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
details(data) {
|
details(data) {
|
||||||
@ -32,7 +30,6 @@ module.exports = class OrderBuilder {
|
|||||||
|
|
||||||
ini() {
|
ini() {
|
||||||
this._type = 'ini';
|
this._type = 'ini';
|
||||||
this._root.nodeName = 'ebicsUnsecuredRequest';
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -41,13 +38,6 @@ module.exports = class OrderBuilder {
|
|||||||
const builder = new OrderBuilder();
|
const builder = new OrderBuilder();
|
||||||
|
|
||||||
builder._version = 'H004';
|
builder._version = 'H004';
|
||||||
builder._root.nodeName = 'ebicsRequest';
|
|
||||||
builder._root.nodeAttributes = {
|
|
||||||
'xmlns:ds': 'http://www.w3.org/2000/09/xmldsig#',
|
|
||||||
xmlns: 'urn:org:ebics:H004',
|
|
||||||
Version: 'H004',
|
|
||||||
Revision: '1',
|
|
||||||
};
|
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
@ -56,8 +46,6 @@ module.exports = class OrderBuilder {
|
|||||||
* Getters
|
* Getters
|
||||||
*/
|
*/
|
||||||
get type() { return this._type; }
|
get type() { return this._type; }
|
||||||
get root() { return this._root; }
|
|
||||||
get body() { return this._body; }
|
|
||||||
get data() { return this._data; }
|
get data() { return this._data; }
|
||||||
get orderDetails() { return this._data.orderDetails; }
|
get orderDetails() { return this._data.orderDetails; }
|
||||||
get transactionId() { return this._data.transactionId; }
|
get transactionId() { return this._data.transactionId; }
|
||||||
|
@ -105,12 +105,6 @@ module.exports = class Response {
|
|||||||
const exp = new BN(Buffer.from(exponent, 'base64')).toNumber();
|
const exp = new BN(Buffer.from(exponent, 'base64')).toNumber();
|
||||||
|
|
||||||
bankKeys[`bank${type}`] = { mod, exp };
|
bankKeys[`bank${type}`] = { mod, exp };
|
||||||
|
|
||||||
// const bank = new NodeRSA();
|
|
||||||
|
|
||||||
// bank.importKey({ n: mod, e: exp }, 'components-public');
|
|
||||||
|
|
||||||
// this.keys[`${this.hostId}.${type}`] = new Key(bank);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bankKeys;
|
return bankKeys;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const js2xmlparser = require('js2xmlparser');
|
const js2xmlparser = require('js2xmlparser');
|
||||||
|
|
||||||
|
const consts = require('../../../consts');
|
||||||
const xmlOptions = {
|
const xmlOptions = {
|
||||||
declaration: {
|
declaration: {
|
||||||
include: true,
|
include: true,
|
||||||
@ -54,17 +55,22 @@ const authSignature = ({
|
|||||||
module.exports = class GenericSerializer {
|
module.exports = class GenericSerializer {
|
||||||
constructor(orderBuilder) {
|
constructor(orderBuilder) {
|
||||||
this._order = orderBuilder;
|
this._order = orderBuilder;
|
||||||
|
this._rootName = 'ebicsRequest';
|
||||||
|
this._rootAttributes = {
|
||||||
|
'xmlns:ds': 'http://www.w3.org/2000/09/xmldsig#',
|
||||||
|
xmlns: 'urn:org:ebics:H004',
|
||||||
|
Version: 'H004',
|
||||||
|
Revision: '1',
|
||||||
|
};
|
||||||
this._orderDetails = orderBuilder.orderDetails;
|
this._orderDetails = orderBuilder.orderDetails;
|
||||||
this._hostId = orderBuilder.hostId;
|
this._hostId = orderBuilder.hostId;
|
||||||
this._partnerId = orderBuilder.partnerId;
|
this._partnerId = orderBuilder.partnerId;
|
||||||
this._userId = orderBuilder.userId;
|
this._userId = orderBuilder.userId;
|
||||||
this._keys = orderBuilder.keys;
|
this._keys = orderBuilder.keys;
|
||||||
this._transactionId = orderBuilder.transactionId;
|
this._transactionId = orderBuilder.transactionId;
|
||||||
this._rootName = orderBuilder.root.nodeName;
|
|
||||||
this._rootAttributes = orderBuilder.root.nodeAttributes;
|
|
||||||
|
|
||||||
this._xmlOptions = xmlOptions;
|
this._xmlOptions = xmlOptions;
|
||||||
this._xml = {};
|
this._xml = {};
|
||||||
|
this._productString = consts.productString;
|
||||||
}
|
}
|
||||||
|
|
||||||
static authSignature() {
|
static authSignature() {
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
const zlib = require('zlib');
|
const zlib = require('zlib');
|
||||||
const js2xmlparser = require('js2xmlparser');
|
const js2xmlparser = require('js2xmlparser');
|
||||||
|
|
||||||
const consts = require('../../../consts');
|
|
||||||
const Crypto = require('../../../crypto/Crypto');
|
const Crypto = require('../../../crypto/Crypto');
|
||||||
|
|
||||||
const GenericSerializer = require('./GenericSerializer');
|
const GenericSerializer = require('./GenericSerializer');
|
||||||
@ -24,7 +23,7 @@ module.exports = class InitializationSerializer extends GenericSerializer {
|
|||||||
UserID: this._userId,
|
UserID: this._userId,
|
||||||
Product: {
|
Product: {
|
||||||
'@': { Language: 'en' },
|
'@': { Language: 'en' },
|
||||||
'#': consts.productString,
|
'#': this._productString,
|
||||||
},
|
},
|
||||||
OrderDetails: this._orderDetails,
|
OrderDetails: this._orderDetails,
|
||||||
SecurityMedium: '0000',
|
SecurityMedium: '0000',
|
||||||
@ -37,6 +36,7 @@ module.exports = class InitializationSerializer extends GenericSerializer {
|
|||||||
delete this._xml.header.static.Nonce;
|
delete this._xml.header.static.Nonce;
|
||||||
delete this._xml.header.static.Timestamp;
|
delete this._xml.header.static.Timestamp;
|
||||||
|
|
||||||
|
this._rootName = 'ebicsUnsecuredRequest';
|
||||||
this._xml.body = {
|
this._xml.body = {
|
||||||
DataTransfer: {
|
DataTransfer: {
|
||||||
OrderData: this.orderData(),
|
OrderData: this.orderData(),
|
||||||
|
@ -5,7 +5,6 @@ const crypto = require('crypto');
|
|||||||
|
|
||||||
const js2xmlparser = require('js2xmlparser');
|
const js2xmlparser = require('js2xmlparser');
|
||||||
|
|
||||||
const consts = require('../../../consts');
|
|
||||||
const Crypto = require('../../../crypto/Crypto');
|
const Crypto = require('../../../crypto/Crypto');
|
||||||
|
|
||||||
const GenericSerializer = require('./GenericSerializer');
|
const GenericSerializer = require('./GenericSerializer');
|
||||||
@ -28,7 +27,7 @@ module.exports = class PaymentSerializer extends GenericSerializer {
|
|||||||
UserID: this._userId,
|
UserID: this._userId,
|
||||||
Product: {
|
Product: {
|
||||||
'@': { Language: 'en' },
|
'@': { Language: 'en' },
|
||||||
'#': consts.productString,
|
'#': this._productString,
|
||||||
},
|
},
|
||||||
OrderDetails: this._orderDetails,
|
OrderDetails: this._orderDetails,
|
||||||
BankPubKeyDigests: {
|
BankPubKeyDigests: {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const consts = require('../../../consts');
|
|
||||||
const Crypto = require('../../../crypto/Crypto');
|
const Crypto = require('../../../crypto/Crypto');
|
||||||
|
|
||||||
const GenericSerializer = require('./GenericSerializer');
|
const GenericSerializer = require('./GenericSerializer');
|
||||||
@ -21,7 +20,7 @@ module.exports = class StatusSerializer extends GenericSerializer {
|
|||||||
UserID: this._userId,
|
UserID: this._userId,
|
||||||
Product: {
|
Product: {
|
||||||
'@': { Language: 'en' },
|
'@': { Language: 'en' },
|
||||||
'#': consts.productString,
|
'#': this._productString,
|
||||||
},
|
},
|
||||||
OrderDetails: this._orderDetails,
|
OrderDetails: this._orderDetails,
|
||||||
BankPubKeyDigests: {
|
BankPubKeyDigests: {
|
||||||
|
Loading…
Reference in New Issue
Block a user