feat: add AFC Store with MercadoPago purchases and prize redemption
Some checks failed
Deploy / deploy (push) Has been cancelled

Players can now buy AfterCoin with real money (MercadoPago Checkout Pro,
$15 MXN/AFC) and redeem AFC for gift cards or cash withdrawals. Admin
fulfills redemptions manually.

- Bridge: payments + redemptions tables, CRUD routes, PATCH auth
- Next.js API: verify-disk, balance, create-preference, webhook (idempotent
  minting with HMAC signature verification), redeem, payment/redemption history
- Frontend: hub, buy flow (4 packages + custom), redeem flow (gift cards +
  cash out), success/failure/pending pages, history with tabs, 8 components
- i18n: full English + Spanish translations
- Infra: nginx /api/afc/ → Next.js, docker-compose env vars, .env.example

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
consultoria-as
2026-02-26 02:26:13 +00:00
parent 7dc1d2e0e5
commit a76d513659
38 changed files with 2142 additions and 5 deletions

View File

@@ -30,3 +30,10 @@ CF_API_TOKEN=your_cloudflare_api_token
AFC_ADMIN_ADDRESS=0xYOUR_ADMIN_ADDRESS
AFC_ADMIN_PRIVATE_KEY=your_private_key_without_0x_prefix
AFC_BRIDGE_SECRET=change_me_in_production
# AFC Store (MercadoPago integration)
MERCADOPAGO_ACCESS_TOKEN=your_mp_access_token
MERCADOPAGO_WEBHOOK_SECRET=your_mp_webhook_secret
MERCADOPAGO_WEBHOOK_URL=https://yourdomain.com/api/afc/webhook
AFC_PRICE_MXN=15
NEXT_PUBLIC_SITE_URL=http://localhost:3000

View File

@@ -60,10 +60,18 @@ services:
restart: unless-stopped
depends_on:
- cms
- afc-bridge
environment:
STRAPI_URL: http://cms:1337
STRAPI_API_TOKEN: ${STRAPI_API_TOKEN:-}
NEXT_PUBLIC_STRAPI_URL: ${PUBLIC_STRAPI_URL:-http://localhost:1337}
AFC_BRIDGE_URL: http://afc-bridge:3001
AFC_BRIDGE_SECRET: ${AFC_BRIDGE_SECRET}
MERCADOPAGO_ACCESS_TOKEN: ${MERCADOPAGO_ACCESS_TOKEN:-}
MERCADOPAGO_WEBHOOK_SECRET: ${MERCADOPAGO_WEBHOOK_SECRET:-}
MERCADOPAGO_WEBHOOK_URL: ${MERCADOPAGO_WEBHOOK_URL:-}
AFC_PRICE_MXN: ${AFC_PRICE_MXN:-15}
NEXT_PUBLIC_SITE_URL: ${NEXT_PUBLIC_SITE_URL:-http://localhost:3000}
ports:
- "3000:3000"

View File

@@ -28,6 +28,16 @@ http {
proxy_set_header X-Forwarded-Proto $scheme;
}
# AFC Store API — route to Next.js (before Strapi catch-all)
location /api/afc/ {
proxy_pass http://web;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /api/ {
proxy_pass http://cms;
proxy_http_version 1.1;