mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2024-11-24 23:22:06 +00:00
examples/bankLetter.js
This commit is contained in:
parent
7dad7c8787
commit
ce6e58b3f3
31
examples/bankLetter.js
Executable file
31
examples/bankLetter.js
Executable file
@ -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);
|
||||
});
|
Loading…
Reference in New Issue
Block a user