diff --git a/lib/consts.js b/lib/consts.js index 293287c..ebd1219 100644 --- a/lib/consts.js +++ b/lib/consts.js @@ -10,9 +10,22 @@ const orderOperations = { download: 'DOWNLOAD', }; +const dateRange = (start, end) => { + if (start && end) + return { + DateRange: { + Start: start, + End: end, + }, + }; + + return {}; +}; + module.exports = { name, version, orderOperations, productString: `${name} ${version}`, + dateRange, }; diff --git a/lib/predefinedOrders/HAC.js b/lib/predefinedOrders/HAC.js index 7700379..dcf86b5 100644 --- a/lib/predefinedOrders/HAC.js +++ b/lib/predefinedOrders/HAC.js @@ -1,23 +1,13 @@ 'use strict'; -const dateRange = (start, end) => { - if (start && end) - return { - DateRange: { - Start: start, - End: end, - }, - }; - - return {}; -}; +const utils = require('../consts'); module.exports = (start = null, end = null) => ({ version: 'h004', orderDetails: { OrderType: 'HAC', OrderAttribute: 'DZHNN', - StandardOrderParams: dateRange(start, end), + StandardOrderParams: utils.dateRange(start, end), }, operation: 'download', }); diff --git a/lib/predefinedOrders/PTK.js b/lib/predefinedOrders/PTK.js index 37d5667..38ad1c5 100644 --- a/lib/predefinedOrders/PTK.js +++ b/lib/predefinedOrders/PTK.js @@ -1,23 +1,13 @@ 'use strict'; -const dateRange = (start, end) => { - if (start && end) - return { - DateRange: { - Start: start, - End: end, - }, - }; - - return {}; -}; +const utils = require('../consts'); module.exports = (start = null, end = null) => ({ version: 'h004', orderDetails: { OrderType: 'PTK', OrderAttribute: 'DZHNN', - StandardOrderParams: dateRange(start, end), + StandardOrderParams: utils.dateRange(start, end), }, operation: 'download', }); diff --git a/lib/predefinedOrders/STA.js b/lib/predefinedOrders/STA.js index 1a0b39e..039353a 100644 --- a/lib/predefinedOrders/STA.js +++ b/lib/predefinedOrders/STA.js @@ -1,23 +1,13 @@ 'use strict'; -const dateRange = (start, end) => { - if (start && end) - return { - DateRange: { - Start: start, - End: end, - }, - }; - - return {}; -}; +const utils = require('../consts'); module.exports = (start = null, end = null) => ({ version: 'h004', orderDetails: { OrderType: 'STA', OrderAttribute: 'DZHNN', - StandardOrderParams: dateRange(start, end), + StandardOrderParams: utils.dateRange(start, end), }, operation: 'download', }); diff --git a/lib/predefinedOrders/VMK.js b/lib/predefinedOrders/VMK.js index e2bcc9b..e525e56 100644 --- a/lib/predefinedOrders/VMK.js +++ b/lib/predefinedOrders/VMK.js @@ -1,23 +1,13 @@ 'use strict'; -const dateRange = (start, end) => { - if (start && end) - return { - DateRange: { - Start: start, - End: end, - }, - }; - - return {}; -}; +const utils = require('../consts'); module.exports = (start = null, end = null) => ({ version: 'h004', orderDetails: { OrderType: 'VMK', OrderAttribute: 'DZHNN', - StandardOrderParams: dateRange(start, end), + StandardOrderParams: utils.dateRange(start, end), }, operation: 'download', }); diff --git a/lib/predefinedOrders/Z53.js b/lib/predefinedOrders/Z53.js new file mode 100644 index 0000000..9d877d1 --- /dev/null +++ b/lib/predefinedOrders/Z53.js @@ -0,0 +1,13 @@ +'use strict'; + +const utils = require('../consts'); + +module.exports = (start = null, end = null) => ({ + version: 'h004', + orderDetails: { + OrderType: 'Z53', + OrderAttribute: 'DZHNN', + StandardOrderParams: utils.dateRange(start, end), + }, + operation: 'download', +}); diff --git a/lib/predefinedOrders/index.js b/lib/predefinedOrders/index.js index 6109796..18e4f49 100644 --- a/lib/predefinedOrders/index.js +++ b/lib/predefinedOrders/index.js @@ -22,11 +22,13 @@ const HPD = require('./HPD'); const HKD = require('./HKD'); const PTK = require('./PTK'); const HAC = require('./HAC'); +const Z53 = require('./Z53'); module.exports = { INI, HIA, HPB, + Z53, AZV, CD1,