diff --git a/App/pelagia-portal/app/(portal)/payments/actions.ts b/App/pelagia-portal/app/(portal)/payments/actions.ts index 2e59400..d047338 100644 --- a/App/pelagia-portal/app/(portal)/payments/actions.ts +++ b/App/pelagia-portal/app/(portal)/payments/actions.ts @@ -169,6 +169,14 @@ export async function markPaid({ // Sync product catalog: auto-create new items, upsert per-vendor prices await syncProductCatalog(poId, po.lineItems, po.vendorId, session.user.id); + // Auto-verify the vendor on first successful payment + if (po.vendorId) { + await db.vendor.update({ + where: { id: po.vendorId }, + data: { isVerified: true }, + }); + } + const managers = await db.user.findMany({ where: { role: "MANAGER", isActive: true } }); await notify({ event: "PAYMENT_SENT", po, recipients: [po.submitter, ...managers] });