web-next: /restore-items cobra por SumUp (1€/ítem) en vez de PD

- Nuevo servicio de pago `restore-item` (getRestoreItemPrice default 1€, fulfill
  SOAP `.item restore <recover_id> <char>`). Al pulsar "Recuperar" se crea un
  checkout de SumUp y al pagar se ejecuta el restore.
- Se quita el descuento de 100 PD y el gate "No tienes PD suficientes".
- La búsqueda sigue igual (gratis, cooldown 8h, Turnstile).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-14 13:17:23 +00:00
parent 03f75e189c
commit 671632a6a0
6 changed files with 27 additions and 84 deletions
+4 -8
View File
@@ -3,8 +3,7 @@ import { setRequestLocale } from 'next-intl/server'
import { redirect } from '@/i18n/navigation'
import { getSession } from '@/lib/session'
import { getGameCharacters } from '@/lib/characters'
import { getDPointsBalance } from '@/lib/dpoints'
import { RESTORE_ITEM_PD } from '@/lib/restore-items'
import { getRestoreItemPrice } from '@/lib/prices'
import { PageShell } from '@/components/PageShell'
import { ServiceBox } from '@/components/ServiceBox'
import { RestoreItemsForm } from '@/components/RestoreItemsForm'
@@ -21,7 +20,7 @@ export default async function RestoreItemsPage({ params }: { params: Promise<{ l
if (!session.bnetId) redirect({ href: '/login', locale })
if (!session.username) redirect({ href: '/select-account', locale })
const [chars, balance] = await Promise.all([getGameCharacters(session.accountId!), getDPointsBalance(session.accountId!)])
const [chars, price] = await Promise.all([getGameCharacters(session.accountId!), getRestoreItemPrice()])
return (
<PageShell title="Recuperar ítems">
@@ -51,12 +50,9 @@ export default async function RestoreItemsPage({ params }: { params: Promise<{ l
<div className="centered">
<br />
<br />
<p>Cada ítem requiere <span>{RESTORE_ITEM_PD}</span> <span className="yellow-info">PD</span></p>
<p>Cada ítem requiere <span>{price}</span> <span className="yellow-info"></span> (SumUp)</p>
<br />
<RestoreItemsForm
characters={chars.map((c) => ({ name: c.name, classCss: c.classCss }))}
canAfford={balance >= RESTORE_ITEM_PD}
/>
<RestoreItemsForm characters={chars.map((c) => ({ name: c.name, classCss: c.classCss }))} price={price} />
</div>
</ServiceBox>
</PageShell>
@@ -1,17 +0,0 @@
import { getSession } from '@/lib/session'
import { restoreItem } from '@/lib/restore-items'
/** Restaura un ítem borrado (cuesta 100 PD). */
export async function POST(request: Request) {
const session = await getSession()
if (!session.accountId || !session.username) {
return Response.json({ success: false, error: 'notAuthenticated' }, { status: 401 })
}
let body: Record<string, unknown> = {}
try {
body = await request.json()
} catch {
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
}
return Response.json(await restoreItem(session.accountId, String(body.character ?? '').trim(), Number(body.recoverId)))
}