651d8deafc
Se externaliza el texto español hardcodeado de ~55 archivos a next-intl y se añaden traducciones al inglés, con paridad de claves es/en. Nuevos namespaces: History, CharService, CharServiceB, Points, Legal, UI, Misc (+ altas en Common/Admin). - Historiales (PD/PV, transacciones, sanciones, seguridad), servicios de personaje (transfer, send-gift, quest, restore-*, change-*, customize, level-up, gold, rename), PD/pagos (d-points, trade, promo, transfer-dp, rename-guild, DPointsTabs), páginas legales (cookies, privacidad, términos, reembolsos, aviso legal, contacto), layout (cabecera, footer, cookies, 2FA, descargas, jugadores, recluta) y páginas varias (home, reino, ayuda, addons, 2falogin). - Textos con markup inline via t.rich; interpolación con ICU. - Componente <NoteLegend/> para la leyenda NOTA/NOTE compartida. - payLabel/confirmText de los servicios de pago traducidos. - Verificado: tsc OK, next build OK, todas las claves t() resuelven en es y en, todos los t.rich casan etiquetas, páginas 200 en /es/ y /en/ sin claves crudas. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
56 lines
1.8 KiB
TypeScript
56 lines
1.8 KiB
TypeScript
import { getTranslations, setRequestLocale } from 'next-intl/server'
|
|
import { Link } from '@/i18n/navigation'
|
|
import { fulfillCheckoutSession } from '@/lib/fulfill'
|
|
import { isSessionPaid } from '@/lib/stripe'
|
|
import { fulfillSumUpCheckout } from '@/lib/sumup'
|
|
import { PageShell } from '@/components/PageShell'
|
|
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
export default async function DPointsSuccessPage({
|
|
params,
|
|
searchParams,
|
|
}: {
|
|
params: Promise<{ locale: string }>
|
|
searchParams: Promise<{ provider?: string; session_id?: string; ref?: string }>
|
|
}) {
|
|
const { locale } = await params
|
|
setRequestLocale(locale)
|
|
const t = await getTranslations('Points')
|
|
const { provider, session_id, ref } = await searchParams
|
|
|
|
// Entrega compartida con el webhook/return (idempotente vía reclamo atómico).
|
|
let status: 'ok' | 'already' | 'error' = 'error'
|
|
|
|
if (provider === 'sumup' && ref) {
|
|
const r = await fulfillSumUpCheckout(ref)
|
|
if (r.ok) status = 'ok'
|
|
else if (r.paid) status = 'already'
|
|
} else if (session_id) {
|
|
const r = await fulfillCheckoutSession(session_id)
|
|
if (r.ok) status = 'ok'
|
|
else if (await isSessionPaid(session_id)) status = 'already'
|
|
}
|
|
|
|
return (
|
|
<PageShell title={t('dpointsSuccess.title')}>
|
|
<div className="box-content">
|
|
<div className="body-box-content centered">
|
|
{status === 'ok' ? (
|
|
<span className="ok-form-response">{t('dpointsSuccess.paidOk')}</span>
|
|
) : status === 'already' ? (
|
|
<span className="ok-form-response">{t('dpointsSuccess.alreadyPaid')}</span>
|
|
) : (
|
|
<span className="red-form-response">{t('dpointsSuccess.error')}</span>
|
|
)}
|
|
<br />
|
|
<br />
|
|
<p>
|
|
<Link href="/my-account">{t('dpointsSuccess.backToAccount')}</Link>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</PageShell>
|
|
)
|
|
}
|