diff --git a/src/controllers/05-payment-controller.ts b/src/controllers/05-payment-controller.ts index e5bf0a4..711e357 100644 --- a/src/controllers/05-payment-controller.ts +++ b/src/controllers/05-payment-controller.ts @@ -181,6 +181,7 @@ export class QuotationPayment extends Controller { await tx.quotation .update({ + include: { requestData: true }, where: { id: quotation.id }, data: { quotationStatus: @@ -238,6 +239,17 @@ export class QuotationPayment extends Controller { receiverId: res.createdByUserId, }, }); + + if (quotation.quotationStatus === "PaymentPending") { + await prisma.notification.create({ + data: { + title: "รายการคำขอใหม่ / New Request", + detail: "รหัส / code : " + res.requestData.map((v) => v.code).join(", "), + registeredBranchId: res.registeredBranchId, + groupReceiver: { create: { name: "document_checker" } }, + }, + }); + } }); return payment;