template-saas/orchestration/analisis/ANALISIS-BF-03-BILLING.md
rckrdmrd 50a821a415
Some checks failed
CI / Backend CI (push) Has been cancelled
CI / Frontend CI (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / CI Summary (push) Has been cancelled
[SIMCO-V38] feat: Actualizar a SIMCO v3.8.0
- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8
- Actualizaciones de configuracion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 08:53:08 -06:00

88 lines
2.0 KiB
Markdown

# Analisis de Modulos Billing - BF-03
**Fecha:** 2026-01-10
**Fase:** 1.2 - Analisis de Modulos Billing
**Estado:** COMPLETADO
---
## Resumen Ejecutivo
| Modulo | Estado | Completitud |
|--------|--------|-------------|
| SAAS-004 Billing | Completado con discrepancias | 95% |
| SAAS-005 Plans | Completado | 100% |
---
## Discrepancias Principales
### Rutas Inconsistentes
| Documentado | Implementado | Accion |
|-------------|--------------|--------|
| `POST /billing/checkout` | `POST /stripe/checkout-session` | Actualizar doc |
| `POST /billing/portal` | `POST /stripe/billing-portal` | Actualizar doc |
| `GET /billing/plans` | `GET /plans` | Actualizar doc |
| `PUT /billing/change-plan` | `POST /billing/subscription/change-plan/:planId` | Actualizar doc |
### Campos Faltantes en Entidades TypeORM
**Subscription:**
- stripe_subscription_id (usar external_subscription_id)
- trial_start
- cancel_at
- price_amount
- currency
**Invoice:**
- amount_paid
- amount_due
- customer_name
- customer_email
### Endpoint Faltante
- `GET /billing/invoices/:id/pdf` - Documentado pero no implementado
---
## Webhooks Stripe
| Evento | Estado |
|--------|--------|
| customer.subscription.created | Implementado |
| customer.subscription.updated | Implementado |
| customer.subscription.deleted | Implementado |
| invoice.paid | Implementado |
| invoice.payment_failed | Implementado |
| payment_method.attached | Implementado (extra) |
| payment_method.detached | Implementado (extra) |
| checkout.session.completed | Implementado (extra) |
**Total:** 8 webhooks implementados (mas de los 6 documentados)
---
## Estado de Integracion Stripe
- Checkout funciona
- Webhooks se procesan
- Upgrade/downgrade funciona
- Facturas se generan
- Trial funciona
- Cancelacion funciona
---
## Recomendaciones
1. **CRITICA:** Crear entidades TypeORM para invoice_items y payments
2. **CRITICA:** Completar campos en Subscription e Invoice
3. **ALTA:** Actualizar documentacion con rutas reales
4. **ALTA:** Agregar endpoint GET /billing/invoices/:id/pdf
---
**Entregable de:** FASE 1.2