mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2024-11-22 14:12:07 +00:00
20 lines
640 B
JavaScript
20 lines
640 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const orders = require('../orders');
|
||
|
|
||
|
const iniSerializer = require('./serializers/ini');
|
||
|
const downloadSerializer = require('./serializers/download');
|
||
|
const uploadSerializer = require('./serializers/upload');
|
||
|
|
||
|
module.exports = {
|
||
|
use(order) {
|
||
|
const { version, orderType } = order;
|
||
|
|
||
|
if (orders.version(version).isIni(orderType)) return iniSerializer.use(order);
|
||
|
if (orders.version(version).isDownload(orderType)) return downloadSerializer.use(order);
|
||
|
if (orders.version(version).isUpload(orderType)) return uploadSerializer.use(order);
|
||
|
|
||
|
throw Error('Error from orders/orders.js: Wrong order version/type.');
|
||
|
},
|
||
|
};
|