node-ebics-client/examples/send-htd-order.js

30 lines
686 B
JavaScript
Raw Normal View History

2019-10-02 21:27:23 +00:00
#! /usr/bin/env node
'use strict';
const ebics = require('../index');
const client = new ebics.Client({
url: 'https://ebics.server',
partnerId: '',
userId: '',
hostId: '',
passphrase: 'test', // keys-test will be decrypted with this passphrase
keyStorage: ebics.fsKeysStorage('./keys-test'),
});
2019-10-02 22:07:52 +00:00
// The bank keys must have been already saved
2019-10-02 21:27:23 +00:00
client.send(ebics.Orders.HTD)
.then((resp) => {
console.log('Response for HTD order %j', resp);
2019-10-02 21:27:23 +00:00
if (resp.technicalCode !== '000000')
throw new Error('Something went wrong');
const data = Buffer.from(resp.orderData);
console.log(data.toString('utf8'));
})
.catch((err) => {
console.error(err);
process.exit(1);
});