9 Commits

Author SHA1 Message Date
Dimitar Nanov
c9f52d3bd9 bump 2019-07-24 09:12:06 +03:00
Dimitar Nanov
f5b05ae491 Merge pull request #4 from anandsahil/minorChanges
remove eCollect from constant and minor verbose error handaling
2019-07-24 09:05:14 +03:00
Dimitar Nanov
9f88b048d7 Merge pull request #5 from anandsahil/and-XCT-order-type
add iso pain format XCT order type
2019-07-24 09:04:22 +03:00
anandsahil
d06e92c51c add iso pain format XCT order type 2019-07-22 17:36:38 +02:00
anandsahil
cb2062ae2f remove eCollect from constant and minor verbose error handeling 2019-07-22 17:31:24 +02:00
Dimitar Nanov
07a48e9cc5 0.0.5 2019-06-28 17:12:49 +03:00
Dimitar Nanov
800002701d Merge pull request #3 from vasyas/master
Fix parsing of the bank keys in the HPB response
2019-06-28 17:09:49 +03:00
vasyas
5f0b6cd374 #2 corrected bank keys parsing 2019-06-27 00:13:44 +03:00
vasyas
c571ef181b tc for bank keys parsing error 2019-06-27 00:10:53 +03:00
9 changed files with 71 additions and 10 deletions

View File

@@ -1,7 +1,8 @@
{ {
"extends": "airbnb-base", "extends": "airbnb-base",
"env": { "env": {
"node": true "node": true,
"mocha": true
}, },
"parserOptions": { "parserOptions": {
"ecmaVersion": 8, "ecmaVersion": 8,

View File

@@ -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));

View File

@@ -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;

View File

@@ -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',

View File

@@ -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();

View File

@@ -0,0 +1,8 @@
'use strict';
module.exports = document => ({
version: 'h004',
orderDetails: { OrderType: 'XCT', OrderAttribute: 'OZHNN', StandardOrderParams: {} },
operation: 'upload',
document,
});

View File

@@ -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');
@@ -35,7 +36,7 @@ module.exports = {
CCT, CCT,
CCS, CCS,
XE3, XE3,
XCT,
STA, STA,
VMK, VMK,
HAA, HAA,

View File

@@ -1,6 +1,6 @@
{ {
"name": "ebics-client", "name": "ebics-client",
"version": "0.0.4", "version": "0.0.6",
"description": "Node.js ISO 20022 Compliant EBICS Client", "description": "Node.js ISO 20022 Compliant EBICS Client",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@@ -17,6 +17,12 @@
"api" "api"
], ],
"author": "eCollect Sofia Tech Team", "author": "eCollect Sofia Tech Team",
"contributors": [
{
"name": "Vasyl Stashuk",
"url": "https://github.com/vasyas"
}
],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"bn.js": "^4.11.8", "bn.js": "^4.11.8",
@@ -31,8 +37,10 @@
"xpath": "0.0.27" "xpath": "0.0.27"
}, },
"devDependencies": { "devDependencies": {
"chai": "^4.2.0",
"eslint": "^4.19.1", "eslint": "^4.19.1",
"eslint-config-airbnb-base": "^12.1.0", "eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.12.0" "eslint-plugin-import": "^2.12.0",
"mocha": "^6.1.4"
} }
} }

43
test/responseParser.js Normal file
View 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);
});
});