diff --git a/examples/bankLetter.js b/examples/bankLetter.js index 8f7fee0..3963e35 100755 --- a/examples/bankLetter.js +++ b/examples/bankLetter.js @@ -9,10 +9,9 @@ const os = require('os'); const config = require('./loadConfig')(); const client = require('./getClient')(config); -const bankName = config.bankName; -const languageCode = config.languageCode; -const template = fs.readFileSync('../templates/ini_'+config.languageCode+'.hbs', { encoding: 'utf8 '}); -const bankLetterFile = path.join(os.homedir(), 'bankLetter_'+languageCode+'.html'); +const bankName = client.bankName; +const template = fs.readFileSync("../templates/ini_"+client.languageCode+".hbs", { encoding: 'utf8'}); +const bankLetterFile = path.join("./", "bankLetter_"+client.bankShortName+"_"+client.languageCode+".html"); const letter = new ebics.BankLetter({ client, bankName, template }); diff --git a/examples/config/config.json b/examples/config/config.json index 44e3369..a91252f 100644 --- a/examples/config/config.json +++ b/examples/config/config.json @@ -5,6 +5,8 @@ "hostId": "MyHostIdTest", "passphrase": "MyPasswordTest", "keyStoragePath": "./keys-test", - "bankName":"Test Bank", - "languageCode":"en" + "bankName":"Test Bank Full Name", + "bankShortName":"TESTBANKSHORT", + "languageCode":"en", + "storageLocation":"\\\\myserver\\Share\\Folder\\BankName\\Test\\" } diff --git a/examples/config/config.production.testbank.json b/examples/config/config.production.testbank.json index 1bb31fa..b94996a 100644 --- a/examples/config/config.production.testbank.json +++ b/examples/config/config.production.testbank.json @@ -5,6 +5,8 @@ "hostId": "MyHostIdProduction", "passphrase": "MyPasswordProduction", "keyStoragePath": "./keys-prod", - "bankName":"Production Bank", - "languageCode":"en" + "bankName":"Production Bank Full Name", + "bankShortName":"PRODBANKSHORT", + "languageCode":"en", + "storageLocation":"\\\\myserver\\Share\\Folder\\BankName\\Production\\" } diff --git a/examples/config/config.production.testbank.testentity.json b/examples/config/config.production.testbank.testentity.json index 1bb31fa..b94996a 100644 --- a/examples/config/config.production.testbank.testentity.json +++ b/examples/config/config.production.testbank.testentity.json @@ -5,6 +5,8 @@ "hostId": "MyHostIdProduction", "passphrase": "MyPasswordProduction", "keyStoragePath": "./keys-prod", - "bankName":"Production Bank", - "languageCode":"en" + "bankName":"Production Bank Full Name", + "bankShortName":"PRODBANKSHORT", + "languageCode":"en", + "storageLocation":"\\\\myserver\\Share\\Folder\\BankName\\Production\\" } diff --git a/lib/Client.js b/lib/Client.js index 3140b10..4a829f1 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -46,6 +46,10 @@ const stringifyKeys = (keys) => { * @property {string} passphrase - passphrase for keys encryption * @property {KeyStorage} keyStorage - keyStorage 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, keyStorage, tracesStorage, + bankName, + bankShortName, + languageCode, + storageLocation, }) { if (!url) throw new Error('EBICS URL is required'); @@ -83,7 +91,11 @@ module.exports = class Client { this.hostId = hostId; this.keyStorage = keyStorage; 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) { diff --git a/templates/ini_fr.hbs b/templates/ini_fr.hbs new file mode 100644 index 0000000..5967b31 --- /dev/null +++ b/templates/ini_fr.hbs @@ -0,0 +1,164 @@ + + + + + + + EBICS ini + + + +
+

Lettre d'initialisation pour clés électroniques bancaires (INI)

+ + + + + + + + + + + + + + + + + + + + + +
Date{{ today }}
Heure{{ now }}
Banque{{ bankName }}
ID Utilisateur{{ userId }}
ID Partenaire{{ partnerId }}
+

Clé publique (Public Key) pour la signature électronique (A006)

+

Exposant ({{ keyExponentBits A006 }} Bit):

+

+ {{ keyExponent A006 }} +

+

Modulo ({{ keyModulusBits A006 }} Bit):

+

+ {{ keyModulus A006 }} +

+

Hash (SHA-256):

+

+ {{ sha256 A006 }} +

+

Je confirme par la présente la clé publique ci-dessus pour ma signature électronique.

+
+
+
+
+ + + + + + + + + + + +
___________________________________________________________________________
Lieu/DateNom/EntrepriseSignature
+
+
+

Lettre d'initialisation pour clés électroniques bancaires (HIA) - Page 1/2

+ + + + + + + + + + + + + + + + + + + + + +
Date{{ today }}
Heure{{ now }}
Banque{{ bankName }}
ID Utilisateur{{ userId }}
ID Partenaire{{ partnerId }}
+
+

Clé d'identification publique (X002)

+

Exposant ({{ keyExponentBits X002 }} Bit):

+

+ {{ keyExponent X002 }} +

+

Modulo ({{ keyModulusBits X002 }} Bit):

+

+ {{ keyModulus X002 }} +

+

Hash (SHA-256):

+

+ {{ sha256 X002 }} +

+

Suite à la page 2 ...

+
+

Lettre d'initialisation pour clés électroniques bancaires (HIA) - Page 2/2

+ + + + + + + + + + + + + + + + + + + + + +
Date{{ today }}
Heure{{ now }}
Banque{{ bankName }}
ID Utilisateur{{ userId }}
ID Partenaire{{ partnerId }}
+
+
+

Clé de chiffrement publique (E002)

+

Exposant ({{ keyExponentBits E002 }} Bit):

+

+ {{ keyExponent E002 }} +

+

Modulo ({{ keyModulusBits E002 }} Bit):

+

+ {{ keyModulus E002 }} +

+

Hash (SHA-256):

+

+ {{ sha256 E002 }} +

+

Je confirme par la présente les clés publiques ci-dessus.

+
+
+
+
+ + + + + + + + + + + +
___________________________________________________________________________
Lieu/DateNom/EntrepriseSignature
+
+ + +