fix: cannot update payment data after set payment completed
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
This commit is contained in:
parent
25a4b50f8e
commit
0772e4710a
1 changed files with 12 additions and 1 deletions
|
|
@ -152,7 +152,18 @@ export class QuotationPayment extends Controller {
|
||||||
|
|
||||||
if (!record) throw notFoundError("Payment");
|
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) => {
|
return await prisma.$transaction(async (tx) => {
|
||||||
const current = new Date();
|
const current = new Date();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue