mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2025-08-14 03:35:36 +00:00
reorder file structure
This commit is contained in:
@@ -1,16 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const Response = require('../Response');
|
||||
const H004Response = require('../versions/H004/Response');
|
||||
|
||||
module.exports = class ParseResponse {
|
||||
static go(keys, data) {
|
||||
const response = new Response(keys, data);
|
||||
static parse(data, keys, version) {
|
||||
if (version.toUpperCase() === 'H004') return new H004Response(data, keys);
|
||||
|
||||
// TODO:
|
||||
// raise error if any
|
||||
|
||||
this.data = response.doc;
|
||||
|
||||
return response;
|
||||
throw Error('Unknow EBICS response version');
|
||||
}
|
||||
};
|
||||
|
@@ -1,16 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
const Signer = require('../Signer');
|
||||
const H004Signer = require('../versions/H004/Signer');
|
||||
|
||||
const H004Serializer = require('../versions/H004/OrderSerializer');
|
||||
|
||||
module.exports = class XMLSign {
|
||||
static go(keys, xml) {
|
||||
const signer = new Signer(keys, xml);
|
||||
static sign(order) {
|
||||
const { keys } = order;
|
||||
|
||||
signer.digest();
|
||||
signer.sign();
|
||||
if (order.version.toUpperCase() === 'H004') return new H004Signer(H004Serializer.serialize(order).toXML(), keys).digest().sign().toXML();
|
||||
|
||||
this.data = signer.toXML();
|
||||
|
||||
return this.data;
|
||||
throw Error('Error from XMLSign class: Invalid version number');
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user