feat(entries+billing): integrate automatic fee booking for entries with billing service

- **Entries-Service Updates:**
  - Implemented automatic booking of fees (entry fees and late fees) during entry submission using `TeilnehmerKontoService`.
  - Enhanced `Bewerb` entity with financial fields (`nenngeldCent`, `nachnenngebuehrCent`).
  - Added Flyway migration to update `bewerbe` table with new financial fields.
  - Updated `EntriesServiceApplication` to include billing package scanning for integration.

- **Billing-Service Enhancements:**
  - Adjusted `TeilnehmerKontoService` to support fetching accounts by event and person.
  - Improved database configuration to handle missing JDBC URLs during tests.

- **Tests:**
  - Added integration tests to validate fee booking logic for entries, including late fee scenarios.
  - Introduced H2 database setup for test isolation.

- **Misc:**
  - Updated tenant-aware transactions to support H2 and PostgreSQL dialects.
  - Adjusted log and error handling for robust integration between services.
This commit is contained in:
2026-04-10 12:48:57 +02:00
parent eef17b3067
commit c1fadac944
16 changed files with 259 additions and 19 deletions
@@ -16,13 +16,19 @@ In dieser Session wurde das Fundament für den Kassa-Service (`billing-context`)
* `billing-service` Modul erstellt, konfiguriert und mit `core-domain` (Serialisierung) verknüpft.
* Exposed-Tabellendefinitionen (v1) für `TeilnehmerKonto` und `Buchung` implementiert.
* `BillingController` mit REST-Endpunkten für Konten, Buchungen und Historie erstellt.
* `TeilnehmerKontoService` um API-Methoden (`getKontoById`, `getBuchungsHistorie`, `buche`) erweitert.
* `TeilnehmerKontoService` um API-Methoden (`getKontoById`, `getKonto`, `getBuchungsHistorie`, `buche`) erweitert.
* Integrationstests (`TeilnehmerKontoServiceTest`) erfolgreich mit H2-In-Memory-DB durchgeführt.
* **OpenAPI-Dokumentation:** `documentation.yaml` für `billing-service` erstellt und CRUD-Endpunkte für Konten und Buchungen dokumentiert.
2. **ZNS-Importer Hardening:**
2. **Entries-Integration (Neu):**
* Automatische Buchung von Nenngeld und Nachnenngebühren bei Einreichung einer Nennung implementiert.
* Erweiterung der `Bewerb`-Entität um Finanzfelder (`nenngeld_cent`, `nachnenngebuehr_cent`).
* Neue Flyway-Migration `V8__add_bewerb_financial_fields.sql` im `entries-service` hinzugefügt.
* `NennungUseCases` nutzt nun den `TeilnehmerKontoService` zur automatischen Belastung der Teilnehmerkonten (negativer Saldo).
* `EntriesServiceApplication` scannt nun auch `at.mocode.billing` Pakete für die Cross-Context Integration.
3. **ZNS-Importer Hardening:**
* Erweiterung von `ZnsImportServiceTest` um Tests für mehrfache Qualifikationen und die Update-Strategie (Delete+Insert) bei Funktionären (`RICHT01.dat`).
* Alle 11 Integrationstests sind erfolgreich durchgelaufen.
3. **Kompilations-Fixes (Billing):**
4. **Kompilations-Fixes (Billing):**
* `billing-service` auf korrekte Exposed DSL Syntax (`selectAll().where { ... }`) umgestellt.
* Explizite `transaction { ... }` Blöcke in `TeilnehmerKontoService` eingeführt.
* Typ-Konsistenz für `Instant` (kotlin.time) in `billing-domain` zur Übereinstimmung mit `core-domain` hergestellt.
@@ -32,9 +38,15 @@ In dieser Session wurde das Fundament für den Kassa-Service (`billing-context`)
- `backend/infrastructure/zns-importer/src/test/kotlin/at/mocode/zns/importer/ZnsImportServiceTest.kt`
### Nächste Schritte
- Integration des Billing-Services in den `entries-context` (z.B. automatische Buchung von Nenngebühren).
- [x] Integration des Billing-Services in den `entries-context` (automatische Buchung bei Nennung).
- [x] Fix von Kompilationsfehlern und Test-Regressionen (H2/Exposed Kompatibilität).
- UI-Anbindung im Frontend für Kontenübersicht und manuelle Buchungen.
- Erweiterung der Abrechnungs-Logik (z.B. Rechnungserstellung als PDF).
### Technische Details & Fixes
- **Exposed / H2:** `TIMESTAMPTZ` in Flyway-Migrationen auf `TIMESTAMP WITH TIME ZONE` umgestellt, um H2-Kompatibilität in Integrationstests zu gewährleisten.
- **Multi-Tenancy:** `ExposedTenantTransactions` unterstützt nun sowohl PostgreSQL (`SET search_path`) als auch H2 (`SET SCHEMA`).
- **Billing Config:** `BillingDatabaseConfiguration` ist nun robust gegen fehlende JDBC-URLs (wichtig für modularisierte Tests).
---
*Co-authored-by: Junie <junie@jetbrains.com>*