Añade gold y transfer: patrón de pago unificado con fulfill + metadata
- lib/stripe.ts: createCheckoutSession acepta metadata; claimPaidCheckout la recupera de la sesión Stripe y la devuelve. - lib/paid-services.ts: config unificado con fulfill(character, meta) + extraFields. gold -> UPDATE characters money (BD directa, no SOAP), transfer -> SOAP .char changeaccount. Los 5 simples usan soapFulfill. - checkout [service]: lee extraFields -> metadata, precio depende de metadata (gold), valida precio>0. service-success llama cfg.fulfill(name, metadata). - prices.ts: getTransferPrice, getGoldOptions/goldPriceFor (home_goldprice). - GoldForm (personaje + cantidad) y TransferForm (personaje + destino); páginas /gold y /transfer. Catálogos Paid.gold/transfer. Verificado: /gold /transfer redirigen a login, checkout 401 sin sesión, home OK. NOTA: transfer no valida aún el token de seguridad ni reglas AC (nivel>=55, DK). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { getTranslations, setRequestLocale } from 'next-intl/server'
|
||||
import { claimPaidCheckout } from '@/lib/stripe'
|
||||
import { executeSoapCommand } from '@/lib/soap'
|
||||
import { getPaidService } from '@/lib/paid-services'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
@@ -23,8 +22,8 @@ export default async function ServiceSuccessPage({
|
||||
if (cfg && session_id) {
|
||||
const claim = await claimPaidCheckout(session_id)
|
||||
if (claim) {
|
||||
const resp = await executeSoapCommand(cfg.command(claim.characterName))
|
||||
if (resp !== null) okName = claim.characterName
|
||||
const ok = await cfg.fulfill(claim.characterName, claim.metadata)
|
||||
if (ok) okName = claim.characterName
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user