feat: Add SwissQrBillDto and BadRequestException
- Add SwissQrBillDto, AddressDto, AlternativeSchemeDto for Codecrete Bill mapping - Add BadRequestException to Domain exceptions - DTOs include [Obsolete] warnings for deprecated fields (AddressLine1/2)
This commit is contained in:
93
DocumentOperator.Application/Common/DTOs/SwissQrBillDto.cs
Normal file
93
DocumentOperator.Application/Common/DTOs/SwissQrBillDto.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
namespace DocumentOperator.Application.Common.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// Swiss QR Bill data transfer object (mapped from Codecrete Bill)
|
||||
/// </summary>
|
||||
public record SwissQrBillDto
|
||||
{
|
||||
/// <summary>QR Bill standard version (e.g., "V2_0")</summary>
|
||||
public required string Version { get; init; }
|
||||
|
||||
/// <summary>Payment amount (null if not specified)</summary>
|
||||
public decimal? Amount { get; init; }
|
||||
|
||||
/// <summary>Payment currency (CHF or EUR)</summary>
|
||||
public required string Currency { get; init; }
|
||||
|
||||
/// <summary>Creditor's IBAN account number</summary>
|
||||
public required string Account { get; init; }
|
||||
|
||||
/// <summary>Creditor address</summary>
|
||||
public required AddressDto Creditor { get; init; }
|
||||
|
||||
/// <summary>Payment reference type: "QRR", "SCOR", or "NON"</summary>
|
||||
public required string ReferenceType { get; init; }
|
||||
|
||||
/// <summary>Payment reference (format depends on ReferenceType)</summary>
|
||||
public string? Reference { get; init; }
|
||||
|
||||
/// <summary>Debtor address (optional)</summary>
|
||||
public AddressDto? Debtor { get; init; }
|
||||
|
||||
/// <summary>Additional unstructured message (max 140 chars)</summary>
|
||||
public string? UnstructuredMessage { get; init; }
|
||||
|
||||
/// <summary>Additional structured bill information</summary>
|
||||
public string? BillInformation { get; init; }
|
||||
|
||||
/// <summary>Alternative payment schemes (max 2)</summary>
|
||||
public IReadOnlyList<AlternativeSchemeDto>? AlternativeSchemes { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Address data transfer object (mapped from Codecrete Address)
|
||||
/// </summary>
|
||||
public record AddressDto
|
||||
{
|
||||
/// <summary>Address type: "Structured" or "CombinedElements"</summary>
|
||||
public required string Type { get; init; }
|
||||
|
||||
/// <summary>Name of person or company</summary>
|
||||
public required string Name { get; init; }
|
||||
|
||||
/// <summary>Street name (structured address only)</summary>
|
||||
public string? Street { get; init; }
|
||||
|
||||
/// <summary>House number (structured address only)</summary>
|
||||
public string? HouseNo { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Address line 1 (combined address only).
|
||||
/// OBSOLETE: Use structured address instead. Will be removed when Codecrete v4 is adopted.
|
||||
/// </summary>
|
||||
[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; }
|
||||
|
||||
/// <summary>
|
||||
/// Address line 2 (combined address only).
|
||||
/// OBSOLETE: Use structured address instead. Will be removed when Codecrete v4 is adopted.
|
||||
/// </summary>
|
||||
[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; }
|
||||
|
||||
/// <summary>Postal code</summary>
|
||||
public required string PostalCode { get; init; }
|
||||
|
||||
/// <summary>Town/city name</summary>
|
||||
public required string Town { get; init; }
|
||||
|
||||
/// <summary>Two-letter country code (ISO 3166-1 alpha-2)</summary>
|
||||
public required string CountryCode { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Alternative payment scheme (mapped from Codecrete AlternativeScheme)
|
||||
/// </summary>
|
||||
public record AlternativeSchemeDto
|
||||
{
|
||||
/// <summary>Scheme name (e.g., "AV1", "AV2")</summary>
|
||||
public required string Name { get; init; }
|
||||
|
||||
/// <summary>Scheme instruction/parameter</summary>
|
||||
public required string Instruction { get; init; }
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user