node-ebics-client/examples/initialize.js

27 lines
650 B
JavaScript
Raw Permalink Normal View History

2019-10-02 21:17:00 +00:00
#! /usr/bin/env node
'use strict';
const ebics = require('../index');
const configjs = require('./config.js');
2019-10-02 21:17:00 +00:00
const client = gClient;
2019-10-02 21:17:00 +00:00
// New keys will be generated and saved in ./keys-test
client.send(ebics.Orders.INI)
.then((resp) => {
console.log('Response for INI order %j', resp);
2019-10-02 21:17:00 +00:00
return client.send(ebics.Orders.HIA);
})
.then((resp) => {
console.log('Response for HIA order %j', resp);
2019-10-02 21:17:00 +00:00
if (resp.technicalCode !== '000000')
throw new Error('Something might went wrong');
console.log('Public keys should be sent to bank now. See examples/bankLetter.js');
})
.catch((err) => {
console.error(err);
process.exit(1);
});