2019-10-02 21:20:38 +00:00
|
|
|
#! /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: '',
|
2019-10-02 21:21:27 +00:00
|
|
|
passphrase: 'test', // keys-test will be decrypted with this passphrase
|
2019-10-02 21:20:38 +00:00
|
|
|
keyStorage: ebics.fsKeysStorage('./keys-test'),
|
|
|
|
});
|
|
|
|
|
2019-11-19 15:57:13 +00:00
|
|
|
const bankName = 'Bank name'; // Change this to the bank name you're going to send the letter to.
|
|
|
|
const languageCode = 'en'; // Currently 'de' and 'en' are valid values.
|
|
|
|
const template = fs.readFileSync('../templates/ini_'+languageCode+'.hbs').toString();
|
2019-10-02 21:20:38 +00:00
|
|
|
const letter = new ebics.BankLetter({ client, bankName, template });
|
2019-11-19 15:57:13 +00:00
|
|
|
const bankLetterFile = path.join(os.homedir(), 'bankLetter_'+languageCode+'.html');
|
2019-10-02 21:20:38 +00:00
|
|
|
|
|
|
|
letter.serialize(bankLetterFile)
|
|
|
|
.then(() => {
|
|
|
|
console.log('Send your bank the letter (%s)', bankLetterFile);
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
console.error(err);
|
|
|
|
process.exit(1);
|
|
|
|
});
|