Terceros:
- ClientResponse: campo fournisseur añadido
- CreateClientDto: campo Role (client/supplier/both)
- ClientDto / ClientDetailDto: campo Role devuelto en respuesta
- ClientMapper: ResolveRole() calcula rol desde client+fournisseur de Dolibarr
- ClientService: CreateClientAsync mapea Role a client/fournisseur en Dolibarr
Webhook:
- WebhookSettings: persistencia en archivo data/webhook_url.txt (volumen Docker)
- WebhookNotificationService: fire-and-forget, Adaptive Card 1.2, timeout 8s
- SettingsController: usa UpdateUrl(), endpoint test añadido
- Program.cs: HttpClient Webhook con timeout de 8s
- InvoiceService: notificación también al registrar pago (AddInvoicePaymentAsync)
+ datepaye enviado como Unix timestamp (fix 400 de Dolibarr)
- SupplierInvoiceService: notificación webhook en cambios de estado,
pago vía payments endpoint con Unix timestamp
compose.yaml: volumen bff_data para persistir webhook_url.txt entre rebuilds
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- API_ENDPOINTS.md: complete reference of all 23 endpoints for frontend team
- Program.cs: ensure BaseAddress ends with '/' so relative URLs like
'login' resolve correctly to 'api/index.php/login' instead of 'api/login'
- DolibarrTokenCacheService: no logic change (same file touched in earlier
commit for token cache duration)
- Program.cs: added Swagger with JWT Bearer security definition using
OpenApi v2 API (OpenApiSecuritySchemeReference), enabled Swagger in all
environments (not just Development), registered all new services
(ContactService, SetupService) in DI
- CORS: configurable via Cors__AllowedOrigins env var, allows all
when empty (dev-friendly)
- DoliMiddlewareApi.csproj: removed Microsoft.AspNetCore.OpenApi (conflicts
with Swashbuckle v10), kept Swashbuckle.AspNetCore 10.1.0
- appsettings.json: fixed Dolibarr ApiUrl to /api/index.php (was /explorer)
- compose.yaml: fixed Dolibarr ApiUrl, added JWT_SECRET default for dev,
added healthcheck for Dolibarr container, BFF waits for Dolibarr healthy
- .dockerignore: added to keep Docker build clean
- .env.example: template with instructions for JWT_SECRET
- ContactsController: full CRUD (list, get, get by email, create, update, delete)
- SetupController: dictionary endpoints (payment-types, countries, civilities,
contact-types, payment-terms, company)
- ClientsController: added GET/{id}, POST, PUT/{id}, DELETE/{id}
- InvoicesController: added PUT/{id}/lines/{lineId}, GET /templates
- DocumentController: added GET /list and GET /download endpoints
- ClientService: added GetClientAsync, CreateClientAsync, UpdateClientAsync,
DeleteClientAsync
- InvoiceService: added UpdateInvoiceLineAsync, GetInvoiceTemplatesAsync
- DocumentService: added GetDocumentsAsync, DownloadDocumentAsync (using
new GetAsyncRaw on IDolibarrApiClient)
- ContactService: new service with CRUD operations
- SetupService: new service for Dolibarr dictionary data
- IDolibarrApiClient: added GetAsyncRaw method for raw string responses
- DolibarrApiClient: implemented GetAsyncRaw
- JwtTokenProvider: extended token expiry from 30 min to 8 hours
- AuthApplicationService: extended Dolibarr token cache from 30 min to 8 hours
Implements INotificationService with Teams/Slack-compatible WebhookNotificationService.
Fires on ValidateInvoice and ChangeInvoiceStatus. Silently skipped if WebhookUrl not configured.
- Añadir método ConvertStatusToDolibarr en InvoiceMapper para mapear todos los estados correctamente (draft, unpaid, paid, cancelled)
- Mover lógica de mapeo de estado desde InvoiceService a InvoiceMapper para seguir principios de SRP
- Arreglar bug donde el estado 'paid' y 'cancelled' se mapeaban incorrectamente a '0' (draft)
- Añadir validación de estado con mensaje de error claro para valores inválidos
- Limpiar código de DolibarrTokenCacheService eliminando bloque anidado innecesario
- Añadir autenticación estándar JWT Bearer con ASP.NET Core
- Crear DolibarrTokenCacheService para la lógica de caché de tokens
- Refactorizar DolibarrApiClient para usar TokenCacheService con SRP limpio
- Actualizar Program.cs con registros de servicios y comentarios apropiados
- Añadir AuthController para el endpoint de login
- Actualizar InvoiceService para usar DolibarrApiClient
- Crear IDolibarrApiClient con métodos de la API de Dolibarr
- Implementar interfaz en DolibarrApiClient
- Modificar InvoiceService para depender de IDolibarrApiClient en lugar de la clase concreta
- Actualizar Program.cs para registrar IDolibarrApiClient en el contenedor DI
Esto sigue el Principio de Inversión de Dependencias (DIP) de SOLID,
permitiendo mockear el cliente API en tests unitarios sin conectividad externa.