diff --git a/application/modules/cashin/cahsin.controller.js b/application/modules/cashin/cahsin.controller.js index 8f752ec..b8b481c 100644 --- a/application/modules/cashin/cahsin.controller.js +++ b/application/modules/cashin/cahsin.controller.js @@ -374,9 +374,10 @@ const _generateCashIn = async (uniqueCode) => { for (const detail of reserv) { runningAmount += parseInt(detail.i_reservation_amount, 10); if (runningAmount > parseInt(detail.invoice_amount, 10)) { - throw new Error( - `ROLLBACK CASH-IN: AMOUNT CASH-IN > TOTAL INVOICE. AMOUNT ${runningAmount} > INVOICE AMOUNT (${detail.invoice_amount} on invoice ${detail.c_invoice_no})` + winston.logger.warn( + `SCHEDULER-FB70-${uniqueCode} SKIP CASH-IN: AMOUNT CASH-IN > TOTAL INVOICE. AMOUNT ${runningAmount} > INVOICE AMOUNT (${detail.invoice_amount} on invoice ${detail.c_invoice_no})` ); + return; } } @@ -468,9 +469,10 @@ const _generateCashInSales = async (uniqueCode) => { for (const detail of sales) { runningAmount += parseInt(detail.i_total_billing, 10); if (runningAmount > parseInt(detail.invoice_amount, 10)) { - throw new Error( - `ROLLBACK CASH-IN: AMOUNT CASH-IN > TOTAL INVOICE. AMOUNT ${runningAmount} > INVOICE AMOUNT (${detail.invoice_amount} on invoice ${detail.c_invoice_no})` + winston.logger.warn( + `SCHEDULER-FB70-${uniqueCode} SKIP CASH-IN SALES: AMOUNT CASH-IN > TOTAL INVOICE. AMOUNT ${runningAmount} > INVOICE AMOUNT (${detail.invoice_amount} on invoice ${detail.c_invoice_no})` ); + return; } } @@ -560,9 +562,10 @@ const _generateCashInSalesInternal = async (uniqueCode) => { for (const detail of sales) { runningAmount += parseInt(detail.i_total_price, 10); if (runningAmount > parseInt(detail.invoice_amount, 10)) { - throw new Error( - `ROLLBACK CASH-IN: AMOUNT CASH-IN > TOTAL INVOICE. AMOUNT ${runningAmount} > INVOICE AMOUNT (${detail.invoice_amount} on invoice ${detail.c_invoice_no})` + winston.logger.warn( + `SCHEDULER-FB70-${uniqueCode} SKIP CASH-IN SALES INTERNAL: AMOUNT CASH-IN > TOTAL INVOICE. AMOUNT ${runningAmount} > INVOICE AMOUNT (${detail.invoice_amount} on invoice ${detail.c_invoice_no})` ); + return; } } @@ -645,9 +648,10 @@ const _generateCashInTopUpCashlessInternal = async (uniqueCode) => { for (const detail of topup) { runningAmount += parseInt(detail.i_amount, 10); if (runningAmount > parseInt(detail.invoice_amount, 10)) { - throw new Error( - `ROLLBACK CASH-IN: AMOUNT CASH-IN > TOTAL INVOICE. AMOUNT ${runningAmount} > INVOICE AMOUNT (${detail.invoice_amount})` + winston.logger.warn( + `SCHEDULER-FB70-${uniqueCode} SKIP CASH-IN TOPUP CASHLESS INTERNAL: AMOUNT CASH-IN > TOTAL INVOICE. AMOUNT ${runningAmount} > INVOICE AMOUNT (${detail.invoice_amount})` ); + return; } }