From 81addd40e8efd90acd5baae804929f38227bcd52 Mon Sep 17 00:00:00 2001 From: WildanFahri Date: Sun, 26 Apr 2026 18:09:30 +0700 Subject: [PATCH] update funtion add helper scheduler --- .../modules/cashin/cahsin.controller.js | 18 ++++++++++++++++++ .../invoiceonline/invoice.controller.js | 12 ++++++++++++ 2 files changed, 30 insertions(+) diff --git a/application/modules/cashin/cahsin.controller.js b/application/modules/cashin/cahsin.controller.js index 64c8299..663451e 100644 --- a/application/modules/cashin/cahsin.controller.js +++ b/application/modules/cashin/cahsin.controller.js @@ -57,6 +57,10 @@ const apiGenerateCahsIn = async (req, res) => { `${uniqueCode} REQUEST generate cashin: ${JSON.stringify(req.body)}` ); + const schedulerCode = 'GENERATECASHINONLINETOPUP'; + const startData = await helper.startScheduler(schedulerCode); + const token = startData.c_execution_token ?? null; + // check validator const err = validationResult(req, res); if (!err.isEmpty()) { @@ -82,6 +86,8 @@ const apiGenerateCahsIn = async (req, res) => { data: cashIn, }; + const finishData = await helper.finishScheduler(token, schedulerCode); + return res.status(200).json(result); } catch (error) { // create log @@ -165,6 +171,10 @@ const apiGenerateCashInSalesInternal = async (req, res) => { `${uniqueCode} REQUEST generate cashin sales internal: ${JSON.stringify(req.body)}` ); + const schedulerCode = 'GENERATECASHINSALESSTATIONCASHLESS'; + const startData = await helper.startScheduler(schedulerCode); + const token = startData.c_execution_token ?? null; + // check validator const err = validationResult(req, res); if (!err.isEmpty()) { @@ -190,6 +200,8 @@ const apiGenerateCashInSalesInternal = async (req, res) => { data: cashIn, }; + const finishData = await helper.finishScheduler(token, schedulerCode); + return res.status(200).json(result); } catch (error) { // create log @@ -219,6 +231,10 @@ const apiGenerateCashInTopUpCashlessInternal = async (req, res) => { `${uniqueCode} REQUEST generate cashin topup cashless internal: ${JSON.stringify(req.body)}` ); + const schedulerCode = 'GENERATECASHINTOPUPSTATIONCASHLESS'; + const startData = await helper.startScheduler(schedulerCode); + const token = startData.c_execution_token ?? null; + // check validator const err = validationResult(req, res); if (!err.isEmpty()) { @@ -244,6 +260,8 @@ const apiGenerateCashInTopUpCashlessInternal = async (req, res) => { data: cashIn, }; + const finishData = await helper.finishScheduler(token, schedulerCode); + return res.status(200).json(result); } catch (error) { // create log diff --git a/application/modules/invoiceonline/invoice.controller.js b/application/modules/invoiceonline/invoice.controller.js index 2c04db7..212c3a7 100644 --- a/application/modules/invoiceonline/invoice.controller.js +++ b/application/modules/invoiceonline/invoice.controller.js @@ -53,6 +53,10 @@ const apiGenerateInvoice = async (req, res) => { `${uniqueCode} REQUEST generate invoice: ${JSON.stringify(req.body)}` ); + const schedulerCode = 'GENERATEINVOICEONLINETOPUP'; + const startData = await helper.startScheduler(schedulerCode); + const token = startData.c_execution_token ?? null; + // check validator let err = validationResult(req, res); if (!err.isEmpty()) { @@ -85,6 +89,8 @@ const apiGenerateInvoice = async (req, res) => { data: invoice, }; + const finishData = await helper.finishScheduler(token, schedulerCode); + return res.status(200).json(result); } catch (error) { // create log @@ -115,6 +121,10 @@ const apiPostingInvoice = async (req, res) => { `${uniqueCode} REQUEST posting invoice: ${JSON.stringify(req.body)}` ); + const schedulerCode = 'POSTINGINVOICEONLINETOPUP'; + const startData = await helper.startScheduler(schedulerCode); + const token = startData.c_execution_token ?? null; + // check validator let err = validationResult(req, res); if (!err.isEmpty()) { @@ -143,6 +153,8 @@ const apiPostingInvoice = async (req, res) => { data: invoice, }; + const finishData = await helper.finishScheduler(token, schedulerCode); + return res.status(200).json(result); } catch (error) { // create log