Add ZUGFeRD detection and extraction functionality

Introduced `ZugferdController` to handle ZUGFeRD-related operations, including detection and extraction of ZUGFeRD XML from PDFs via file upload or Base64-encoded payloads. Integrated `MediatR` for query/command handling.

Added `ZugferdSettings` for configurable file names and patterns, and updated `appsettings.json` and `Program.cs` to support this configuration.

Implemented `HasZugferdQuery` and `ExtractZugferdCommand` with their respective handlers and validators. Added DTOs (`ZugferdCheckResult`, `ZugferdExtractionResult`) for operation results.

Included `ZUGFeRD-Example.pdf` for testing and integrated `Serilog.Ui.Core.Extensions` for logging.
This commit is contained in:
2026-07-30 10:16:43 +02:00
parent 080c2ac2a0
commit 94123cd1be
9 changed files with 449 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
namespace DocumentOperator.Application.Common.DTOs;
/// <summary>
/// DTO for ZUGFeRD check result
/// </summary>
public record ZugferdCheckResult
{
/// <summary>
/// Indicates whether the PDF contains ZUGFeRD XML attachment
/// </summary>
public bool HasZugferd { get; init; }
/// <summary>
/// ZUGFeRD XML file name (e.g., "factur-x.xml")
/// </summary>
public string? ZugferdFileName { get; init; }
/// <summary>
/// ZUGFeRD XML file size in bytes
/// </summary>
public long? ZugferdFileSize { get; init; }
/// <summary>
/// MIME type of the ZUGFeRD XML file
/// </summary>
public string? ZugferdMimeType { get; init; }
}