fix: cannot update payment data after set payment completed
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s

This commit is contained in:
Methapon2001 2025-09-16 11:44:13 +07:00
parent 25a4b50f8e
commit 0772e4710a

View file

@ -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();