diff --git a/DocumentOperator.Application/Common/DTOs/SwissQrBillDto.cs b/DocumentOperator.Application/Common/DTOs/SwissQrBillDto.cs new file mode 100644 index 0000000..3f39430 --- /dev/null +++ b/DocumentOperator.Application/Common/DTOs/SwissQrBillDto.cs @@ -0,0 +1,93 @@ +namespace DocumentOperator.Application.Common.DTOs; + +/// +/// Swiss QR Bill data transfer object (mapped from Codecrete Bill) +/// +public record SwissQrBillDto +{ + /// QR Bill standard version (e.g., "V2_0") + public required string Version { get; init; } + + /// Payment amount (null if not specified) + public decimal? Amount { get; init; } + + /// Payment currency (CHF or EUR) + public required string Currency { get; init; } + + /// Creditor's IBAN account number + public required string Account { get; init; } + + /// Creditor address + public required AddressDto Creditor { get; init; } + + /// Payment reference type: "QRR", "SCOR", or "NON" + public required string ReferenceType { get; init; } + + /// Payment reference (format depends on ReferenceType) + public string? Reference { get; init; } + + /// Debtor address (optional) + public AddressDto? Debtor { get; init; } + + /// Additional unstructured message (max 140 chars) + public string? UnstructuredMessage { get; init; } + + /// Additional structured bill information + public string? BillInformation { get; init; } + + /// Alternative payment schemes (max 2) + public IReadOnlyList? AlternativeSchemes { get; init; } +} + +/// +/// Address data transfer object (mapped from Codecrete Address) +/// +public record AddressDto +{ + /// Address type: "Structured" or "CombinedElements" + public required string Type { get; init; } + + /// Name of person or company + public required string Name { get; init; } + + /// Street name (structured address only) + public string? Street { get; init; } + + /// House number (structured address only) + public string? HouseNo { get; init; } + + /// + /// Address line 1 (combined address only). + /// OBSOLETE: Use structured address instead. Will be removed when Codecrete v4 is adopted. + /// + [Obsolete("Use structured address (Street + HouseNo) instead. This field will be removed when upgrading to Codecrete.SwissQRBill.Generator v4.x")] + public string? AddressLine1 { get; init; } + + /// + /// Address line 2 (combined address only). + /// OBSOLETE: Use structured address instead. Will be removed when Codecrete v4 is adopted. + /// + [Obsolete("Use structured address (Street + HouseNo) instead. This field will be removed when upgrading to Codecrete.SwissQRBill.Generator v4.x")] + public string? AddressLine2 { get; init; } + + /// Postal code + public required string PostalCode { get; init; } + + /// Town/city name + public required string Town { get; init; } + + /// Two-letter country code (ISO 3166-1 alpha-2) + public required string CountryCode { get; init; } +} + +/// +/// Alternative payment scheme (mapped from Codecrete AlternativeScheme) +/// +public record AlternativeSchemeDto +{ + /// Scheme name (e.g., "AV1", "AV2") + public required string Name { get; init; } + + /// Scheme instruction/parameter + public required string Instruction { get; init; } +} diff --git a/DocumentOperator.Domain/Common/Exceptions/BadRequestException.cs b/DocumentOperator.Domain/Common/Exceptions/BadRequestException.cs new file mode 100644 index 0000000..7fb8f12 --- /dev/null +++ b/DocumentOperator.Domain/Common/Exceptions/BadRequestException.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace DocumentOperator.Domain.Common.Exceptions; + +public class BadRequestException : Exception +{ + public BadRequestException() + { + } + + public BadRequestException(string? message) : base(message) + { + } + + public BadRequestException(string? message, Exception? innerException) : base(message, innerException) + { + } +}