template-saas/orchestration/_archive/analisis/ANALISIS-BF-03-BILLING.md
Adrian Flores Cortes 1c847fbe04
Some checks are pending
CI / Backend CI (push) Waiting to run
CI / Frontend CI (push) Waiting to run
CI / Security Scan (push) Waiting to run
CI / CI Summary (push) Blocked by required conditions
[ESTANDAR-ORCHESTRATION] refactor: Consolidate to standard structure
- Rename _archivo to _archive (standard convention)
- Move analisis/, planes/ to _archive/
- Archive extra root files
- Update _MAP.md with standardized structure

Standard: SIMCO-ESTANDAR-ORCHESTRATION v1.0.0
Level: PROVIDER (L1A)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 14:38:23 -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