node-ebics-client/lib/orders/H004/serializer.js
2018-06-20 12:20:03 +03:00

20 lines
698 B
JavaScript

'use strict';
const constants = require('../../consts');
const iniSerializer = require('./serializers/ini');
const downloadSerializer = require('./serializers/download');
const uploadSerializer = require('./serializers/upload');
module.exports = {
use(order, client) {
const operation = order.operation.toUpperCase();
if (operation === constants.orderOperations.ini) return iniSerializer.use(order, client);
if (operation === constants.orderOperations.download) return downloadSerializer.use(order, client);
if (operation === constants.orderOperations.upload) return uploadSerializer.use(order, client);
throw Error('Error from orders/orders.js: Wrong order version/type.');
},
};