From 0cdf134b6035b3e177d32afb18819d19c3132234 Mon Sep 17 00:00:00 2001 From: ipax77 Date: Sat, 3 May 2025 18:23:08 +0200 Subject: [PATCH 1/9] fix AnnotationLine LineTotal rounding --- src/pax.XRechnung.NET/AnnotatedDtos/InvoiceLineAnnotationDto.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceLineAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceLineAnnotationDto.cs index 092f19f..25334c7 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceLineAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceLineAnnotationDto.cs @@ -19,7 +19,7 @@ public class InvoiceLineAnnotationDto : IInvoiceLineBaseDto public string? Description { get; set; } = string.Empty; [Required] public string Name { get; set; } = string.Empty; - public double LineTotal => Math.Round(Math.Round(Quantity, 2) * Math.Round(UnitPrice, 2), 2); + public double LineTotal => Math.Round(Quantity * UnitPrice, 2); } #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member From 462a9c6c1e0e2b8389b9af832b7473f72cc82504 Mon Sep 17 00:00:00 2001 From: ipax77 Date: Sun, 4 May 2025 15:24:30 +0200 Subject: [PATCH 2/9] add party companyId to DTOs --- src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs | 1 + src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs | 1 + .../BaseDtos/InvoiceBuyerPartyMapperBase.cs | 7 ++++++- src/pax.XRechnung.NET/BaseDtos/PartyBaseDto.cs | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs index 89041c5..1f9a883 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs @@ -24,6 +24,7 @@ public class BuyerAnnotationDto : IPartyBaseDto [Required] public string RegistrationName { get; set; } = string.Empty; public string TaxId { get; set; } = string.Empty; + public string? CompanyId { get; set; } } #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs index 1447755..f822c0a 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs @@ -26,6 +26,7 @@ public class SellerAnnotationDto : IPartyBaseDto public string RegistrationName { get; set; } = string.Empty; [Required] public string TaxId { get; set; } = string.Empty; + public string? CompanyId { get; set; } } #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/src/pax.XRechnung.NET/BaseDtos/InvoiceBuyerPartyMapperBase.cs b/src/pax.XRechnung.NET/BaseDtos/InvoiceBuyerPartyMapperBase.cs index 8043d93..f809085 100644 --- a/src/pax.XRechnung.NET/BaseDtos/InvoiceBuyerPartyMapperBase.cs +++ b/src/pax.XRechnung.NET/BaseDtos/InvoiceBuyerPartyMapperBase.cs @@ -26,6 +26,7 @@ public virtual IPartyBaseDto FromXml(XmlParty xmlParty) TaxId = xmlParty.PartyTaxScheme?.CompanyId ?? string.Empty, Telefone = xmlParty.Contact?.Telephone ?? string.Empty, Email = xmlParty.Contact?.Email ?? string.Empty, + CompanyId = xmlParty.PartyLegalEntity.CompanyId, }; return dto; } @@ -49,7 +50,11 @@ public virtual XmlParty ToXml(IPartyBaseDto partyBaseDto) PostCode = partyBaseDto.PostCode, Country = new() { IdentificationCode = partyBaseDto.CountryCode }, }, - PartyLegalEntity = new() { RegistrationName = partyBaseDto.RegistrationName }, + PartyLegalEntity = new() + { + RegistrationName = partyBaseDto.RegistrationName, + CompanyId = partyBaseDto.CompanyId, + }, Contact = new() { Name = InvoiceMapperUtils.GetNullableString(partyBaseDto.Name), diff --git a/src/pax.XRechnung.NET/BaseDtos/PartyBaseDto.cs b/src/pax.XRechnung.NET/BaseDtos/PartyBaseDto.cs index 69fd6b4..a10ec08 100644 --- a/src/pax.XRechnung.NET/BaseDtos/PartyBaseDto.cs +++ b/src/pax.XRechnung.NET/BaseDtos/PartyBaseDto.cs @@ -17,6 +17,7 @@ public interface IPartyBaseDto string Email { get; set; } string RegistrationName { get; set; } string TaxId { get; set; } + string? CompanyId { get; set; } #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member } @@ -69,4 +70,8 @@ public class PartyBaseDto : IPartyBaseDto /// VAT number or company tax ID. /// public string TaxId { get; set; } = string.Empty; + /// + /// Umsatzsteuer Id + /// + public string? CompanyId { get; set; } } \ No newline at end of file From 3f1651a41f3316be053029b57952da0f749b8cfc Mon Sep 17 00:00:00 2001 From: ipax77 Date: Wed, 14 May 2025 17:10:07 +0200 Subject: [PATCH 3/9] cleanup imports --- src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs | 4 ++-- .../AnnotatedDtos/DocumentReferenceAnnotationDto.cs | 2 +- src/pax.XRechnung.NET/AnnotatedDtos/InvoiceAnnotationDto.cs | 2 +- .../AnnotatedDtos/InvoiceLineAnnotationDto.cs | 2 +- src/pax.XRechnung.NET/AnnotatedDtos/PaymentAnnotationDto.cs | 2 +- src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs | 2 +- .../KositValidator/InvoiceKositValidator.cs | 4 ++-- src/pax.XRechnung.NET/XmlInvoiceValidator.cs | 2 +- src/pax.XRechnung.NET/XmlInvoiceVlidator.Schematron.cs | 2 +- src/pax.XRechnung.NET/XmlInvoiceWriter.cs | 4 +--- src/pax.XRechnung.NET/XmlModels/BinaryObject.cs | 1 - .../XmlModels/XmlAdditionalDocumentReference.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlAllowanceCharge.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlBuyer.cs | 1 - src/pax.XRechnung.NET/XmlModels/XmlCardAccount.cs | 4 ++-- src/pax.XRechnung.NET/XmlModels/XmlContact.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlCountry.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlEndpointId.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlFinancialAccount.cs | 4 ++-- src/pax.XRechnung.NET/XmlModels/XmlInvoice.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlInvoiceLine.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlInvoiceNote.cs | 4 ++-- src/pax.XRechnung.NET/XmlModels/XmlItem.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlItemAttributes.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlMonetaryTotals.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlParty.cs | 2 +- .../XmlModels/XmlPartyIdentificationType.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlPartyLegalEntity.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlPartyName.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlPartyTaxScheme.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlPaymentMeans.cs | 4 ++-- src/pax.XRechnung.NET/XmlModels/XmlPostalAddress.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlPrice.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlTaxCategory.cs | 6 +++--- src/pax.XRechnung.NET/XmlModels/XmlTaxSubTotal.cs | 2 +- src/pax.XRechnung.NET/XmlModels/XmlVatBreakdown.cs | 2 +- src/pax.XRechnung.NET/pax.XRechnung.NET.csproj | 2 +- 37 files changed, 43 insertions(+), 47 deletions(-) diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs index 1f9a883..d552c48 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs @@ -1,5 +1,5 @@ -using System.ComponentModel.DataAnnotations; using pax.XRechnung.NET.BaseDtos; +using System.ComponentModel.DataAnnotations; namespace pax.XRechnung.NET.AnnotatedDtos; #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member @@ -21,7 +21,7 @@ public class BuyerAnnotationDto : IPartyBaseDto public string Telefone { get; set; } = string.Empty; [Required] public string Email { get; set; } = string.Empty; - [Required] + [Required] public string RegistrationName { get; set; } = string.Empty; public string TaxId { get; set; } = string.Empty; public string? CompanyId { get; set; } diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/DocumentReferenceAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/DocumentReferenceAnnotationDto.cs index 208b054..ca9ebc4 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/DocumentReferenceAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/DocumentReferenceAnnotationDto.cs @@ -1,5 +1,5 @@ -using System.ComponentModel.DataAnnotations; using pax.XRechnung.NET.BaseDtos; +using System.ComponentModel.DataAnnotations; namespace pax.XRechnung.NET.AnnotatedDtos; diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceAnnotationDto.cs index d6ddcb9..aa19ed0 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceAnnotationDto.cs @@ -1,5 +1,5 @@ -using System.ComponentModel.DataAnnotations; using pax.XRechnung.NET.BaseDtos; +using System.ComponentModel.DataAnnotations; namespace pax.XRechnung.NET.AnnotatedDtos; diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceLineAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceLineAnnotationDto.cs index 25334c7..fd5fd16 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceLineAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceLineAnnotationDto.cs @@ -1,5 +1,5 @@ -using System.ComponentModel.DataAnnotations; using pax.XRechnung.NET.BaseDtos; +using System.ComponentModel.DataAnnotations; namespace pax.XRechnung.NET.AnnotatedDtos; #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/PaymentAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/PaymentAnnotationDto.cs index 7cafbe5..0b69044 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/PaymentAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/PaymentAnnotationDto.cs @@ -1,5 +1,5 @@ -using System.ComponentModel.DataAnnotations; using pax.XRechnung.NET.BaseDtos; +using System.ComponentModel.DataAnnotations; namespace pax.XRechnung.NET.AnnotatedDtos; #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs index f822c0a..93999b1 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs @@ -1,5 +1,5 @@ -using System.ComponentModel.DataAnnotations; using pax.XRechnung.NET.BaseDtos; +using System.ComponentModel.DataAnnotations; namespace pax.XRechnung.NET.AnnotatedDtos; diff --git a/src/pax.XRechnung.NET/KositValidator/InvoiceKositValidator.cs b/src/pax.XRechnung.NET/KositValidator/InvoiceKositValidator.cs index 825ee05..5eb4146 100644 --- a/src/pax.XRechnung.NET/KositValidator/InvoiceKositValidator.cs +++ b/src/pax.XRechnung.NET/KositValidator/InvoiceKositValidator.cs @@ -1,7 +1,7 @@ -using System.Net; +using HtmlAgilityPack; +using System.Net; using System.Net.Http.Headers; using System.Text; -using HtmlAgilityPack; namespace pax.XRechnung.NET.KositValidator; diff --git a/src/pax.XRechnung.NET/XmlInvoiceValidator.cs b/src/pax.XRechnung.NET/XmlInvoiceValidator.cs index 164f57c..a73d370 100644 --- a/src/pax.XRechnung.NET/XmlInvoiceValidator.cs +++ b/src/pax.XRechnung.NET/XmlInvoiceValidator.cs @@ -1,6 +1,6 @@ +using pax.XRechnung.NET.XmlModels; using System.Xml; using System.Xml.Schema; -using pax.XRechnung.NET.XmlModels; namespace pax.XRechnung.NET; diff --git a/src/pax.XRechnung.NET/XmlInvoiceVlidator.Schematron.cs b/src/pax.XRechnung.NET/XmlInvoiceVlidator.Schematron.cs index e63befb..ea4ffaa 100644 --- a/src/pax.XRechnung.NET/XmlInvoiceVlidator.Schematron.cs +++ b/src/pax.XRechnung.NET/XmlInvoiceVlidator.Schematron.cs @@ -1,7 +1,7 @@ -using System.Xml.Schema; using pax.XRechnung.NET.KositValidator; using pax.XRechnung.NET.XmlModels; +using System.Xml.Schema; namespace pax.XRechnung.NET; diff --git a/src/pax.XRechnung.NET/XmlInvoiceWriter.cs b/src/pax.XRechnung.NET/XmlInvoiceWriter.cs index 3aa24b1..7dc850c 100644 --- a/src/pax.XRechnung.NET/XmlInvoiceWriter.cs +++ b/src/pax.XRechnung.NET/XmlInvoiceWriter.cs @@ -1,12 +1,10 @@ - -using System.Globalization; +using pax.XRechnung.NET.XmlModels; using System.Reflection; using System.Text; using System.Xml; using System.Xml.Linq; using System.Xml.Schema; using System.Xml.Serialization; -using pax.XRechnung.NET.XmlModels; namespace pax.XRechnung.NET; diff --git a/src/pax.XRechnung.NET/XmlModels/BinaryObject.cs b/src/pax.XRechnung.NET/XmlModels/BinaryObject.cs index 41d29dc..3807b17 100644 --- a/src/pax.XRechnung.NET/XmlModels/BinaryObject.cs +++ b/src/pax.XRechnung.NET/XmlModels/BinaryObject.cs @@ -1,6 +1,5 @@ using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlAdditionalDocumentReference.cs b/src/pax.XRechnung.NET/XmlModels/XmlAdditionalDocumentReference.cs index 7162cc8..0e72aa2 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlAdditionalDocumentReference.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlAdditionalDocumentReference.cs @@ -1,6 +1,6 @@ +using pax.XRechnung.NET.Attributes; using System.Xml; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlAllowanceCharge.cs b/src/pax.XRechnung.NET/XmlModels/XmlAllowanceCharge.cs index 0c48320..4650754 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlAllowanceCharge.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlAllowanceCharge.cs @@ -1,6 +1,6 @@ +using pax.XRechnung.NET.Attributes; using System.Xml; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlBuyer.cs b/src/pax.XRechnung.NET/XmlModels/XmlBuyer.cs index 66170fd..eb2b799 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlBuyer.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlBuyer.cs @@ -1,7 +1,6 @@ namespace pax.XRechnung.NET.XmlModels; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; /// /// AccountingCustomerParty diff --git a/src/pax.XRechnung.NET/XmlModels/XmlCardAccount.cs b/src/pax.XRechnung.NET/XmlModels/XmlCardAccount.cs index 8a5bdd1..25422ab 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlCardAccount.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlCardAccount.cs @@ -1,5 +1,5 @@ -using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; +using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlContact.cs b/src/pax.XRechnung.NET/XmlModels/XmlContact.cs index 4e0eda7..95f7668 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlContact.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlContact.cs @@ -1,7 +1,7 @@ namespace pax.XRechnung.NET.XmlModels; -using System.Xml.Serialization; using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; /// /// Untergruppe für Käufer-/Verkäuferkontakte. diff --git a/src/pax.XRechnung.NET/XmlModels/XmlCountry.cs b/src/pax.XRechnung.NET/XmlModels/XmlCountry.cs index 200a657..83345db 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlCountry.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlCountry.cs @@ -1,7 +1,7 @@ namespace pax.XRechnung.NET.XmlModels; -using System.Xml.Serialization; using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; /// /// Country diff --git a/src/pax.XRechnung.NET/XmlModels/XmlEndpointId.cs b/src/pax.XRechnung.NET/XmlModels/XmlEndpointId.cs index 053ae50..2cf787f 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlEndpointId.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlEndpointId.cs @@ -1,7 +1,7 @@ namespace pax.XRechnung.NET.XmlModels; -using System.Xml.Serialization; using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; /// /// EndpointId diff --git a/src/pax.XRechnung.NET/XmlModels/XmlFinancialAccount.cs b/src/pax.XRechnung.NET/XmlModels/XmlFinancialAccount.cs index c2a6203..363de65 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlFinancialAccount.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlFinancialAccount.cs @@ -1,5 +1,5 @@ -using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; +using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlInvoice.cs b/src/pax.XRechnung.NET/XmlModels/XmlInvoice.cs index 2cf8eb7..213694a 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlInvoice.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlInvoice.cs @@ -1,6 +1,6 @@ +using pax.XRechnung.NET.Attributes; using System.Xml; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlInvoiceLine.cs b/src/pax.XRechnung.NET/XmlModels/XmlInvoiceLine.cs index be96149..45fb0da 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlInvoiceLine.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlInvoiceLine.cs @@ -1,6 +1,6 @@ +using pax.XRechnung.NET.Attributes; using System.Xml; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlInvoiceNote.cs b/src/pax.XRechnung.NET/XmlModels/XmlInvoiceNote.cs index ac9166f..8f41aaf 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlInvoiceNote.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlInvoiceNote.cs @@ -1,6 +1,6 @@ -using System.Xml; +using pax.XRechnung.NET.Attributes; +using System.Xml; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlItem.cs b/src/pax.XRechnung.NET/XmlModels/XmlItem.cs index 021f6f2..38c5b38 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlItem.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlItem.cs @@ -1,6 +1,6 @@ +using pax.XRechnung.NET.Attributes; using System.Xml; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlItemAttributes.cs b/src/pax.XRechnung.NET/XmlModels/XmlItemAttributes.cs index 83b48c9..b9a00b6 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlItemAttributes.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlItemAttributes.cs @@ -1,6 +1,6 @@ +using pax.XRechnung.NET.Attributes; using System.Xml; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlMonetaryTotals.cs b/src/pax.XRechnung.NET/XmlModels/XmlMonetaryTotals.cs index 554a889..871be6a 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlMonetaryTotals.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlMonetaryTotals.cs @@ -1,6 +1,6 @@ +using pax.XRechnung.NET.Attributes; using System.Xml; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlParty.cs b/src/pax.XRechnung.NET/XmlModels/XmlParty.cs index 201fab8..a04b4d0 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlParty.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlParty.cs @@ -1,7 +1,7 @@ namespace pax.XRechnung.NET.XmlModels; -using System.Xml.Serialization; using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; /// /// Seller diff --git a/src/pax.XRechnung.NET/XmlModels/XmlPartyIdentificationType.cs b/src/pax.XRechnung.NET/XmlModels/XmlPartyIdentificationType.cs index 323c81c..5a8587e 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlPartyIdentificationType.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlPartyIdentificationType.cs @@ -1,7 +1,7 @@ namespace pax.XRechnung.NET.XmlModels; -using System.Xml.Serialization; using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; /// /// PartyIdentificationType diff --git a/src/pax.XRechnung.NET/XmlModels/XmlPartyLegalEntity.cs b/src/pax.XRechnung.NET/XmlModels/XmlPartyLegalEntity.cs index a0e1da5..608c6ac 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlPartyLegalEntity.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlPartyLegalEntity.cs @@ -1,7 +1,7 @@ namespace pax.XRechnung.NET.XmlModels; -using System.Xml.Serialization; using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; /// /// PartyLegalEntity diff --git a/src/pax.XRechnung.NET/XmlModels/XmlPartyName.cs b/src/pax.XRechnung.NET/XmlModels/XmlPartyName.cs index b911da0..c489ec3 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlPartyName.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlPartyName.cs @@ -1,7 +1,7 @@ namespace pax.XRechnung.NET.XmlModels; -using System.Xml.Serialization; using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; /// /// PartyName diff --git a/src/pax.XRechnung.NET/XmlModels/XmlPartyTaxScheme.cs b/src/pax.XRechnung.NET/XmlModels/XmlPartyTaxScheme.cs index eff76a1..1ede2b6 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlPartyTaxScheme.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlPartyTaxScheme.cs @@ -1,7 +1,7 @@ namespace pax.XRechnung.NET.XmlModels; -using System.Xml.Serialization; using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; /// /// PartyTaxScheme diff --git a/src/pax.XRechnung.NET/XmlModels/XmlPaymentMeans.cs b/src/pax.XRechnung.NET/XmlModels/XmlPaymentMeans.cs index 9c43c00..7404448 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlPaymentMeans.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlPaymentMeans.cs @@ -1,5 +1,5 @@ -using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; +using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlPostalAddress.cs b/src/pax.XRechnung.NET/XmlModels/XmlPostalAddress.cs index 516d4df..f87e5ca 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlPostalAddress.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlPostalAddress.cs @@ -1,7 +1,7 @@ namespace pax.XRechnung.NET.XmlModels; -using System.Xml.Serialization; using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; /// /// Untergruppe für die Verkäuferanschrift. diff --git a/src/pax.XRechnung.NET/XmlModels/XmlPrice.cs b/src/pax.XRechnung.NET/XmlModels/XmlPrice.cs index c78f8e8..af18297 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlPrice.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlPrice.cs @@ -1,6 +1,6 @@ +using pax.XRechnung.NET.Attributes; using System.Xml; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlTaxCategory.cs b/src/pax.XRechnung.NET/XmlModels/XmlTaxCategory.cs index 1dd647c..b640449 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlTaxCategory.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlTaxCategory.cs @@ -1,5 +1,5 @@ -using System.Xml.Serialization; using pax.XRechnung.NET.Attributes; +using System.Xml.Serialization; namespace pax.XRechnung.NET.XmlModels; @@ -21,7 +21,7 @@ public class XmlTaxCategory [XmlElement("Percent", Namespace = XmlInvoiceWriter.CommonBasicComponents)] [SpecificationId("BT-119")] public decimal Percent { get; set; } = 19; - /// + /// /// Exemption Reason Code /// [XmlElement("TaxExemptionReasonCode", Namespace = XmlInvoiceWriter.CommonBasicComponents)] @@ -31,7 +31,7 @@ public class XmlTaxCategory /// [XmlElement("TaxExemptionReason", Namespace = XmlInvoiceWriter.CommonBasicComponents)] [SpecificationId("BT-120")] - public string? ExemptionReason { get; set; } + public string? ExemptionReason { get; set; } /// /// TaxScheme /// diff --git a/src/pax.XRechnung.NET/XmlModels/XmlTaxSubTotal.cs b/src/pax.XRechnung.NET/XmlModels/XmlTaxSubTotal.cs index aba92cf..be95584 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlTaxSubTotal.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlTaxSubTotal.cs @@ -1,6 +1,6 @@ +using pax.XRechnung.NET.Attributes; using System.Xml; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/XmlModels/XmlVatBreakdown.cs b/src/pax.XRechnung.NET/XmlModels/XmlVatBreakdown.cs index 9bc2da9..f0f7e94 100644 --- a/src/pax.XRechnung.NET/XmlModels/XmlVatBreakdown.cs +++ b/src/pax.XRechnung.NET/XmlModels/XmlVatBreakdown.cs @@ -1,6 +1,6 @@ +using pax.XRechnung.NET.Attributes; using System.Xml; using System.Xml.Serialization; -using pax.XRechnung.NET.Attributes; namespace pax.XRechnung.NET.XmlModels; diff --git a/src/pax.XRechnung.NET/pax.XRechnung.NET.csproj b/src/pax.XRechnung.NET/pax.XRechnung.NET.csproj index 77e23ed..f57a2c5 100644 --- a/src/pax.XRechnung.NET/pax.XRechnung.NET.csproj +++ b/src/pax.XRechnung.NET/pax.XRechnung.NET.csproj @@ -104,6 +104,6 @@ - + From 65950f72380b3a9ae3d9d2365023cb15e7e48c39 Mon Sep 17 00:00:00 2001 From: ipax77 Date: Thu, 15 May 2025 09:02:34 +0200 Subject: [PATCH 4/9] v3.0.1 --- src/pax.XRechnung.NET/pax.XRechnung.NET.csproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pax.XRechnung.NET/pax.XRechnung.NET.csproj b/src/pax.XRechnung.NET/pax.XRechnung.NET.csproj index f57a2c5..a2f519b 100644 --- a/src/pax.XRechnung.NET/pax.XRechnung.NET.csproj +++ b/src/pax.XRechnung.NET/pax.XRechnung.NET.csproj @@ -9,12 +9,12 @@ README.md https://github.com/ipax77/pax.XRechnung.NET dotnet;XRechnung;import;export;validate - 0.3.0 + 0.3.1 Philipp Hetzner Philipp Hetzner - 0.3.0 - 0.3.0.0 - 0.3.0 + 0.3.1 + 0.3.1.0 + 0.3.1 MIT true true @@ -104,6 +104,6 @@ - + From 717630d7b654f9533c6e1bd216be4bde30053e74 Mon Sep 17 00:00:00 2001 From: ipax77 Date: Sat, 17 May 2025 06:57:18 +0200 Subject: [PATCH 5/9] move dto BuyerReference to Party and PaymentType to payments --- .../AnnotationDtoTests.cs | 6 +++--- .../BaseDtoExtensionTests.cs | 8 +++----- src/pax.XRechnung.NET.tests/BaseDtoTests.cs | 6 +++--- src/pax.XRechnung.NET.tests/CustomDtoTests.cs | 6 +++--- .../AnnotatedDtos/BuyerAnnotationDto.cs | 2 ++ .../AnnotatedDtos/InvoiceAnnotationDto.cs | 6 +----- .../AnnotatedDtos/PaymentAnnotationDto.cs | 3 +++ .../AnnotatedDtos/SellerAnnotationDto.cs | 1 + .../BaseDtos/InvoiceBaseDto.cs | 10 ---------- .../BaseDtos/InvoiceMapperBase.cs | 18 ++++++++++++------ src/pax.XRechnung.NET/BaseDtos/PartyBaseDto.cs | 5 +++++ .../BaseDtos/PaymentMeansBaseDto.cs | 5 +++++ .../BaseDtos/PaymentMeansMapperBase.cs | 4 ++-- 13 files changed, 43 insertions(+), 37 deletions(-) diff --git a/src/pax.XRechnung.NET.tests/AnnotationDtoTests.cs b/src/pax.XRechnung.NET.tests/AnnotationDtoTests.cs index 46cca26..cf20a04 100644 --- a/src/pax.XRechnung.NET.tests/AnnotationDtoTests.cs +++ b/src/pax.XRechnung.NET.tests/AnnotationDtoTests.cs @@ -19,7 +19,6 @@ public static InvoiceAnnotationDto GetInvoiceAnnDto() IssueDate = DateTime.UtcNow, InvoiceTypeCode = "380", DocumentCurrencyCode = "EUR", - BuyerReference = "04011000-12345-34", SellerParty = new SellerAnnotationDto() { Name = "Seller Name", @@ -42,14 +41,15 @@ public static InvoiceAnnotationDto GetInvoiceAnnDto() Telefone = "1234/54321", Email = "buyer@example.com", RegistrationName = "Buyer Name", + BuyerReference = "04011000-12345-34", }, PaymentMeans = new PaymentAnnotationDto() { Iban = "DE12 1234 1234 1234 1234 12", Bic = "BICABCDE", - Name = "Bank Name" + Name = "Bank Name", + PaymentMeansTypeCode = "30", }, - PaymentMeansTypeCode = "30", PaymentTermsNote = "Zahlbar innerhalb 14 Tagen nach Erhalt der Rechnung.", PayableAmount = 119.0, InvoiceLines = [ diff --git a/src/pax.XRechnung.NET.tests/BaseDtoExtensionTests.cs b/src/pax.XRechnung.NET.tests/BaseDtoExtensionTests.cs index ce2a16b..0d4a1aa 100644 --- a/src/pax.XRechnung.NET.tests/BaseDtoExtensionTests.cs +++ b/src/pax.XRechnung.NET.tests/BaseDtoExtensionTests.cs @@ -18,7 +18,6 @@ public static InvoiceExtendedDto GetInvoiceBaseDto() IssueDate = DateTime.UtcNow, InvoiceTypeCode = "380", DocumentCurrencyCode = "EUR", - BuyerReference = "04011000-12345-34", SellerParty = new PartyBaseDto() { Name = "Seller Name", @@ -41,14 +40,15 @@ public static InvoiceExtendedDto GetInvoiceBaseDto() Telefone = "1234/54321", Email = "buyer@example.com", RegistrationName = "Buyer Name", + BuyerReference = "04011000-12345-34", }, PaymentMeans = new PaymentMeansBaseDto() { Iban = "DE12 1234 1234 1234 1234 12", Bic = "BICABCDE", - Name = "Bank Name" + Name = "Bank Name", + PaymentMeansTypeCode = "30", }, - PaymentMeansTypeCode = "30", PaymentTermsNote = "Zahlbar innerhalb 14 Tagen nach Erhalt der Rechnung.", PayableAmount = 119.0, InvoiceLines = [ @@ -164,12 +164,10 @@ public class InvoiceExtendedDto : IInvoiceBaseDto public string InvoiceTypeCode { get; set; } = "380"; public string? Note { get; set; } public string DocumentCurrencyCode { get; set; } = "EUR"; - public string BuyerReference { get; set; } = string.Empty; public List AdditionalDocumentReferences { get; set; } = []; public PartyBaseDto SellerParty { get; set; } = new PartyBaseDto(); public PartyBaseDto BuyerParty { get; set; } = new PartyBaseDto(); public PaymentMeansBaseDto PaymentMeans { get; set; } = new PaymentMeansBaseDto(); - public string PaymentMeansTypeCode { get; set; } = "30"; public string PaymentTermsNote { get; set; } = string.Empty; public double PayableAmount { get; set; } public List InvoiceLines { get; set; } = []; diff --git a/src/pax.XRechnung.NET.tests/BaseDtoTests.cs b/src/pax.XRechnung.NET.tests/BaseDtoTests.cs index 6dc52d1..d73b1aa 100644 --- a/src/pax.XRechnung.NET.tests/BaseDtoTests.cs +++ b/src/pax.XRechnung.NET.tests/BaseDtoTests.cs @@ -17,7 +17,6 @@ public static InvoiceBaseDto GetInvoiceBaseDto() IssueDate = new DateTime(2025, 05, 01), InvoiceTypeCode = "380", DocumentCurrencyCode = "EUR", - BuyerReference = "04011000-12345-34", SellerParty = new PartyBaseDto() { Name = "Seller Name", @@ -40,14 +39,15 @@ public static InvoiceBaseDto GetInvoiceBaseDto() Telefone = "1234/54321", Email = "buyer@example.com", RegistrationName = "Buyer Name", + BuyerReference = "04011000-12345-34", }, PaymentMeans = new PaymentMeansBaseDto() { Iban = "DE12 1234 1234 1234 1234 12", Bic = "BICABCDE", - Name = "Bank Name" + Name = "Bank Name", + PaymentMeansTypeCode = "30", }, - PaymentMeansTypeCode = "30", PaymentTermsNote = "Zahlbar innerhalb 14 Tagen nach Erhalt der Rechnung.", PayableAmount = 119.0, InvoiceLines = [ diff --git a/src/pax.XRechnung.NET.tests/CustomDtoTests.cs b/src/pax.XRechnung.NET.tests/CustomDtoTests.cs index 413200a..a2ee450 100644 --- a/src/pax.XRechnung.NET.tests/CustomDtoTests.cs +++ b/src/pax.XRechnung.NET.tests/CustomDtoTests.cs @@ -18,7 +18,6 @@ public static MyCustomInvoiceDto GetInvoiceDto() IssueDate = DateTime.UtcNow, InvoiceTypeCode = "380", DocumentCurrencyCode = "EUR", - BuyerReference = "04011000-12345-34", SellerParty = new SellerAnnotationDto() { Name = "Seller Name", @@ -41,14 +40,15 @@ public static MyCustomInvoiceDto GetInvoiceDto() Telefone = "1234/54321", Email = "buyer@example.com", RegistrationName = "Buyer Name", + BuyerReference = "04011000-12345-34", }, PaymentMeans = new PaymentAnnotationDto() { Iban = "DE12 1234 1234 1234 1234 12", Bic = "BICABCDE", - Name = "Bank Name" + Name = "Bank Name", + PaymentMeansTypeCode = "30", }, - PaymentMeansTypeCode = "30", PaymentTermsNote = "Zahlbar innerhalb 14 Tagen nach Erhalt der Rechnung.", PayableAmount = 119.0, InvoiceLines = [ diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs index d552c48..7754d65 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs @@ -25,6 +25,8 @@ public class BuyerAnnotationDto : IPartyBaseDto public string RegistrationName { get; set; } = string.Empty; public string TaxId { get; set; } = string.Empty; public string? CompanyId { get; set; } + [Required] + public string BuyerReference { get; set; } = string.Empty; } #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceAnnotationDto.cs index aa19ed0..25e5e05 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/InvoiceAnnotationDto.cs @@ -29,15 +29,11 @@ public class InvoiceAnnotationDto : IInvoiceBaseDto [Required] [ValidCode(CodeListType.Currency_Codes_3)] public string DocumentCurrencyCode { get; set; } = "EUR"; - [Required] - public string BuyerReference { get; set; } = string.Empty; public List AdditionalDocumentReferences { get; set; } = []; public SellerAnnotationDto SellerParty { get; set; } = new SellerAnnotationDto(); public BuyerAnnotationDto BuyerParty { get; set; } = new BuyerAnnotationDto(); public PaymentAnnotationDto PaymentMeans { get; set; } = new PaymentAnnotationDto(); - [Required] - [ValidCode(CodeListType.UNTDID_4461_3)] - public string PaymentMeansTypeCode { get; set; } = "30"; + public string PaymentTermsNote { get; set; } = string.Empty; public double PayableAmount { get; set; } public List InvoiceLines { get; set; } = []; diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/PaymentAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/PaymentAnnotationDto.cs index 0b69044..3d43d0f 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/PaymentAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/PaymentAnnotationDto.cs @@ -10,6 +10,9 @@ public class PaymentAnnotationDto : IPaymentMeansBaseDto [Required] public string Bic { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; + [Required] + [ValidCode(CodeListType.UNTDID_4461_3)] + public string PaymentMeansTypeCode { get; set; } = "30"; } #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs b/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs index 93999b1..2131e71 100644 --- a/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs +++ b/src/pax.XRechnung.NET/AnnotatedDtos/SellerAnnotationDto.cs @@ -27,6 +27,7 @@ public class SellerAnnotationDto : IPartyBaseDto [Required] public string TaxId { get; set; } = string.Empty; public string? CompanyId { get; set; } + public string BuyerReference { get; set; } = string.Empty; } #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/src/pax.XRechnung.NET/BaseDtos/InvoiceBaseDto.cs b/src/pax.XRechnung.NET/BaseDtos/InvoiceBaseDto.cs index dcadf2b..5f69388 100644 --- a/src/pax.XRechnung.NET/BaseDtos/InvoiceBaseDto.cs +++ b/src/pax.XRechnung.NET/BaseDtos/InvoiceBaseDto.cs @@ -15,12 +15,10 @@ public interface IInvoiceBaseDto string InvoiceTypeCode { get; set; } string? Note { get; set; } string DocumentCurrencyCode { get; set; } - string BuyerReference { get; set; } List AdditionalDocumentReferences { get; set; } IPartyBaseDto SellerParty { get; set; } IPartyBaseDto BuyerParty { get; set; } IPaymentMeansBaseDto PaymentMeans { get; set; } - string PaymentMeansTypeCode { get; set; } string PaymentTermsNote { get; set; } double PayableAmount { get; set; } List InvoiceLines { get; set; } @@ -84,10 +82,6 @@ public partial class InvoiceBaseDto : IInvoiceBaseDto /// public string DocumentCurrencyCode { get; set; } = "EUR"; /// - /// Ein vom Erwerber zugewiesener und für interne Lenkungszwecke benutzter Bezeichner - /// - public string BuyerReference { get; set; } = string.Empty; - /// /// Additional documents attached to the invoice (e.g., contract, timesheet) /// public List AdditionalDocumentReferences { get; set; } = []; @@ -104,10 +98,6 @@ public partial class InvoiceBaseDto : IInvoiceBaseDto /// public PaymentMeansBaseDto PaymentMeans { get; set; } = new PaymentMeansBaseDto(); /// - /// Payment type code, e.g. "30" - /// - public string PaymentMeansTypeCode { get; set; } = "30"; - /// /// Payment terms note /// public string PaymentTermsNote { get; set; } = string.Empty; diff --git a/src/pax.XRechnung.NET/BaseDtos/InvoiceMapperBase.cs b/src/pax.XRechnung.NET/BaseDtos/InvoiceMapperBase.cs index c3ef1e3..a4e4371 100644 --- a/src/pax.XRechnung.NET/BaseDtos/InvoiceMapperBase.cs +++ b/src/pax.XRechnung.NET/BaseDtos/InvoiceMapperBase.cs @@ -100,7 +100,7 @@ public virtual TInvoiceDto FromXml(XmlInvoice xmlInvoice) var taxCategory = xmlTaxCategory?.Id.Content ?? (tax == 0 ? DefaultSmallBusinessTaxCategory : DefaultTaxCategory); - return new() + var invoice = new TInvoiceDto() { GlobalTaxCategory = taxCategory, GlobalTaxScheme = taxScheme, @@ -110,18 +110,19 @@ public virtual TInvoiceDto FromXml(XmlInvoice xmlInvoice) DueDate = xmlInvoice.DueDate == null ? null : InvoiceMapperUtils.GetDateTime(xmlInvoice.DueDate.Value), InvoiceTypeCode = xmlInvoice.InvoiceTypeCode, DocumentCurrencyCode = xmlInvoice.DocumentCurrencyCode, - BuyerReference = xmlInvoice.BuyerReference, AdditionalDocumentReferences = xmlInvoice.AdditionalDocumentReferences .Select(s => AdditionalDocumentToDto(s)).ToList(), SellerParty = SellerPartyToDto(xmlInvoice.SellerParty.Party), BuyerParty = BuyerPartyToDto(xmlInvoice.BuyerParty.Party), PaymentMeans = PaymentMeansMapper.FromXml(xmlInvoice.PaymentMeans), - PaymentMeansTypeCode = xmlInvoice.PaymentMeans.PaymentMeansTypeCode, PaymentTermsNote = xmlInvoice.PaymentTerms?.Note ?? string.Empty, PayableAmount = (double)(xmlInvoice.LegalMonetaryTotal.PayableAmount?.Value ?? 0), InvoiceLines = xmlInvoice.InvoiceLines.Select(s => LineToDto(s)).ToList(), }; + invoice.BuyerParty.BuyerReference = xmlInvoice.BuyerReference; + invoice.PaymentMeans.PaymentMeansTypeCode = xmlInvoice.PaymentMeans.PaymentMeansTypeCode; + return invoice; } /// /// Map T to XmlInvoice @@ -147,6 +148,11 @@ public virtual XmlInvoice ToXml(TInvoiceDto dto) dto.GlobalTaxCategory = DefaultSmallBusinessTaxCategory; } + if (string.IsNullOrEmpty(dto.PaymentMeans.PaymentMeansTypeCode)) + { + dto.PaymentMeans.PaymentMeansTypeCode = DefaultPaymentMeansTypeCode; + } + var xml = new XmlInvoice() { Id = new() { Content = dto.Id }, @@ -155,14 +161,14 @@ public virtual XmlInvoice ToXml(TInvoiceDto dto) new DateOnly(dto.DueDate.Value.Year, dto.DueDate.Value.Month, dto.DueDate.Value.Day), InvoiceTypeCode = dto.InvoiceTypeCode, DocumentCurrencyCode = dto.DocumentCurrencyCode, - BuyerReference = dto.BuyerReference, + BuyerReference = dto.BuyerParty.BuyerReference, AdditionalDocumentReferences = dto.AdditionalDocumentReferences.Select(s => AdditionalDocumentToXml(s)) .ToList(), SellerParty = new() { Party = SellerPartyToXml(dto.SellerParty, dto) }, BuyerParty = new() { Party = BuyerPartyToXml(dto.BuyerParty) }, - PaymentMeans = PaymentMeansMapper.ToXml(dto.PaymentMeans, string.IsNullOrEmpty(dto.PaymentMeansTypeCode) - ? DefaultPaymentMeansTypeCode : dto.PaymentMeansTypeCode), + PaymentMeans = PaymentMeansMapper.ToXml(dto.PaymentMeans), + PaymentTerms = string.IsNullOrEmpty(dto.PaymentTermsNote) ? null : new() { Note = dto.PaymentTermsNote }, TaxTotal = new() { diff --git a/src/pax.XRechnung.NET/BaseDtos/PartyBaseDto.cs b/src/pax.XRechnung.NET/BaseDtos/PartyBaseDto.cs index a10ec08..1de4346 100644 --- a/src/pax.XRechnung.NET/BaseDtos/PartyBaseDto.cs +++ b/src/pax.XRechnung.NET/BaseDtos/PartyBaseDto.cs @@ -18,6 +18,7 @@ public interface IPartyBaseDto string RegistrationName { get; set; } string TaxId { get; set; } string? CompanyId { get; set; } + string BuyerReference { get; set; } #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member } @@ -74,4 +75,8 @@ public class PartyBaseDto : IPartyBaseDto /// Umsatzsteuer Id /// public string? CompanyId { get; set; } + /// + /// Ein vom Erwerber zugewiesener und für interne Lenkungszwecke benutzter Bezeichner + /// + public string BuyerReference { get; set; } = string.Empty; } \ No newline at end of file diff --git a/src/pax.XRechnung.NET/BaseDtos/PaymentMeansBaseDto.cs b/src/pax.XRechnung.NET/BaseDtos/PaymentMeansBaseDto.cs index 86b423c..79db1a5 100644 --- a/src/pax.XRechnung.NET/BaseDtos/PaymentMeansBaseDto.cs +++ b/src/pax.XRechnung.NET/BaseDtos/PaymentMeansBaseDto.cs @@ -9,6 +9,7 @@ public interface IPaymentMeansBaseDto string Iban { get; set; } string Bic { get; set; } string Name { get; set; } + string PaymentMeansTypeCode { get; set; } #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member } @@ -29,4 +30,8 @@ public partial class PaymentMeansBaseDto : IPaymentMeansBaseDto /// Bank Name /// public string Name { get; set; } = string.Empty; + /// + /// Payment type code, e.g. "30" + /// + public string PaymentMeansTypeCode { get; set; } = "30"; } diff --git a/src/pax.XRechnung.NET/BaseDtos/PaymentMeansMapperBase.cs b/src/pax.XRechnung.NET/BaseDtos/PaymentMeansMapperBase.cs index 2600242..f73d4ff 100644 --- a/src/pax.XRechnung.NET/BaseDtos/PaymentMeansMapperBase.cs +++ b/src/pax.XRechnung.NET/BaseDtos/PaymentMeansMapperBase.cs @@ -25,12 +25,12 @@ public virtual T FromXml(XmlPaymentMeans xmlPayment) /// /// Map IPartyBaseDto to XmlParty /// - public virtual XmlPaymentMeans ToXml(IPaymentMeansBaseDto dto, string paymentMeansTypeCode) + public virtual XmlPaymentMeans ToXml(IPaymentMeansBaseDto dto) { ArgumentNullException.ThrowIfNull(dto); return new() { - PaymentMeansTypeCode = paymentMeansTypeCode, + PaymentMeansTypeCode = dto.PaymentMeansTypeCode, PayeeFinancialAccount = new() { Id = new() { Content = dto.Iban }, From 7595ffa9f39a3492702c90cf555f19b5018a2069 Mon Sep 17 00:00:00 2001 From: ipax77 Date: Sat, 17 May 2025 08:50:06 +0200 Subject: [PATCH 6/9] fix codeList metadata deserialization --- src/pax.XRechnung.NET.tests/CodeListTests.cs | 13 +++++++++++++ src/pax.XRechnung.NET/CodeListModel/CodeList.cs | 1 - src/pax.XRechnung.NET/CodeListRepository.cs | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/pax.XRechnung.NET.tests/CodeListTests.cs b/src/pax.XRechnung.NET.tests/CodeListTests.cs index 6e45175..4c560c8 100644 --- a/src/pax.XRechnung.NET.tests/CodeListTests.cs +++ b/src/pax.XRechnung.NET.tests/CodeListTests.cs @@ -1,5 +1,8 @@  +using pax.XRechnung.NET.CodeListModel; + namespace pax.XRechnung.NET.tests; + [TestClass] public class CodeListTests { @@ -11,4 +14,14 @@ public void CanValidateCode() var isValid = CodeListRepository.IsValidCode(listId, code); Assert.IsTrue(isValid); } + + [TestMethod] + public void CanSerializeDescription() + { + CodeList? codeList = CodeListRepository.GetCodeList("UNTDID_1001"); + Assert.IsNotNull(codeList); + var desc = "Die Codeliste basiert auf der Codeliste 1001 (Document name code) des United Trade Data Interchange Directory (UNTDID). Die vorliegende Version der Codeliste entspricht in Umfang und Inhalt der Einträge (Codes, Namen und Beschreibung) der zugrundeliegenden Codeliste 1001 (Document name code) des United Trade Data Interchange Directory (UNTDID). Die Codeliste kann im Zusammenhang mit EN16931-1:2017 und der darauf basierenden XRechnung (Standard und Extension) verwendeten werden. EN16931 Annex A definiert eine Untermenge dieser Liste zur Verwendung. Des Weiteren enthält diese Codeliste alle Einträge, die für die Nutzung im Kontext des Standards XBestellung benötigt werden."; + var current = codeList.Metadaten.Beschreibung.FirstOrDefault()?.Value; + Assert.AreEqual(desc, current); + } } diff --git a/src/pax.XRechnung.NET/CodeListModel/CodeList.cs b/src/pax.XRechnung.NET/CodeListModel/CodeList.cs index 1dd5ef6..6917d2c 100644 --- a/src/pax.XRechnung.NET/CodeListModel/CodeList.cs +++ b/src/pax.XRechnung.NET/CodeListModel/CodeList.cs @@ -20,7 +20,6 @@ public class CodeListMetadata public List AenderungZurVorversion { get; set; } = []; public string HandbuchVersion { get; set; } = string.Empty; public bool XoevHandbuch { get; set; } - public DateTime GueltigAb { get; set; } public List Bezugsorte { get; set; } = []; } diff --git a/src/pax.XRechnung.NET/CodeListRepository.cs b/src/pax.XRechnung.NET/CodeListRepository.cs index 3c45915..64b0c53 100644 --- a/src/pax.XRechnung.NET/CodeListRepository.cs +++ b/src/pax.XRechnung.NET/CodeListRepository.cs @@ -13,6 +13,7 @@ public static partial class CodeListRepository { private static readonly ConcurrentDictionary CodeListCache = []; private const string CodeListRessourceBasePath = "pax.XRechnung.NET.Resources.CodeListFiles."; + private static readonly JsonSerializerOptions jsonOptions = new JsonSerializerOptions() { PropertyNameCaseInsensitive = true }; /// /// @@ -59,7 +60,7 @@ public static bool IsValidCode(string listId, string code) return null; } - var codeList = JsonSerializer.Deserialize(stream); + var codeList = JsonSerializer.Deserialize(stream, jsonOptions); SetDataDictionary(codeList); CodeListCache.AddOrUpdate(resourceName, codeList, (k, v) => v = codeList); return codeList; From 4bbd7c8d67954de1857d4ec08cede148b4899c25 Mon Sep 17 00:00:00 2001 From: ipax77 Date: Fri, 23 May 2025 07:01:52 +0200 Subject: [PATCH 7/9] fix note mapping --- src/pax.XRechnung.NET/BaseDtos/InvoiceMapperBase.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pax.XRechnung.NET/BaseDtos/InvoiceMapperBase.cs b/src/pax.XRechnung.NET/BaseDtos/InvoiceMapperBase.cs index a4e4371..4c4a281 100644 --- a/src/pax.XRechnung.NET/BaseDtos/InvoiceMapperBase.cs +++ b/src/pax.XRechnung.NET/BaseDtos/InvoiceMapperBase.cs @@ -108,6 +108,7 @@ public virtual TInvoiceDto FromXml(XmlInvoice xmlInvoice) Id = xmlInvoice.Id.Content, IssueDate = InvoiceMapperUtils.GetDateTime(xmlInvoice.IssueDate), DueDate = xmlInvoice.DueDate == null ? null : InvoiceMapperUtils.GetDateTime(xmlInvoice.DueDate.Value), + Note = xmlInvoice.Note, InvoiceTypeCode = xmlInvoice.InvoiceTypeCode, DocumentCurrencyCode = xmlInvoice.DocumentCurrencyCode, AdditionalDocumentReferences = xmlInvoice.AdditionalDocumentReferences @@ -159,6 +160,7 @@ public virtual XmlInvoice ToXml(TInvoiceDto dto) IssueDate = new DateOnly(dto.IssueDate.Year, dto.IssueDate.Month, dto.IssueDate.Day), DueDate = dto.DueDate == null || dto.DueDate == DateTime.MinValue ? null : new DateOnly(dto.DueDate.Value.Year, dto.DueDate.Value.Month, dto.DueDate.Value.Day), + Note = dto.Note, InvoiceTypeCode = dto.InvoiceTypeCode, DocumentCurrencyCode = dto.DocumentCurrencyCode, BuyerReference = dto.BuyerParty.BuyerReference, From b29b450df5ddab2ada987c122fd4fb04c72f09ae Mon Sep 17 00:00:00 2001 From: ipax77 Date: Fri, 23 May 2025 09:19:58 +0200 Subject: [PATCH 8/9] add http status code to schematron validation --- src/pax.XRechnung.NET/InvoiceValidationResult.cs | 4 ++++ src/pax.XRechnung.NET/XmlInvoiceVlidator.Schematron.cs | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pax.XRechnung.NET/InvoiceValidationResult.cs b/src/pax.XRechnung.NET/InvoiceValidationResult.cs index 1ddccc1..bd09659 100644 --- a/src/pax.XRechnung.NET/InvoiceValidationResult.cs +++ b/src/pax.XRechnung.NET/InvoiceValidationResult.cs @@ -27,6 +27,10 @@ public InvoiceValidationResult(ICollection validationEventA } } /// + /// HttpStatusCode + /// + public string HttpStatusCode { get; set; } = string.Empty; + /// /// Constructor /// /// diff --git a/src/pax.XRechnung.NET/XmlInvoiceVlidator.Schematron.cs b/src/pax.XRechnung.NET/XmlInvoiceVlidator.Schematron.cs index ea4ffaa..b3413b0 100644 --- a/src/pax.XRechnung.NET/XmlInvoiceVlidator.Schematron.cs +++ b/src/pax.XRechnung.NET/XmlInvoiceVlidator.Schematron.cs @@ -82,11 +82,12 @@ private static InvoiceValidationResult MapToValidationResult(SchematronValidatio if (!string.IsNullOrEmpty(kositResult.Error) || !kositResult.IsValid) { - validationEvents.Add(new(new XmlSchemaException("xml invalid"), kositResult.Error ?? "Unexpected error.", XmlSeverityType.Error)); + validationEvents.Add(new(new XmlSchemaException("unknown"), kositResult.Error ?? kositResult.HttpStatusCode.ToString(), XmlSeverityType.Error)); } var result = new InvoiceValidationResult(validationEvents) { + HttpStatusCode = kositResult.HttpStatusCode.ToString(), Evaluation = kositResult.Evaluation, Conformity = kositResult.Conformity }; From 64dccb585109febafc1178645cdf188047f419ec Mon Sep 17 00:00:00 2001 From: ipax77 Date: Fri, 23 May 2025 18:49:52 +0200 Subject: [PATCH 9/9] v0.3.1 --- README.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cc91877..fcc8994 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,9 @@ public static InvoiceBaseDto GetInvoiceBaseDto() GlobalTaxScheme = "VAT", GlobalTax = 19.0, Id = "1", - IssueDate = DateTime.UtcNow, + IssueDate = new DateTime(2025, 05, 01), InvoiceTypeCode = "380", DocumentCurrencyCode = "EUR", - BuyerReference = "04011000-12345-34", SellerParty = new PartyBaseDto() { Name = "Seller Name", @@ -69,15 +68,16 @@ public static InvoiceBaseDto GetInvoiceBaseDto() Telefone = "1234/54321", Email = "buyer@example.com", RegistrationName = "Buyer Name", + BuyerReference = "04011000-12345-34", }, PaymentMeans = new PaymentMeansBaseDto() { Iban = "DE12 1234 1234 1234 1234 12", Bic = "BICABCDE", - Name = "Bank Name" + Name = "Bank Name", + PaymentMeansTypeCode = "30", }, - PaymentMeansTypeCode = "30", - PaymentTermsNote = "Zahlbar innerhalb 14 Tagen nach Erhalt der Rechnung.", + PaymentTermsNote = "Zahlbar innerhalb von 14 Tagen nach Erhalt der Rechnung.", PayableAmount = 119.0, InvoiceLines = [ new InvoiceLineBaseDto() @@ -121,7 +121,17 @@ Server start: # ChangeLog -
v0.3.0 +
v0.3.1 + +>- **Breaking Changes** +>- Code Lists fix to receive meta information +>- DTO rework to be more flexible and robust: +>- PaymentMeansTypeCode to PaymentMeans +>- BuyerReference to BuyerParty + +
+ +
v0.3.0 >- **Breaking Changes** >- DTO rework to be more flexible and robust.