From 0772e4710a85bd7da732a4dd7d3f193ecc52f22d Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 16 Sep 2025 11:44:13 +0700 Subject: [PATCH] fix: cannot update payment data after set payment completed --- src/controllers/05-payment-controller.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/controllers/05-payment-controller.ts b/src/controllers/05-payment-controller.ts index c61d4bc..7ad9584 100644 --- a/src/controllers/05-payment-controller.ts +++ b/src/controllers/05-payment-controller.ts @@ -152,7 +152,18 @@ export class QuotationPayment extends Controller { if (!record) throw notFoundError("Payment"); - if (record.paymentStatus === "PaymentSuccess") return record; + if (record.paymentStatus === "PaymentSuccess") { + const { channel, account, reference } = body; + return await prisma.payment.update({ + where: { id: paymentId, invoice: { quotationId: record.invoice.quotationId } }, + data: { + channel, + account, + reference, + updatedByUserId: req.user.sub, + }, + }); + } return await prisma.$transaction(async (tx) => { const current = new Date();