import type { Metadata } from 'next' import { setRequestLocale } from 'next-intl/server' import { redirect } from '@/i18n/navigation' import { getSession } from '@/lib/session' import { getRealmName } from '@/lib/realm' import { reconcileSumUpCheckouts } from '@/lib/sumup' import { PageShell } from '@/components/PageShell' import { DPointsTabs } from '@/components/DPointsTabs' export const dynamic = 'force-dynamic' export const metadata: Metadata = { title: 'Adquirir PD' } export default async function DPointsPage({ params }: { params: Promise<{ locale: string }> }) { const { locale } = await params setRequestLocale(locale) const session = await getSession() if (!session.bnetId) redirect({ href: '/login', locale }) if (!session.username) redirect({ href: '/select-account', locale }) // SumUp no tiene webhooks: reconciliamos aquí los pagos SumUp pendientes de // esta cuenta por si el navegador no volvió al return_url tras pagar. if (session.accountId) await reconcileSumUpCheckouts({ accountId: session.accountId }).catch(() => {}) const realm = await getRealmName() const currency = (process.env.DP_CURRENCY || 'eur').toLowerCase() return ( ) }