- Added client_id field to StoreTenantRequest and UpdateTenantRequest for tenant management. - Updated TenantResource to include client_id in the response. - Created migration to establish clients table and link tenants to clients. - Migrated existing tenant integrations to client_integrations table. - Grouped specific tenants under a shared client (OnTicket) in a new migration. - Updated seeders to reflect new client structure and relationships. - Adjusted integration configurations to require client instead of tenant. - Added tests for client integration functionality and ensured existing tests reflect the new client structure.
30 lines
1.5 KiB
Markdown
30 lines
1.5 KiB
Markdown
# Dominio Integration
|
|
|
|
## Propósito
|
|
|
|
Gestiona integraciones externas disponibles y su configuración por cliente. Un cliente puede agrupar múltiples tenants que comparten las mismas credenciales. Incluye correo y pagos mediante Telepagos.
|
|
|
|
## Modelo y seguridad
|
|
|
|
- `Integration`: definición global de una integración.
|
|
- `ClientIntegration`: configuración y credenciales de una integración para un cliente.
|
|
- `EncryptedIntegrationData`: cast que protege los datos sensibles persistidos.
|
|
- `ClientIntegrationService`: consulta y configura integraciones del cliente.
|
|
|
|
## Servicios externos
|
|
|
|
- `BaseIntegrationService`: resuelve el cliente desde el tenant operativo y carga exclusivamente la configuración del cliente.
|
|
- `MailService`: envío de correo usando la integración configurada.
|
|
- `TelepagosIntegrationService`: autenticación, caché de token, generación de QR y consulta de cobros.
|
|
- `TelepagosWebhookService`: procesa notificaciones recibidas desde Telepagos.
|
|
|
|
## Endpoints
|
|
|
|
- CRUD global bajo `/integrations`.
|
|
- Consulta y configuración por cliente bajo `/clients/{client}/integrations`.
|
|
- `POST /webhooks/telepagos/{client}` para notificaciones del proveedor.
|
|
|
|
## Dependencias y reglas
|
|
|
|
Se integra con `Client`, `Tenant` y con el checkout de `Purchase`. `Notification` utiliza `MailService`. El tenant conserva el contexto operativo y de branding, pero nunca es dueño de credenciales. Las credenciales no se exponen en respuestas ni logs; los webhooks deben validar su contrato antes de alterar una compra.
|