#980: SEPATransferGenerator.kt

projectforge-business/src/main/kotlin/org/projectforge/business/fibu/SEPATransferGenerator.kt SEPA Transfer Generator, projectforge-business/src/main/kotlin/org/projectforge/business/fibu/SEPATransferGenerator.kt 229 lines · 153 code · 40 comments · 36 blank
Orchestrates SEPA Credit Transfer (pain.001.001.03) XML generation from ProjectForge invoices. Coordinates the full pipeline: invoice loading, IBAN/Konto validation, grouping by debitor, XML construction via SEPAXmlBuilder, and result packaging into SEPATransferResult.

Architecture

Core Pipeline

The generator follows a multi-stage pipeline:

  1. Input Selection: Receives a list of invoice IDs or RechnungDO objects to process.
  2. Validation: Verifies each invoice has a valid IBAN/BIC and associated Konto for bank details. Filters out already-exported invoices.
  3. Grouping: Groups invoices by debitor (Kunde) for batched transfers when possible.
  4. XML Generation: Delegates to SEPAXmlBuilder for constructing the pain.001 format XML.
  5. Result Assembly: Packages generated XML, processed invoice counts, and any errors into SEPATransferResult.

Dependency Graph

The generator depends heavily on the fibu cache layer (ProjektCache, KundeCache, KontoCache) to resolve invoice relationships without additional database queries. It uses RechnungDao for invoice persistence and marking invoices as exported.

Design Decisions

Key Methods

MethodDescription
generate(invoices, exportDate)Main entry point: validates, groups, builds XML, returns SEPATransferResult
buildXml(...)Constructs the complete SEPA pain.001 XML document via SEPAXmlBuilder
validateInvoice(invoice)Checks IBAN/BIC/Konto validity for a single invoice

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
53e88fb6e SEPA-Export: paymentType now configurable (ZAH instead of ZIN).
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
f0b91f12a SEPA-Transfer: If an invoice was exported before, it's marked with exportDate, not removed.
5288f771e SEPA generator now creates valid XML without namespace problems and without duplicate xmlns definitions.
3b4908eb7 SEPA Export for invoices: Using now data from RechnungDO in cooperation with SEPATransferGeneratorUtils.
e4a9008d4 SEPA Export for invoices added.