Initial upload of BB-Apartment 2026 website.
Adds the complete Next.js website including i18n routing, house and apartment pages, Beds24 v2 integration for live availability/pricing, Stripe checkout, contact forms, Docker setup and deployment docs. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
232770afe7
commit
2b24334bfa
@@ -0,0 +1,44 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { getStripe } from "@/src/lib/stripe";
|
||||
import { prisma } from "@/src/lib/prisma";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const { bookingReference, email } = await request.json();
|
||||
|
||||
if (!bookingReference || !email) {
|
||||
return NextResponse.json(
|
||||
{ error: "Missing bookingReference or email" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const booking = await prisma.booking.findUnique({
|
||||
where: { bookingReference },
|
||||
});
|
||||
|
||||
if (!booking || booking.guestEmail !== email || !booking.stripeCustomerId) {
|
||||
return NextResponse.json(
|
||||
{ error: "Booking not found" },
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
const stripe = getStripe(booking.houseId);
|
||||
|
||||
const session = await stripe.billingPortal.sessions.create({
|
||||
customer: booking.stripeCustomerId,
|
||||
return_url: `${process.env.NEXT_PUBLIC_BASE_URL}/de`,
|
||||
});
|
||||
|
||||
return NextResponse.json({ url: session.url });
|
||||
} catch (error) {
|
||||
console.error("Portal session error:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to create portal session" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user