From e33e0bc9f7e129be3289ffd7038ffaee181d2d6e Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Fri, 1 Nov 2024 10:45:41 +0700 Subject: [PATCH] fix: status change not work as expected --- src/controllers/05-payment-controller.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/controllers/05-payment-controller.ts b/src/controllers/05-payment-controller.ts index cb23c17..1365e27 100644 --- a/src/controllers/05-payment-controller.ts +++ b/src/controllers/05-payment-controller.ts @@ -145,6 +145,10 @@ export class QuotationPayment extends Controller { }, }); + if (body.paymentStatus === "PaymentSuccess") { + paymentSum._sum.amount = (paymentSum._sum.amount || 0) + payment.amount; + } + await tx.quotation.update({ where: { id: quotation.id }, data: {