node-ebics-client/examples/bankLetter.js

27 lines
721 B
JavaScript
Raw Permalink Normal View History

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 configjs = require('./config.js');
2019-10-02 21:20:38 +00:00
const client = gClient;
2019-10-02 21:20:38 +00:00
const bankName = gConfig.bankName;
const languageCode = gConfig.languageCode;
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 });
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);
});