mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2025-08-15 12:15:36 +00:00
Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
82b226eec2 | ||
|
0f6dcf9eb2 | ||
|
ca31edf245 | ||
|
4464349d0f | ||
|
15546df9ea | ||
|
40467a2c5e | ||
|
eb9fbf5834 | ||
|
166c61aec4 | ||
|
5a63e19aab | ||
|
9e6c318372 | ||
|
ce6e58b3f3 | ||
|
7dad7c8787 | ||
|
79f17e1404 | ||
|
3ef32c8ce5 | ||
|
aa761cf7ad | ||
|
5ff3147124 | ||
|
01d4634d86 | ||
|
89904afa63 | ||
|
4907524259 | ||
|
c9f52d3bd9 | ||
|
f5b05ae491 | ||
|
9f88b048d7 | ||
|
d06e92c51c | ||
|
cb2062ae2f | ||
|
07a48e9cc5 | ||
|
800002701d | ||
|
5f0b6cd374 | ||
|
c571ef181b |
34
.eslintrc
34
.eslintrc
@@ -1,34 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "airbnb-base",
|
|
||||||
"env": {
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 8,
|
|
||||||
"sourceType": "script",
|
|
||||||
"ecmaFeatures": {
|
|
||||||
"modules": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"max-len": 0,
|
|
||||||
"linebreak-style": 0,
|
|
||||||
"no-plusplus": [
|
|
||||||
2,
|
|
||||||
{
|
|
||||||
"allowForLoopAfterthoughts": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-continue": 0,
|
|
||||||
"indent": [2, "tab"],
|
|
||||||
"no-tabs": 0,
|
|
||||||
"strict": [2, "safe"],
|
|
||||||
"curly": [2, "multi", "consistent"],
|
|
||||||
"import/no-extraneous-dependencies": 0,
|
|
||||||
"import/no-unresolved": 0,
|
|
||||||
"no-underscore-dangle": 0,
|
|
||||||
"no-param-reassign": 0,
|
|
||||||
"generator-star-spacing": 0,
|
|
||||||
"jsx-a11y/href-no-hash": "off"
|
|
||||||
}
|
|
||||||
}
|
|
4
.eslintrc.js
Normal file
4
.eslintrc.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
extends: "ecollect-base"
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
# node-ebics-client v0.0.35
|
# node-ebics-client
|
||||||
---
|
---
|
||||||
|
|
||||||
Pure node.js ( >=8 ) implementation of [EBICS](https://en.wikipedia.org/wiki/Electronic_Banking_Internet_Communication_Standard) ( Electronic Banking Internet Communication ).
|
Pure node.js ( >=8 ) implementation of [EBICS](https://en.wikipedia.org/wiki/Electronic_Banking_Internet_Communication_Standard) ( Electronic Banking Internet Communication ).
|
||||||
@@ -21,4 +21,4 @@ The basic concept of this library was inspired by the [EPICS](https://github.com
|
|||||||
|
|
||||||
## Copyright
|
## Copyright
|
||||||
|
|
||||||
Copyright: eCollect AG, 2018.
|
Copyright: eCollect AG, 2018-9.
|
||||||
|
8
lerna.json
Normal file
8
lerna.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"packages": [
|
||||||
|
"packages/*"
|
||||||
|
],
|
||||||
|
"npmClient": "yarn",
|
||||||
|
"useWorkspaces": true,
|
||||||
|
"version": "independent"
|
||||||
|
}
|
@@ -1,23 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const dateRange = (start, end) => {
|
|
||||||
if (start && end)
|
|
||||||
return {
|
|
||||||
DateRange: {
|
|
||||||
Start: start,
|
|
||||||
End: end,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = (start = null, end = null) => ({
|
|
||||||
version: 'h004',
|
|
||||||
orderDetails: {
|
|
||||||
OrderType: 'HAC',
|
|
||||||
OrderAttribute: 'DZHNN',
|
|
||||||
StandardOrderParams: dateRange(start, end),
|
|
||||||
},
|
|
||||||
operation: 'download',
|
|
||||||
});
|
|
@@ -1,23 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const dateRange = (start, end) => {
|
|
||||||
if (start && end)
|
|
||||||
return {
|
|
||||||
DateRange: {
|
|
||||||
Start: start,
|
|
||||||
End: end,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = (start = null, end = null) => ({
|
|
||||||
version: 'h004',
|
|
||||||
orderDetails: {
|
|
||||||
OrderType: 'PTK',
|
|
||||||
OrderAttribute: 'DZHNN',
|
|
||||||
StandardOrderParams: dateRange(start, end),
|
|
||||||
},
|
|
||||||
operation: 'download',
|
|
||||||
});
|
|
@@ -1,23 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const dateRange = (start, end) => {
|
|
||||||
if (start && end)
|
|
||||||
return {
|
|
||||||
DateRange: {
|
|
||||||
Start: start,
|
|
||||||
End: end,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = (start = null, end = null) => ({
|
|
||||||
version: 'h004',
|
|
||||||
orderDetails: {
|
|
||||||
OrderType: 'STA',
|
|
||||||
OrderAttribute: 'DZHNN',
|
|
||||||
StandardOrderParams: dateRange(start, end),
|
|
||||||
},
|
|
||||||
operation: 'download',
|
|
||||||
});
|
|
@@ -1,23 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const dateRange = (start, end) => {
|
|
||||||
if (start && end)
|
|
||||||
return {
|
|
||||||
DateRange: {
|
|
||||||
Start: start,
|
|
||||||
End: end,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = (start = null, end = null) => ({
|
|
||||||
version: 'h004',
|
|
||||||
orderDetails: {
|
|
||||||
OrderType: 'VMK',
|
|
||||||
OrderAttribute: 'DZHNN',
|
|
||||||
StandardOrderParams: dateRange(start, end),
|
|
||||||
},
|
|
||||||
operation: 'download',
|
|
||||||
});
|
|
48
package.json
48
package.json
@@ -1,38 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "ebics-client",
|
"name": "ebics-client-root",
|
||||||
"version": "0.0.4",
|
"private": true,
|
||||||
"description": "Node.js ISO 20022 Compliant EBICS Client",
|
"workspaces": [
|
||||||
"main": "index.js",
|
"packages/*"
|
||||||
"scripts": {
|
],
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"devDependencies": {
|
||||||
},
|
"chai": "^4.2.0",
|
||||||
"repository": {
|
"lerna": "^3.16.4",
|
||||||
"type": "git",
|
"eslint": "^6.5.1",
|
||||||
"url": "https://github.com/eCollect/node-ebics-client"
|
"eslint-config-ecollect-base": "^0.1.2",
|
||||||
},
|
"eslint-plugin-import": "^2.18.2"
|
||||||
"keywords": [
|
}
|
||||||
"EBICS",
|
|
||||||
"ISO20022",
|
|
||||||
"nodejs",
|
|
||||||
"api"
|
|
||||||
],
|
|
||||||
"author": "eCollect Sofia Tech Team",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"bn.js": "^4.11.8",
|
|
||||||
"handlebars": "^4.0.11",
|
|
||||||
"js2xmlparser": "^3.0.0",
|
|
||||||
"moment": "^2.22.1",
|
|
||||||
"node-rsa": "^0.4.2",
|
|
||||||
"request": "^2.87.0",
|
|
||||||
"uuid": "^3.3.2",
|
|
||||||
"xml-crypto": "^0.10.1",
|
|
||||||
"xmldom": "^0.1.27",
|
|
||||||
"xpath": "0.0.27"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint": "^4.19.1",
|
|
||||||
"eslint-config-airbnb-base": "^12.1.0",
|
|
||||||
"eslint-plugin-import": "^2.12.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
31
packages/ebics-client/examples/bankLetter.js
Executable file
31
packages/ebics-client/examples/bankLetter.js
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#! /usr/bin/env node
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const ebics = require('../index');
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
const os = require('os');
|
||||||
|
|
||||||
|
const client = new ebics.Client({
|
||||||
|
url: 'https://ebics.server',
|
||||||
|
partnerId: '',
|
||||||
|
userId: '',
|
||||||
|
hostId: '',
|
||||||
|
passphrase: 'test', // keys-test will be decrypted with this passphrase
|
||||||
|
keyStorage: ebics.fsKeysStorage('./keys-test'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const bankName = 'Bank name';
|
||||||
|
const template = fs.readFileSync('./templates/ini.hbs').toString();
|
||||||
|
const letter = new ebics.BankLetter({ client, bankName, template });
|
||||||
|
const bankLetterFile = path.join(os.homedir(), 'bankLetter.html');
|
||||||
|
|
||||||
|
letter.serialize(bankLetterFile)
|
||||||
|
.then(() => {
|
||||||
|
console.log('Send your bank the letter (%s)', bankLetterFile);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
32
packages/ebics-client/examples/initialize.js
Executable file
32
packages/ebics-client/examples/initialize.js
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#! /usr/bin/env node
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const ebics = require('../index');
|
||||||
|
|
||||||
|
const client = new ebics.Client({
|
||||||
|
url: 'https://ebics.server',
|
||||||
|
partnerId: 'PARTNER',
|
||||||
|
userId: 'USER',
|
||||||
|
hostId: 'HOST',
|
||||||
|
passphrase: 'test', // keys-test will be encrypted with this passphrase
|
||||||
|
keyStorage: ebics.fsKeysStorage('./keys-test'),
|
||||||
|
});
|
||||||
|
|
||||||
|
// New keys will be generated and saved in ./keys-test
|
||||||
|
client.send(ebics.Orders.INI)
|
||||||
|
.then((resp) => {
|
||||||
|
console.log('Respose for INI order %j', resp);
|
||||||
|
return client.send(ebics.Orders.HIA);
|
||||||
|
})
|
||||||
|
.then((resp) => {
|
||||||
|
console.log('Reponse for HIA order %j', resp);
|
||||||
|
if (resp.technicalCode !== '000000')
|
||||||
|
throw new Error('Something might went wrong');
|
||||||
|
|
||||||
|
console.log('Public keys should be sent to bank now. See examples/bankLetter.js');
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
30
packages/ebics-client/examples/save-bank-kesy.js
Executable file
30
packages/ebics-client/examples/save-bank-kesy.js
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#! /usr/bin/env node
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const ebics = require('../index');
|
||||||
|
|
||||||
|
const client = new ebics.Client({
|
||||||
|
url: 'https://ebics.server',
|
||||||
|
partnerId: '',
|
||||||
|
userId: '',
|
||||||
|
hostId: '',
|
||||||
|
passphrase: 'test', // keys-test will be decrypted with this passphrase
|
||||||
|
keyStorage: ebics.fsKeysStorage('./keys-test'),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Client keys must be already generated and send by letter.
|
||||||
|
// The bank should have enabled the user
|
||||||
|
client.send(ebics.Orders.HPB)
|
||||||
|
.then((resp) => {
|
||||||
|
console.log('Respose for HPB order %j', resp);
|
||||||
|
if (resp.technicalCode !== '000000')
|
||||||
|
throw new Error('Something went wrong');
|
||||||
|
|
||||||
|
console.log('Received bank keys: %j', resp.bankKeys);
|
||||||
|
return client.setBankKeys(resp.bankKeys);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
29
packages/ebics-client/examples/send-hbt-order.js
Executable file
29
packages/ebics-client/examples/send-hbt-order.js
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#! /usr/bin/env node
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const ebics = require('../index');
|
||||||
|
|
||||||
|
const client = new ebics.Client({
|
||||||
|
url: 'https://ebics.server',
|
||||||
|
partnerId: '',
|
||||||
|
userId: '',
|
||||||
|
hostId: '',
|
||||||
|
passphrase: 'test', // keys-test will be decrypted with this passphrase
|
||||||
|
keyStorage: ebics.fsKeysStorage('./keys-test'),
|
||||||
|
});
|
||||||
|
|
||||||
|
// The bank keys must have been already saved
|
||||||
|
client.send(ebics.Orders.HTD)
|
||||||
|
.then((resp) => {
|
||||||
|
console.log('Respose for HTD order %j', resp);
|
||||||
|
if (resp.technicalCode !== '000000')
|
||||||
|
throw new Error('Something went wrong');
|
||||||
|
|
||||||
|
const data = Buffer.from(resp.orderData);
|
||||||
|
console.log(data.toString('utf8'));
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
@@ -63,9 +63,9 @@ module.exports = class BankLetter {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(path, letter);
|
fs.writeFileSync(path, letter);
|
||||||
console.log('Data written to file');
|
console.log(`Data written to file on path '${path}'`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(`error while writing bank letter to path '${path}' with error ${error}`);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
return new Promise(resolve => resolve(true));
|
return new Promise(resolve => resolve(true));
|
@@ -42,7 +42,7 @@ module.exports = class Client {
|
|||||||
throw new Error('passphrase is requierd');
|
throw new Error('passphrase is requierd');
|
||||||
|
|
||||||
if (!keyStorage || typeof keyStorage.read !== 'function' || typeof keyStorage.write !== 'function')
|
if (!keyStorage || typeof keyStorage.read !== 'function' || typeof keyStorage.write !== 'function')
|
||||||
throw new Error('keyStorage implemntation missing or wrong');
|
throw new Error('keyStorage implementation missing or wrong');
|
||||||
|
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.partnerId = partnerId;
|
this.partnerId = partnerId;
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const packageJson = require('../package.json');
|
const packageJson = require('../package.json');
|
||||||
|
|
||||||
const name = 'eCollect Node Ebics Client';
|
const name = 'Node Ebics Client';
|
||||||
const { version } = packageJson;
|
const { version } = packageJson;
|
||||||
const orderOperations = {
|
const orderOperations = {
|
||||||
ini: 'INI',
|
ini: 'INI',
|
@@ -124,8 +124,8 @@ module.exports = (xml, keys) => ({
|
|||||||
|
|
||||||
for (let i = 0; i < keyNodes.length; i++) {
|
for (let i = 0; i < keyNodes.length; i++) {
|
||||||
const type = lastChild(keyNodes[i].parentNode).textContent;
|
const type = lastChild(keyNodes[i].parentNode).textContent;
|
||||||
const modulus = xpath.select("//*[local-name(.)='Modulus']", keyNodes[i])[0].textContent;
|
const modulus = xpath.select(".//*[local-name(.)='Modulus']", keyNodes[i])[0].textContent;
|
||||||
const exponent = xpath.select("//*[local-name(.)='Exponent']", keyNodes[i])[0].textContent;
|
const exponent = xpath.select(".//*[local-name(.)='Exponent']", keyNodes[i])[0].textContent;
|
||||||
|
|
||||||
const mod = new BN(Buffer.from(modulus, 'base64'), 2).toBuffer();
|
const mod = new BN(Buffer.from(modulus, 'base64'), 2).toBuffer();
|
||||||
const exp = new BN(Buffer.from(exponent, 'base64')).toNumber();
|
const exp = new BN(Buffer.from(exponent, 'base64')).toNumber();
|
13
packages/ebics-client/lib/predefinedOrders/HAC.js
Normal file
13
packages/ebics-client/lib/predefinedOrders/HAC.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const utils = require('../utils');
|
||||||
|
|
||||||
|
module.exports = (start = null, end = null) => ({
|
||||||
|
version: 'h004',
|
||||||
|
orderDetails: {
|
||||||
|
OrderType: 'HAC',
|
||||||
|
OrderAttribute: 'DZHNN',
|
||||||
|
StandardOrderParams: utils.dateRange(start, end),
|
||||||
|
},
|
||||||
|
operation: 'download',
|
||||||
|
});
|
13
packages/ebics-client/lib/predefinedOrders/PTK.js
Normal file
13
packages/ebics-client/lib/predefinedOrders/PTK.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const utils = require('../utils');
|
||||||
|
|
||||||
|
module.exports = (start = null, end = null) => ({
|
||||||
|
version: 'h004',
|
||||||
|
orderDetails: {
|
||||||
|
OrderType: 'PTK',
|
||||||
|
OrderAttribute: 'DZHNN',
|
||||||
|
StandardOrderParams: utils.dateRange(start, end),
|
||||||
|
},
|
||||||
|
operation: 'download',
|
||||||
|
});
|
13
packages/ebics-client/lib/predefinedOrders/STA.js
Normal file
13
packages/ebics-client/lib/predefinedOrders/STA.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const utils = require('../utils');
|
||||||
|
|
||||||
|
module.exports = (start = null, end = null) => ({
|
||||||
|
version: 'h004',
|
||||||
|
orderDetails: {
|
||||||
|
OrderType: 'STA',
|
||||||
|
OrderAttribute: 'DZHNN',
|
||||||
|
StandardOrderParams: utils.dateRange(start, end),
|
||||||
|
},
|
||||||
|
operation: 'download',
|
||||||
|
});
|
13
packages/ebics-client/lib/predefinedOrders/VMK.js
Normal file
13
packages/ebics-client/lib/predefinedOrders/VMK.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const utils = require('../utils');
|
||||||
|
|
||||||
|
module.exports = (start = null, end = null) => ({
|
||||||
|
version: 'h004',
|
||||||
|
orderDetails: {
|
||||||
|
OrderType: 'VMK',
|
||||||
|
OrderAttribute: 'DZHNN',
|
||||||
|
StandardOrderParams: utils.dateRange(start, end),
|
||||||
|
},
|
||||||
|
operation: 'download',
|
||||||
|
});
|
8
packages/ebics-client/lib/predefinedOrders/XCT.js
Normal file
8
packages/ebics-client/lib/predefinedOrders/XCT.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = document => ({
|
||||||
|
version: 'h004',
|
||||||
|
orderDetails: { OrderType: 'XCT', OrderAttribute: 'OZHNN', StandardOrderParams: {} },
|
||||||
|
operation: 'upload',
|
||||||
|
document,
|
||||||
|
});
|
13
packages/ebics-client/lib/predefinedOrders/Z53.js
Normal file
13
packages/ebics-client/lib/predefinedOrders/Z53.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const utils = require('../utils');
|
||||||
|
|
||||||
|
module.exports = (start = null, end = null) => ({
|
||||||
|
version: 'h004',
|
||||||
|
orderDetails: {
|
||||||
|
OrderType: 'Z53',
|
||||||
|
OrderAttribute: 'DZHNN',
|
||||||
|
StandardOrderParams: utils.dateRange(start, end),
|
||||||
|
},
|
||||||
|
operation: 'download',
|
||||||
|
});
|
@@ -12,6 +12,7 @@ const CDS = require('./CDS');
|
|||||||
const CCT = require('./CCT');
|
const CCT = require('./CCT');
|
||||||
const CCS = require('./CCS');
|
const CCS = require('./CCS');
|
||||||
const XE3 = require('./XE3');
|
const XE3 = require('./XE3');
|
||||||
|
const XCT = require('./XCT');
|
||||||
|
|
||||||
const STA = require('./STA');
|
const STA = require('./STA');
|
||||||
const VMK = require('./VMK');
|
const VMK = require('./VMK');
|
||||||
@@ -21,11 +22,13 @@ const HPD = require('./HPD');
|
|||||||
const HKD = require('./HKD');
|
const HKD = require('./HKD');
|
||||||
const PTK = require('./PTK');
|
const PTK = require('./PTK');
|
||||||
const HAC = require('./HAC');
|
const HAC = require('./HAC');
|
||||||
|
const Z53 = require('./Z53');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
INI,
|
INI,
|
||||||
HIA,
|
HIA,
|
||||||
HPB,
|
HPB,
|
||||||
|
Z53,
|
||||||
|
|
||||||
AZV,
|
AZV,
|
||||||
CD1,
|
CD1,
|
||||||
@@ -35,7 +38,7 @@ module.exports = {
|
|||||||
CCT,
|
CCT,
|
||||||
CCS,
|
CCS,
|
||||||
XE3,
|
XE3,
|
||||||
|
XCT,
|
||||||
STA,
|
STA,
|
||||||
VMK,
|
VMK,
|
||||||
HAA,
|
HAA,
|
18
packages/ebics-client/lib/utils.js
Normal file
18
packages/ebics-client/lib/utils.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const dateRange = (start, end) => {
|
||||||
|
if (start && end)
|
||||||
|
return {
|
||||||
|
DateRange: {
|
||||||
|
Start: start,
|
||||||
|
End: end,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return {};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
dateRange,
|
||||||
|
};
|
43
packages/ebics-client/package.json
Normal file
43
packages/ebics-client/package.json
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"name": "ebics-client",
|
||||||
|
"version": "0.0.7",
|
||||||
|
"description": "Node.js ISO 20022 Compliant EBICS Client",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/eCollect/node-ebics-client"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"EBICS",
|
||||||
|
"ISO20022",
|
||||||
|
"nodejs",
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"author": "eCollect Sofia Tech Team",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Vasyl Stashuk",
|
||||||
|
"url": "https://github.com/vasyas"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Yago",
|
||||||
|
"url": "https://github.com/yagop"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"bn.js": "^4.11.8",
|
||||||
|
"handlebars": "^4.0.11",
|
||||||
|
"js2xmlparser": "^3.0.0",
|
||||||
|
"moment": "^2.22.1",
|
||||||
|
"node-rsa": "^0.4.2",
|
||||||
|
"request": "^2.87.0",
|
||||||
|
"uuid": "^3.3.2",
|
||||||
|
"xml-crypto": "^0.10.1",
|
||||||
|
"xmldom": "^0.1.27",
|
||||||
|
"xpath": "0.0.27"
|
||||||
|
}
|
||||||
|
}
|
43
packages/ebics-client/test/responseParser.js
Normal file
43
packages/ebics-client/test/responseParser.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { assert } = require('chai');
|
||||||
|
const H004Response = require('../lib/orders/H004/response');
|
||||||
|
|
||||||
|
describe('H004 response parsing', () => {
|
||||||
|
it('parses bank keys', () => {
|
||||||
|
const response = H004Response('<xml/>', {});
|
||||||
|
|
||||||
|
const x002mod = 'ntbX6WFjAJP5RyH4ogDG/26wZGzEJXsTudyvcgXmUdk1AExCNqArXDiSlGXpVNq4BKddUMFUmVOyvkdNckPRV2mk3uHNCE5T3tFKQI3FlwHSJHvPSpb9gtHnsK03jByMigWjhTKvsjIdfLVay5m5Bctxq9+5JMHwlNk7MlVXBQcqaFiHFFS1lPfA3Wk1bptPeeGyYcP0+U798oQWnCABKwS8hmYcp5xBtozGoRj9L/NDE68pdP8o/wTKNwT4Jo5nQKYfDsgO4R+z9vVv37Htp6bWhK8Jw3tpkcd3JnkYWx+Ylg0XBpg8LfjFhY2Jc7FqLlx0Bn0Y3PRLI1apxgC85w==';
|
||||||
|
const e002mod = '4eOGrzcJHVzbEgZTmyPYUIq9kFoua8Ure1Mvyq6XlawFgCWskfu/xSKNLIMJ7H675wl/5y0Oy16P/b6pJEhWrzOw8omW46PBDTaXw9BDYBTuBblluz1yUnzpgfblP8gkRmxAo+QMIskmwdSzuZMiJcLNSzu/bkmLHK2RdrVYMAZLlB6QXTykdenPZtNmc2z4VU6TRmGljAwg2VUNF6iQoucbzDUuca+yUo3fiXZp69nfXv81X2ND+p1ir6zQpx7tbOdfauw0sEKI/Z/lC+E4fMrMlh/ZvOxSYUMA55J4liC3aUV3mTR3dPJHWu1aD1a7EfJnNw0eHLwlB+36qfgGuw==';
|
||||||
|
|
||||||
|
response.orderData = () => `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<HPBResponseOrderData xmlns="urn:org:ebics:H004" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
|
||||||
|
<AuthenticationPubKeyInfo>
|
||||||
|
<PubKeyValue>
|
||||||
|
<ds:RSAKeyValue>
|
||||||
|
<ds:Modulus>${x002mod}</ds:Modulus>
|
||||||
|
<ds:Exponent>AQAB</ds:Exponent>
|
||||||
|
</ds:RSAKeyValue>
|
||||||
|
<TimeStamp>2015-02-25T08:01:13.061Z</TimeStamp>
|
||||||
|
</PubKeyValue>
|
||||||
|
<AuthenticationVersion>X002</AuthenticationVersion>
|
||||||
|
</AuthenticationPubKeyInfo>
|
||||||
|
<EncryptionPubKeyInfo>
|
||||||
|
<PubKeyValue>
|
||||||
|
<ds:RSAKeyValue>
|
||||||
|
<ds:Modulus>${e002mod}</ds:Modulus>
|
||||||
|
<ds:Exponent>AQAB</ds:Exponent>
|
||||||
|
</ds:RSAKeyValue>
|
||||||
|
<TimeStamp>2015-02-25T08:01:12.344Z</TimeStamp>
|
||||||
|
</PubKeyValue>
|
||||||
|
<EncryptionVersion>E002</EncryptionVersion>
|
||||||
|
</EncryptionPubKeyInfo>
|
||||||
|
<HostID>SBKPR01</HostID>
|
||||||
|
</HPBResponseOrderData>`;
|
||||||
|
|
||||||
|
const bankKeys = response.bankKeys();
|
||||||
|
|
||||||
|
assert.equal(bankKeys.bankX002.mod.toString('base64'), x002mod);
|
||||||
|
assert.equal(bankKeys.bankE002.mod.toString('base64'), e002mod);
|
||||||
|
});
|
||||||
|
});
|
Reference in New Issue
Block a user