mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2025-12-17 00:52:46 +00:00
code optimization
This commit is contained in:
19
lib/orders/H004/serializer.js
Normal file
19
lib/orders/H004/serializer.js
Normal file
@@ -0,0 +1,19 @@
|
||||
'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.');
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user