Commit Graph

9 Commits

Author SHA1 Message Date
lite bed50a49a3 fix: StoreFromBase64 writes to tmp/ instead of permanent location
- Fix bug where certificate was written directly to data/certs/
- MoveToPerm now correctly renames from tmp/ to permanent location
2026-05-19 17:19:44 -04:00
lite 9c4f11d7c7 refactor: accept certificates as base64, remove external dependencies
- Replace file path with base64 content in register endpoint
- Use native Go pkcs12 for certificate validation and loading
- Remove PowerShell script dependency (validator.go)
- Remove Python script dependency (client.go)
- Remove hardcoded Windows paths
- Cross-platform: works on Linux, macOS, Windows without external tools
- Update documentation (api.md, seguridad.md, prerequisites.md)
2026-05-19 16:03:28 -04:00
lite b99d09789b refactor(dolibarr): use typed fields matching web→BFF format
- Remove totalHt/totalTax/total from input (calculated from lines)
- Remove line.total (calculated as quantity × unitPrice)
- All numeric fields are proper numbers (not strings)
- Dates are ISO 8601 (converted to dd-mm-yyyy internally)
- Totals calculated and validated automatically
2026-05-17 17:40:33 -04:00
lite 16049fa3ef feat: add format system with auto-detection
- Add internal/formats/registry.go with Transformer interface
- Add internal/formats/native/ for current API format
- Add internal/formats/dolibarr/ for Dolibarr BFF format
- Refactor factura.go to use TransformAuto() for auto-detection
- Remove format query param — detection is now automatic
2026-05-17 16:27:27 -04:00
admin 1ad84a3b14 Fix integración VeriFactu AEAT: XML, hash y encadenamiento
Bugs corregidos tras validación directa contra la plataforma de pruebas:

- Hash: formato key=valor& en lugar de separador |
- TipoHuella: código 01 en lugar de literal SHA-256
- FechaHoraHusoGenRegistro: formato ISO 8601 con huso horario
- IdSistemaInformatico: 2 caracteres (01)
- Namespaces SOAP: URLs correctas de www2.agenciatributaria.gob.es
- Estructura XML: eliminados wrappers Content/AltaReq sobrantes
- Encadenamiento: xs:choice correcto (PrimerRegistro XOR RegistroAnterior)
- RegistroAnterior: referencia datos de la factura anterior, no la actual
- Destinatarios: bloque obligatorio para facturas F1/F3/rectificativas
- wsu:Id: eliminado atributo con namespace no declarado
- Parser respuesta: mapeado a RespuestaRegFactuSistemaFacturacion real
- Campo emisor_nombre añadido al input de factura

La API envía y recibe correctamente contra prewww1.aeat.es
con respuesta EstadoEnvio=Correcto y CSV asignado por la AEAT.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 01:13:09 +02:00
admin 4ab7670232 Implement VeriFactu API with certificate management, invoice submission and local fallback
- Add API handlers for facturas (alta/anulacion)
- Implement certificate storage with temp/permanent flow
- Add token generation for authenticated sessions
- Add fallback to local storage when AEAT unavailable
- Update config with certificate path/password
- Add client certificate conversion for TLS
- Add comprehensive documentation
2026-04-17 13:03:06 +02:00
admin 0a7cf96211 config: add name and email for RSA key generation 2026-04-08 14:35:16 +02:00
admin 24c895abd7 internal: add config loader, crypto RSA and certificate storage 2026-04-08 14:31:09 +02:00
admin fa59c984bc internal: add models, validation, transformer and hash logic 2026-04-08 14:31:02 +02:00