Plans:
- Plan limits and Pro prices per country live in the database
(plan_configs, plan_prices, seeded with the previous constants) and are
read through PlanCatalog (30 s cache, defaults as fallback).
- /admin/plans edits limits (with the count of accounts that would become
read-only) and prices, optionally pushing the new price to live
subscriptions from their next charge (MP preapproval amount, Stripe item
without proration) via the ApplyPriceChanges job, with an email and a
notice on /billing.
- GET /billing/plans feeds the onboarding and the billing screen.
Mercado Pago:
- The Pro checkout returns through GET /billing/return on API_PUBLIC_URL,
since MP refuses a back_url on localhost.
- The OAuth callback bounces from the tunnel to BETTER_AUTH_URL to find the
session, requires the session to own the state, and redirects instead of
answering JSON on unexpected errors.
- Checkout Pro links skip auto_return off public HTTPS and carry a
notification_url to POST /payments/webhooks/mp/:paymentId, which confirms
the payment with the owner's token (same rule as the polling job, which
stays as fallback). The search now prefers the approved attempt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Acceso del alumno o tutor con link de un solo uso (hash SHA-256, consumo
atómico, el GET no consume), sesión propia de 90 días deslizante, passkeys
opcionales (SimpleWebAuthn) y mail de recuperación con rate limit.
- Lado alumno (/i/:token, /acceso, /alumno/*): inicio, clases, avisar falta,
pagos, informar pago con comprobante (S3 privado, magic bytes) y perfil.
- Lado profe: acceso a la app en la ficha del alumno (invitar/reinvitar),
"Pagos para verificar" en Cobros con badge, faltas avisadas en la ficha de
grupo y datos para transferir en Ajustes.
- "Requiere atención" y el recordatorio de WhatsApp excluyen cuotas informadas.
- Zona horaria por defecto: Buenos Aires.
- Migración add_student_access, tests contra Postgres real (test:db) y docs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Puerto BillingProvider con adaptadores de Mercado Pago (/preapproval) y
Stripe (Checkout en modo suscripción, fetch plano). El país elige proveedor
solo para suscripciones nuevas; sync, cancel y webhook usan row.provider.
- Migración add_billing_providers (provider, checkout_ref, ids genéricos).
- fix: /authorized_payments/search respondía 400 "Invalid value for limit";
se pagina por offset sin limit.
- fix: si falla la consulta de cobros, la sync guarda igual el estado de la
suscripción (ya no queda PENDING tras autorizar) y reintenta los cobros.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Módulo billing: suscripción Pro mensual vía /preapproval con credenciales
de plataforma por país, webhook firmado y reconciliación por polling.
- PlanGuard en los use-cases que crean grupos/alumnos, cobran con MP o
activan automatizaciones (402 plan_limit_reached / plan_feature_required /
plan_read_only), detrás de BILLING_ENFORCEMENT.
- Onboarding: paso Plan obligatorio (POST /onboarding/plan); con Free se
saltean Cobros y WhatsApp.
- Web: pantalla /billing, aviso de Pro desde el MutationCache.
- Migración billing_subscriptions y docs/billing.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenWA se instala por separado: la API le habla por OPENWA_API_URL (sin
default). La guía documenta el compose recomendado y el alta de la key.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Puerto MessagingProvider con adaptadores OpenWA (MVP, QR) y Kapso
(setup link de Meta + templates), elegido con WHATSAPP_PROVIDER.
- Vinculación del WhatsApp del profesor en el onboarding y en Ajustes.
- Job semanal (lunes 10:00 AR): recordatorio de pago y reenganche a
alumnos en riesgo (cooldown 14 días), con switches por grupo.
- Idempotencia por (kind, attendee, semana ISO), webhooks firmados con
HMAC y deduplicados, normalización de teléfonos a E.164.
- Servicio openwa en docker-compose y guía en docs/whatsapp.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Implemented MpReauthNotice component to notify users when reauthorization is needed.
- Created MpStatusCard component to display the current status of the Mercado Pago account.
- Added utility functions and constants for handling Mercado Pago status and messages.
- Introduced hooks for managing the connection and disconnection of Mercado Pago accounts.
- Developed a disconnect confirmation modal for user actions.
- Added tests for the new functionality and utility functions.
- Defined schemas for Mercado Pago account status and callback reasons in shared package.