mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2025-08-13 19:35:34 +00:00
Merge pull request #49 from Herrie82/herrie/gazprumm
Add support for Bank GPB AO (Gazprombank Russia)
This commit is contained in:
28
examples/send-g02-order-zipped.js
Normal file
28
examples/send-g02-order-zipped.js
Normal file
@@ -0,0 +1,28 @@
|
||||
#! /usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const client = require('./getClient')();
|
||||
const { Orders } = require('../index');
|
||||
|
||||
// The bank keys must have been already saved
|
||||
client.send(Orders.G02(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
|
||||
.then((resp) => {
|
||||
console.log('Response for G02 order %j', resp);
|
||||
if (resp.technicalCode !== '000000')
|
||||
throw new Error('Something went wrong');
|
||||
|
||||
// Parsing and processing the G02 Pain.002.001.06 file should happen somewhere here, ideally after saving it to disk
|
||||
const data = Buffer.from(resp.orderData);
|
||||
let distPath = "G02.zip";
|
||||
const dstZip = fs.createWriteStream(distPath);
|
||||
dstZip.write(data);
|
||||
dstZip.end();
|
||||
})
|
||||
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
20
examples/send-g1r-order.js
Normal file
20
examples/send-g1r-order.js
Normal file
@@ -0,0 +1,20 @@
|
||||
#! /usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const client = require('./getClient')();
|
||||
const { Orders } = require('../index');
|
||||
|
||||
// The bank keys must have been already saved
|
||||
const paymentFile = fs.readFileSync('RUB_PAYMENT.xml').toString();
|
||||
|
||||
client.send(Orders.G1R(paymentFile))
|
||||
.then((resp) => {
|
||||
console.log('Response for G1R order %j', resp);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
20
examples/send-g1v-order.js
Normal file
20
examples/send-g1v-order.js
Normal file
@@ -0,0 +1,20 @@
|
||||
#! /usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const client = require('./getClient')();
|
||||
const { Orders } = require('../index');
|
||||
|
||||
// The bank keys must have been already saved
|
||||
const paymentFile = fs.readFileSync('FCY_PAYMENT.xml').toString();
|
||||
|
||||
client.send(Orders.G1V(paymentFile))
|
||||
.then((resp) => {
|
||||
console.log('Response for G1V order %j', resp);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
28
examples/send-g52-order-zipped.js
Normal file
28
examples/send-g52-order-zipped.js
Normal file
@@ -0,0 +1,28 @@
|
||||
#! /usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const client = require('./getClient')();
|
||||
const { Orders } = require('../index');
|
||||
|
||||
// The bank keys must have been already saved
|
||||
client.send(Orders.G52(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
|
||||
.then((resp) => {
|
||||
console.log('Response for G52 order %j', resp);
|
||||
if (resp.technicalCode !== '000000')
|
||||
throw new Error('Something went wrong');
|
||||
|
||||
// Parsing and processing the CAMT052 file should happen somewhere here, ideally after saving it to disk
|
||||
const data = Buffer.from(resp.orderData);
|
||||
let distPath = "CAMT052-G52.zip";
|
||||
const dstZip = fs.createWriteStream(distPath);
|
||||
dstZip.write(data);
|
||||
dstZip.end();
|
||||
})
|
||||
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
28
examples/send-g53-order-zipped.js
Normal file
28
examples/send-g53-order-zipped.js
Normal file
@@ -0,0 +1,28 @@
|
||||
#! /usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const client = require('./getClient')();
|
||||
const { Orders } = require('../index');
|
||||
|
||||
// The bank keys must have been already saved
|
||||
client.send(Orders.G53(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
|
||||
.then((resp) => {
|
||||
console.log('Response for G53 order %j', resp);
|
||||
if (resp.technicalCode !== '000000')
|
||||
throw new Error('Something went wrong');
|
||||
|
||||
// Parsing and processing the CAMT053 file should happen somewhere here, ideally after saving it to disk
|
||||
const data = Buffer.from(resp.orderData);
|
||||
let distPath = "CAMT053-G53.zip";
|
||||
const dstZip = fs.createWriteStream(distPath);
|
||||
dstZip.write(data);
|
||||
dstZip.end();
|
||||
})
|
||||
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
Reference in New Issue
Block a user