mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2024-11-24 23:22:06 +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 {
|
||||
constructor() {
|
||||
this._transactionKey = crypto.randomBytes(16);
|
||||
this._root = {};
|
||||
this._body = {};
|
||||
}
|
||||
|
||||
details(data) {
|
||||
@ -32,7 +30,6 @@ module.exports = class OrderBuilder {
|
||||
|
||||
ini() {
|
||||
this._type = 'ini';
|
||||
this._root.nodeName = 'ebicsUnsecuredRequest';
|
||||
|
||||
return this;
|
||||
}
|
||||
@ -41,13 +38,6 @@ module.exports = class OrderBuilder {
|
||||
const builder = new OrderBuilder();
|
||||
|
||||
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;
|
||||
}
|
||||
@ -56,8 +46,6 @@ module.exports = class OrderBuilder {
|
||||
* Getters
|
||||
*/
|
||||
get type() { return this._type; }
|
||||
get root() { return this._root; }
|
||||
get body() { return this._body; }
|
||||
get data() { return this._data; }
|
||||
get orderDetails() { return this._data.orderDetails; }
|
||||
get transactionId() { return this._data.transactionId; }
|
||||
|
@ -105,12 +105,6 @@ module.exports = class Response {
|
||||
const exp = new BN(Buffer.from(exponent, 'base64')).toNumber();
|
||||
|
||||
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;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
const js2xmlparser = require('js2xmlparser');
|
||||
|
||||
const consts = require('../../../consts');
|
||||
const xmlOptions = {
|
||||
declaration: {
|
||||
include: true,
|
||||
@ -54,17 +55,22 @@ const authSignature = ({
|
||||
module.exports = class GenericSerializer {
|
||||
constructor(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._hostId = orderBuilder.hostId;
|
||||
this._partnerId = orderBuilder.partnerId;
|
||||
this._userId = orderBuilder.userId;
|
||||
this._keys = orderBuilder.keys;
|
||||
this._transactionId = orderBuilder.transactionId;
|
||||
this._rootName = orderBuilder.root.nodeName;
|
||||
this._rootAttributes = orderBuilder.root.nodeAttributes;
|
||||
|
||||
this._xmlOptions = xmlOptions;
|
||||
this._xml = {};
|
||||
this._productString = consts.productString;
|
||||
}
|
||||
|
||||
static authSignature() {
|
||||
|
@ -3,7 +3,6 @@
|
||||
const zlib = require('zlib');
|
||||
const js2xmlparser = require('js2xmlparser');
|
||||
|
||||
const consts = require('../../../consts');
|
||||
const Crypto = require('../../../crypto/Crypto');
|
||||
|
||||
const GenericSerializer = require('./GenericSerializer');
|
||||
@ -24,7 +23,7 @@ module.exports = class InitializationSerializer extends GenericSerializer {
|
||||
UserID: this._userId,
|
||||
Product: {
|
||||
'@': { Language: 'en' },
|
||||
'#': consts.productString,
|
||||
'#': this._productString,
|
||||
},
|
||||
OrderDetails: this._orderDetails,
|
||||
SecurityMedium: '0000',
|
||||
@ -37,6 +36,7 @@ module.exports = class InitializationSerializer extends GenericSerializer {
|
||||
delete this._xml.header.static.Nonce;
|
||||
delete this._xml.header.static.Timestamp;
|
||||
|
||||
this._rootName = 'ebicsUnsecuredRequest';
|
||||
this._xml.body = {
|
||||
DataTransfer: {
|
||||
OrderData: this.orderData(),
|
||||
|
@ -5,7 +5,6 @@ const crypto = require('crypto');
|
||||
|
||||
const js2xmlparser = require('js2xmlparser');
|
||||
|
||||
const consts = require('../../../consts');
|
||||
const Crypto = require('../../../crypto/Crypto');
|
||||
|
||||
const GenericSerializer = require('./GenericSerializer');
|
||||
@ -28,7 +27,7 @@ module.exports = class PaymentSerializer extends GenericSerializer {
|
||||
UserID: this._userId,
|
||||
Product: {
|
||||
'@': { Language: 'en' },
|
||||
'#': consts.productString,
|
||||
'#': this._productString,
|
||||
},
|
||||
OrderDetails: this._orderDetails,
|
||||
BankPubKeyDigests: {
|
||||
|
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const consts = require('../../../consts');
|
||||
const Crypto = require('../../../crypto/Crypto');
|
||||
|
||||
const GenericSerializer = require('./GenericSerializer');
|
||||
@ -21,7 +20,7 @@ module.exports = class StatusSerializer extends GenericSerializer {
|
||||
UserID: this._userId,
|
||||
Product: {
|
||||
'@': { Language: 'en' },
|
||||
'#': consts.productString,
|
||||
'#': this._productString,
|
||||
},
|
||||
OrderDetails: this._orderDetails,
|
||||
BankPubKeyDigests: {
|
||||
|
Loading…
Reference in New Issue
Block a user