node-ebics-client/packages/ebics-client/lib/orders/H004/serializer.js

20 lines
698 B
JavaScript
Raw Normal View History

2018-06-15 06:33:41 +00:00
'use strict';
2018-06-20 09:20:03 +00:00
const constants = require('../../consts');
2018-06-15 06:33:41 +00:00
const iniSerializer = require('./serializers/ini');
const downloadSerializer = require('./serializers/download');
const uploadSerializer = require('./serializers/upload');
module.exports = {
2018-06-20 09:20:03 +00:00
use(order, client) {
const operation = order.operation.toUpperCase();
2018-06-15 06:33:41 +00:00
2018-06-20 09:20:03 +00:00
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);
2018-06-15 06:33:41 +00:00
throw Error('Error from orders/orders.js: Wrong order version/type.');
},
};