Add additional bank configuration items

For prettier generation of bank letters and other bits used in examples:

Expand the bank config to include:

* "bankFullName" used in the INI letter's which are sent to the bank.
* "bankShortName" used in the filename for the generated letters and in other places if needed.
* "languageCode" used for determining which template to use for the bank (currently "en" and "de" are supported).
* "storageLocation" can be used to specify a local or network path where to store downloaded files.

* In bankLetter.js: Use the current script folder as output for the bank's letter in HTML format instead of the user/os homedir folder.

Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
This commit is contained in:
Herman van Hazendonk
2021-03-26 14:50:20 +01:00
parent f027bc4048
commit d192e61d29
6 changed files with 200 additions and 9 deletions

View File

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