From ce6e58b3f33017967e5b26fe15a2c435012b8af6 Mon Sep 17 00:00:00 2001 From: Yago Perez Date: Wed, 2 Oct 2019 23:20:38 +0200 Subject: [PATCH] examples/bankLetter.js --- examples/bankLetter.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 examples/bankLetter.js diff --git a/examples/bankLetter.js b/examples/bankLetter.js new file mode 100755 index 0000000..b329bf2 --- /dev/null +++ b/examples/bankLetter.js @@ -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 keys + 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); + });