Skip to content

Commit

Permalink
Merge pull request #94 from TEDx-SJEC/new-admin
Browse files Browse the repository at this point in the history
New admin
  • Loading branch information
Vyshnav001 authored Dec 11, 2024
2 parents 1267947 + 2b61d07 commit c929cf0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/app/api/verify-order/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/components/common/registration-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c929cf0

Please sign in to comment.