diff --git a/src/app/api/verify-order/route.ts b/src/app/api/verify-order/route.ts index 22075f4..107487d 100644 --- a/src/app/api/verify-order/route.ts +++ b/src/app/api/verify-order/route.ts @@ -9,14 +9,12 @@ export async function POST(request: NextRequest) { if (!session) { return NextResponse.json({ message: "No session", isOk: false }, { status: 400 }); } - const { email, orderId, razorpayPaymentId, razorpaySignature, amount } = await request.json(); + const { email, orderId, razorpayPaymentId, razorpaySignature, amount, name } = await request.json(); if (!email || !orderId || !razorpayPaymentId || !razorpaySignature || !amount) { - return NextResponse.json({ message: "Invalid data", isOk: false }, { status : 400 }); + return NextResponse.json({ message: "Invalid data", isOk: false }, { status: 400 }); } - const userEmail = session.user?.role === "ADMIN" || session.user?.email !== email - ? email - : session.user?.email!; - + const userEmail = + session.user?.role === "ADMIN" || session.user?.email !== email ? email : session.user?.email!; const signature = generatedSignature(orderId, razorpayPaymentId); if (signature !== razorpaySignature) { @@ -32,7 +30,7 @@ export async function POST(request: NextRequest) { try { await sendRegistrationEmail({ email: userEmail, - name: session.user?.name!, + name: name, registrationLink: `${process.env.NEXT_PUBLIC_SITE_URL}/admin/verify/${razorpayPaymentId}`, }); } catch (error) { diff --git a/src/components/common/registration-form.tsx b/src/components/common/registration-form.tsx index fbcc573..cf784b9 100644 --- a/src/components/common/registration-form.tsx +++ b/src/components/common/registration-form.tsx @@ -152,6 +152,7 @@ export default function RegistrationForm() { headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email: form.getValues("email"), + name: form.getValues("name"), orderId: response.razorpay_order_id, razorpayPaymentId: response.razorpay_payment_id, razorpaySignature: response.razorpay_signature,