This commit is contained in:
nanov 2021-03-30 14:24:07 +03:00
commit 2d580c0d44
7 changed files with 199 additions and 11 deletions

View File

@ -9,10 +9,9 @@ const os = require('os');
const config = require('./loadConfig')(); const config = require('./loadConfig')();
const client = require('./getClient')(config); const client = require('./getClient')(config);
const bankName = config.bankName; const bankName = client.bankName;
const languageCode = config.languageCode; const template = fs.readFileSync("../templates/ini_"+client.languageCode+".hbs", { encoding: 'utf8'});
const template = fs.readFileSync('../templates/ini_'+config.languageCode+'.hbs', { encoding: 'utf8 '}); const bankLetterFile = path.join("./", "bankLetter_"+client.bankShortName+"_"+client.languageCode+".html");
const bankLetterFile = path.join(os.homedir(), 'bankLetter_'+languageCode+'.html');
const letter = new ebics.BankLetter({ client, bankName, template }); const letter = new ebics.BankLetter({ client, bankName, template });

View File

@ -5,6 +5,8 @@
"hostId": "MyHostIdTest", "hostId": "MyHostIdTest",
"passphrase": "MyPasswordTest", "passphrase": "MyPasswordTest",
"keyStoragePath": "./keys-test", "keyStoragePath": "./keys-test",
"bankName":"Test Bank", "bankName":"Test Bank Full Name",
"languageCode":"en" "bankShortName":"TESTBANKSHORT",
"languageCode":"en",
"storageLocation":"\\\\myserver\\Share\\Folder\\BankName\\Test\\"
} }

View File

@ -5,6 +5,8 @@
"hostId": "MyHostIdProduction", "hostId": "MyHostIdProduction",
"passphrase": "MyPasswordProduction", "passphrase": "MyPasswordProduction",
"keyStoragePath": "./keys-prod", "keyStoragePath": "./keys-prod",
"bankName":"Production Bank", "bankName":"Production Bank Full Name",
"languageCode":"en" "bankShortName":"PRODBANKSHORT",
"languageCode":"en",
"storageLocation":"\\\\myserver\\Share\\Folder\\BankName\\Production\\"
} }

View File

@ -5,6 +5,8 @@
"hostId": "MyHostIdProduction", "hostId": "MyHostIdProduction",
"passphrase": "MyPasswordProduction", "passphrase": "MyPasswordProduction",
"keyStoragePath": "./keys-prod", "keyStoragePath": "./keys-prod",
"bankName":"Production Bank", "bankName":"Production Bank Full Name",
"languageCode":"en" "bankShortName":"PRODBANKSHORT",
"languageCode":"en",
"storageLocation":"\\\\myserver\\Share\\Folder\\BankName\\Production\\"
} }

View File

