refactor: Update Application layer for Codecrete Bill integration

- Change SwissQrCodeExtractionResult to use Bill + RawLines
- Update ISwissQrCodeProcessor to return tuple (Bill, string[])
- Add Codecrete.SwissQRBill.Generator v3.4.0 package reference
- Update ExtractSwissQrCodeQuery handler to use AutoMapper for Bill->DTO mapping
- Remove References property from query (not needed for QR extraction)
This commit is contained in:
2026-07-16 15:47:09 +02:00
parent e321963487
commit 35016f02e1
4 changed files with 54 additions and 127 deletions

View File

@@ -1,4 +1,4 @@
using DocumentOperator.Domain.ValueObjects;
using Codecrete.SwissQRBill.Generator;
namespace DocumentOperator.Application.Common.Interfaces;
@@ -9,16 +9,21 @@ namespace DocumentOperator.Application.Common.Interfaces;
public interface ISwissQrCodeProcessor
{
/// <summary>
/// Extracts and parses Swiss QR Code from the last page of a PDF document.
/// Extracts and parses Swiss QR Code from a PDF document.
/// Returns both parsed Bill object and raw QR text lines.
/// </summary>
/// <param name="pdfBytes">PDF document as byte array</param>
/// <param name="pageNumbers">Optional: Specific page numbers to scan (1-indexed). If null, scans all pages starting with last page.</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>Parsed Swiss QR Code data</returns>
/// <returns>Tuple: (Parsed Codecrete Bill, Raw QR lines as string array)</returns>
/// <exception cref="Domain.Exceptions.SwissQrCodeNotFoundException">
/// Thrown when no Swiss QR Code is found on the last page
/// Thrown when no Swiss QR Code is found in the specified pages
/// </exception>
/// <exception cref="Domain.Exceptions.PdfProcessingException">
/// Thrown when PDF processing fails
/// </exception>
Task<SwissQrCodeData> ExtractSwissQrCodeAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
Task<(Bill Bill, string[] RawLines)> ExtractSwissQrCodeAsync(
byte[] pdfBytes,
int[]? pageNumbers = null,
CancellationToken cancellationToken = default);
}