From 5e9767012c84fa47378b8f28324df96038d33335 Mon Sep 17 00:00:00 2001 From: Mohamad Ihsan Date: Tue, 18 Oct 2022 08:19:11 +0700 Subject: [PATCH] update payment recon --- .../paymentrecon/paymentrecon.controller.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/application/modules/paymentrecon/paymentrecon.controller.js b/application/modules/paymentrecon/paymentrecon.controller.js index 10d8c07..918a1eb 100644 --- a/application/modules/paymentrecon/paymentrecon.controller.js +++ b/application/modules/paymentrecon/paymentrecon.controller.js @@ -495,22 +495,22 @@ const paymentRecon = async (req, res) => { await _sleep(helper.randomNumberInt()); PaymentReconNumber = await generatePaymentReconNumber(partnerCode, now); - if (maxLoop > maxLoopParameter) { - // create log - winston.logger.error(`server is busy. please try again.`); - - return { - code: "500", - message: - process.env.NODE_ENV != "production" - ? error.message - : "server is busy. please try again.", - data: {}, - }; - } - maxLoop++; - } while (PaymentReconNumber == "XX"); + } while (PaymentReconNumber == "XX" || (maxLoop > maxLoopParameter)); + + if (maxLoop > maxLoopParameter) { + // create log + winston.logger.error(`server is busy. please try again.`); + + return { + code: "500", + message: + process.env.NODE_ENV != "production" + ? error.message + : "server is busy. please try again.", + data: {}, + }; + } // check ref no and amount let checkReservationNumberAndAmountAlreadyRecon =