@ -46,6 +46,10 @@ const stringifyKeys = (keys) => {
* @property {string} passphrase - passphrase for keys encryption * @property {string} passphrase - passphrase for keys encryption
* @property {KeyStorage} keyStorage - keyStorage implementation * @property {KeyStorage} keyStorage - keyStorage implementation
* @property {object} [tracesStorage] - traces (logs) storage implementation * @property {object} [tracesStorage] - traces (logs) storage implementation
* @property {string} bankName - Full name of the bank to be used in the bank INI letters.
* @property {string} bankShortName - Short name of the bank to be used in folders, filenames etc.
* @property {string} languageCode - Language code to be used in the bank INI letters ("de", "en" and "fr" are currently supported).
* @property {string} storageLocation - Location where to store the files that are downloaded. This can be a network share for example.
*/ */
@ -62,6 +66,10 @@ module.exports = class Client {
passphrase, passphrase,
keyStorage, keyStorage,
tracesStorage, tracesStorage,
bankName,
bankShortName,
languageCode,
storageLocation,
}) { }) {
if (!url) if (!url)
throw new Error('EBICS URL is required'); throw new Error('EBICS URL is required');
@ -83,7 +91,11 @@ module.exports = class Client {
this.hostId = hostId; this.hostId = hostId;
this.keyStorage = keyStorage; this.keyStorage = keyStorage;
this.keyEncryptor = defaultKeyEncryptor({ passphrase }); this.keyEncryptor = defaultKeyEncryptor({ passphrase });
this.tracesStorage = tracesStorage || null; this.tracesStorage = tracesStorage || null;
this.bankName = bankName || "Dummy Bank Full Name",
this.bankShortName = bankShortName || "BANKSHORTCODE",
this.languageCode = languageCode || "en",
this.storageLocation = storageLocation || null,
} }
async send(order) { async send(order) {

View File

@ -63,10 +63,17 @@
"js2xmlparser": "^4.0.1", "js2xmlparser": "^4.0.1",
"node-forge": "^0.10.0", "node-forge": "^0.10.0",
"request": "^2.88.2", "request": "^2.88.2",
<<<<<<< HEAD
"uuid": "^8.3.2", "uuid": "^8.3.2",
"xml-crypto": "^2.1.1", "xml-crypto": "^2.1.1",
"xmldom": "^0.5.0", "xmldom": "^0.5.0",
"xpath": "0.0.32" "xpath": "0.0.32"
=======
"uuid": "^8.0.0",
"xml-crypto": "^2.0.0",
"xmldom": "^0.5.0",
"xpath": "0.0.27"
>>>>>>> cecaa782c93ee847c48b6580ee6c82b5a495f240
}, },
"devDependencies": { "devDependencies": {
"auto-changelog": "^1.16.2", "auto-changelog": "^1.16.2",

164
templates/ini_fr.hbs Normal file
View File

@ -0,0 +1,164 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta charset="UTF-8" />
<title>EBICS ini</title>
</head>
<body>
<div>
<h2>Lettre d'initialisation pour clés électroniques bancaires (INI)</h2>
<table>
<tr>
<td>Date</td>
<td>{{ today }}</td>
</tr>
<tr>
<td>Heure</td>
<td>{{ now }}</td>
</tr>
<tr>
<td>Banque</td>
<td>{{ bankName }}</td>
</tr>
<tr>
<td>ID Utilisateur</td>
<td>{{ userId }}</td>
</tr>
<tr>
<td>ID Partenaire</td>
<td>{{ partnerId }}</td>
</tr>
</table>
<p>Clé publique (Public Key) pour la signature électronique (A006)</p>
<p>Exposant ({{ keyExponentBits A006 }} Bit):</p>
<p>
<code>{{ keyExponent A006 }}</code>
</p>
<p>Modulo ({{ keyModulusBits A006 }} Bit):</p>
<p>
<code>{{ keyModulus A006 }}</code>
</p>
<p>Hash (SHA-256):</p>
<p>
<code>{{ sha256 A006 }}</code>
</p>
<p>Je confirme par la présente la clé publique ci-dessus pour ma signature électronique.</p>
<br/>
<br/>
<br/>
<br/>
<table>
<tr>
<td>_________________________</td>
<td>_________________________</td>
<td>_________________________</td>
</tr>
<tr>
<td>Lieu/Date</td>
<td>Nom/Entreprise</td>
<td>Signature</td>
</tr>
</table>
</div>
<div style="page-break-after:always"></div>
<h2>Lettre d'initialisation pour clés électroniques bancaires (HIA) - Page 1/2</h2>
<table>
<tr>
<td>Date</td>
<td>{{ today }}</td>
</tr>
<tr>
<td>Heure</td>
<td>{{ now }}</td>
</tr>
<tr>
<td>Banque</td>
<td>{{ bankName }}</td>
</tr>
<tr>
<td>ID Utilisateur</td>
<td>{{ userId }}</td>
</tr>
<tr>
<td>ID Partenaire</td>
<td>{{ partnerId }}</td>
</tr>
</table>
<div>
<p>Clé d'identification publique (X002)</p>
<p>Exposant ({{ keyExponentBits X002 }} Bit):</p>
<p>
<code>{{ keyExponent X002 }}</code>
</p>
<p>Modulo ({{ keyModulusBits X002 }} Bit):</p>
<p>
<code>{{ keyModulus X002 }}</code>
</p>
<p>Hash (SHA-256):</p>
<p>
<code>{{ sha256 X002 }}</code>
</p>
<p>Suite à la page 2 ...</p>
<div style="page-break-after:always"></div>
<h2>Lettre d'initialisation pour clés électroniques bancaires (HIA) - Page 2/2</h2>
<table>
<tr>
<td>Date</td>
<td>{{ today }}</td>
</tr>
<tr>
<td>Heure</td>
<td>{{ now }}</td>
</tr>
<tr>
<td>Banque</td>
<td>{{ bankName }}</td>
</tr>
<tr>
<td>ID Utilisateur</td>
<td>{{ userId }}</td>
</tr>
<tr>
<td>ID Partenaire</td>
<td>{{ partnerId }}</td>
</tr>
</table>
</div>
<div>
<p>Clé de chiffrement publique (E002)</p>
<p>Exposant ({{ keyExponentBits E002 }} Bit):</p>
<p>
<code>{{ keyExponent E002 }}</code>
</p>
<p>Modulo ({{ keyModulusBits E002 }} Bit):</p>
<p>
<code>{{ keyModulus E002 }}</code>
</p>
<p>Hash (SHA-256):</p>
<p>
<code>{{ sha256 E002 }}</code>
</p>
<p>Je confirme par la présente les clés publiques ci-dessus.</p>
<br/>
<br/>
<br/>
<br/>
<table>
<tr>
<td>_________________________</td>
<td>_________________________</td>
<td>_________________________</td>
</tr>
<tr>
<td>Lieu/Date</td>
<td>Nom/Entreprise</td>
<td>Signature</td>
</tr>
</table>
</div>
</body>
</html>