Skip to content

Commit f481ebe

Browse files
authored
Merge pull request #8 from ipax77/dev
v0.3.1
2 parents 2194546 + 64dccb5 commit f481ebe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+143
-99
lines changed

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ public static InvoiceBaseDto GetInvoiceBaseDto()
4343
GlobalTaxScheme = "VAT",
4444
GlobalTax = 19.0,
4545
Id = "1",
46-
IssueDate = DateTime.UtcNow,
46+
IssueDate = new DateTime(2025, 05, 01),
4747
InvoiceTypeCode = "380",
4848
DocumentCurrencyCode = "EUR",
49-
BuyerReference = "04011000-12345-34",
5049
SellerParty = new PartyBaseDto()
5150
{
5251
Name = "Seller Name",
@@ -69,15 +68,16 @@ public static InvoiceBaseDto GetInvoiceBaseDto()
6968
Telefone = "1234/54321",
7069
Email = "buyer@example.com",
7170
RegistrationName = "Buyer Name",
71+
BuyerReference = "04011000-12345-34",
7272
},
7373
PaymentMeans = new PaymentMeansBaseDto()
7474
{
7575
Iban = "DE12 1234 1234 1234 1234 12",
7676
Bic = "BICABCDE",
77-
Name = "Bank Name"
77+
Name = "Bank Name",
78+
PaymentMeansTypeCode = "30",
7879
},
79-
PaymentMeansTypeCode = "30",
80-
PaymentTermsNote = "Zahlbar innerhalb 14 Tagen nach Erhalt der Rechnung.",
80+
PaymentTermsNote = "Zahlbar innerhalb von 14 Tagen nach Erhalt der Rechnung.",
8181
PayableAmount = 119.0,
8282
InvoiceLines = [
8383
new InvoiceLineBaseDto()
@@ -121,7 +121,17 @@ Server start:
121121

122122
# ChangeLog
123123

124-
<details open="open"><summary>v0.3.0</summary>
124+
<details open="open"><summary>v0.3.1</summary>
125+
126+
>- **Breaking Changes**
127+
>- Code Lists fix to receive meta information
128+
>- DTO rework to be more flexible and robust:
129+
>- PaymentMeansTypeCode to PaymentMeans
130+
>- BuyerReference to BuyerParty
131+
132+
</details>
133+
134+
<details><summary>v0.3.0</summary>
125135

126136
>- **Breaking Changes**
127137
>- DTO rework to be more flexible and robust.

src/pax.XRechnung.NET.tests/AnnotationDtoTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public static InvoiceAnnotationDto GetInvoiceAnnDto()
1919
IssueDate = DateTime.UtcNow,
2020
InvoiceTypeCode = "380",
2121
DocumentCurrencyCode = "EUR",
22-
BuyerReference = "04011000-12345-34",
2322
SellerParty = new SellerAnnotationDto()
2423
{
2524
Name = "Seller Name",
@@ -42,14 +41,15 @@ public static InvoiceAnnotationDto GetInvoiceAnnDto()
4241
Telefone = "1234/54321",
4342
Email = "buyer@example.com",
4443
RegistrationName = "Buyer Name",
44+
BuyerReference = "04011000-12345-34",
4545
},
4646
PaymentMeans = new PaymentAnnotationDto()
4747
{
4848
Iban = "DE12 1234 1234 1234 1234 12",
4949
Bic = "BICABCDE",
50-
Name = "Bank Name"
50+
Name = "Bank Name",
51+
PaymentMeansTypeCode = "30",
5152
},
52-
PaymentMeansTypeCode = "30",
5353
PaymentTermsNote = "Zahlbar innerhalb 14 Tagen nach Erhalt der Rechnung.",
5454
PayableAmount = 119.0,
5555
InvoiceLines = [

src/pax.XRechnung.NET.tests/BaseDtoExtensionTests.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public static InvoiceExtendedDto GetInvoiceBaseDto()
1818
IssueDate = DateTime.UtcNow,
1919
InvoiceTypeCode = "380",
2020
DocumentCurrencyCode = "EUR",
21-
BuyerReference = "04011000-12345-34",
2221
SellerParty = new PartyBaseDto()
2322
{
2423
Name = "Seller Name",
@@ -41,14 +40,15 @@ public static InvoiceExtendedDto GetInvoiceBaseDto()
4140
Telefone = "1234/54321",
4241
Email = "buyer@example.com",
4342
RegistrationName = "Buyer Name",
43+
BuyerReference = "04011000-12345-34",
4444
},
4545
PaymentMeans = new PaymentMeansBaseDto()
4646
{
4747
Iban = "DE12 1234 1234 1234 1234 12",
4848
Bic = "BICABCDE",
49-
Name = "Bank Name"
49+
Name = "Bank Name",
50+
PaymentMeansTypeCode = "30",
5051
},
51-
PaymentMeansTypeCode = "30",
5252
PaymentTermsNote = "Zahlbar innerhalb 14 Tagen nach Erhalt der Rechnung.",
5353
PayableAmount = 119.0,
5454
InvoiceLines = [
@@ -164,12 +164,10 @@ public class InvoiceExtendedDto : IInvoiceBaseDto
164164
public string InvoiceTypeCode { get; set; } = "380";
165165
public string? Note { get; set; }
166166
public string DocumentCurrencyCode { get; set; } = "EUR";
167-
public string BuyerReference { get; set; } = string.Empty;
168167
public List<DocumentReferenceBaseDto> AdditionalDocumentReferences { get; set; } = [];
169168
public PartyBaseDto SellerParty { get; set; } = new PartyBaseDto();
170169
public PartyBaseDto BuyerParty { get; set; } = new PartyBaseDto();
171170
public PaymentMeansBaseDto PaymentMeans { get; set; } = new PaymentMeansBaseDto();
172-
public string PaymentMeansTypeCode { get; set; } = "30";
173171
public string PaymentTermsNote { get; set; } = string.Empty;
174172
public double PayableAmount { get; set; }
175173
public List<InvoiceLineExtendedDto> InvoiceLines { get; set; } = [];

src/pax.XRechnung.NET.tests/BaseDtoTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public static InvoiceBaseDto GetInvoiceBaseDto()
1717
IssueDate = new DateTime(2025, 05, 01),
1818
InvoiceTypeCode = "380",
1919
DocumentCurrencyCode = "EUR",
20-
BuyerReference = "04011000-12345-34",
2120
SellerParty = new PartyBaseDto()
2221
{
2322
Name = "Seller Name",
@@ -40,14 +39,15 @@ public static InvoiceBaseDto GetInvoiceBaseDto()
4039
Telefone = "1234/54321",
4140
Email = "buyer@example.com",
4241
RegistrationName = "Buyer Name",
42+
BuyerReference = "04011000-12345-34",
4343
},
4444
PaymentMeans = new PaymentMeansBaseDto()
4545
{
4646
Iban = "DE12 1234 1234 1234 1234 12",
4747
Bic = "BICABCDE",
48-
Name = "Bank Name"
48+
Name = "Bank Name",
49+
PaymentMeansTypeCode = "30",
4950
},
50-
PaymentMeansTypeCode = "30",
5151
PaymentTermsNote = "Zahlbar innerhalb 14 Tagen nach Erhalt der Rechnung.",
5252
PayableAmount = 119.0,
5353
InvoiceLines = [

src/pax.XRechnung.NET.tests/CodeListTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11

2+
using pax.XRechnung.NET.CodeListModel;
3+
24
namespace pax.XRechnung.NET.tests;
5+
36
[TestClass]
47
public class CodeListTests
58
{
@@ -11,4 +14,14 @@ public void CanValidateCode()
1114
var isValid = CodeListRepository.IsValidCode(listId, code);
1215
Assert.IsTrue(isValid);
1316
}
17+
18+
[TestMethod]
19+
public void CanSerializeDescription()
20+
{
21+
CodeList? codeList = CodeListRepository.GetCodeList("UNTDID_1001");
22+
Assert.IsNotNull(codeList);
23+
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.";
24+
var current = codeList.Metadaten.Beschreibung.FirstOrDefault()?.Value;
25+
Assert.AreEqual(desc, current);
26+
}
1427
}

src/pax.XRechnung.NET.tests/CustomDtoTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public static MyCustomInvoiceDto GetInvoiceDto()
1818
IssueDate = DateTime.UtcNow,
1919
InvoiceTypeCode = "380",
2020
DocumentCurrencyCode = "EUR",
21-
BuyerReference = "04011000-12345-34",
2221
SellerParty = new SellerAnnotationDto()
2322
{
2423
Name = "Seller Name",
@@ -41,14 +40,15 @@ public static MyCustomInvoiceDto GetInvoiceDto()
4140
Telefone = "1234/54321",
4241
Email = "buyer@example.com",
4342
RegistrationName = "Buyer Name",
43+
BuyerReference = "04011000-12345-34",
4444
},
4545
PaymentMeans = new PaymentAnnotationDto()
4646
{
4747
Iban = "DE12 1234 1234 1234 1234 12",
4848
Bic = "BICABCDE",
49-
Name = "Bank Name"
49+
Name = "Bank Name",
50+
PaymentMeansTypeCode = "30",
5051
},
51-
PaymentMeansTypeCode = "30",
5252
PaymentTermsNote = "Zahlbar innerhalb 14 Tagen nach Erhalt der Rechnung.",
5353
PayableAmount = 119.0,
5454
InvoiceLines = [

src/pax.XRechnung.NET/AnnotatedDtos/BuyerAnnotationDto.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using System.ComponentModel.DataAnnotations;
21
using pax.XRechnung.NET.BaseDtos;
2+
using System.ComponentModel.DataAnnotations;
33

44
namespace pax.XRechnung.NET.AnnotatedDtos;
55
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
@@ -21,9 +21,12 @@ public class BuyerAnnotationDto : IPartyBaseDto
2121
public string Telefone { get; set; } = string.Empty;
2222
[Required]
2323
public string Email { get; set; } = string.Empty;
24-
[Required]
24+
[Required]
2525
public string RegistrationName { get; set; } = string.Empty;
2626
public string TaxId { get; set; } = string.Empty;
27+
public string? CompanyId { get; set; }
28+
[Required]
29+
public string BuyerReference { get; set; } = string.Empty;
2730
}
2831

2932
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member

src/pax.XRechnung.NET/AnnotatedDtos/DocumentReferenceAnnotationDto.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using System.ComponentModel.DataAnnotations;
21
using pax.XRechnung.NET.BaseDtos;
2+
using System.ComponentModel.DataAnnotations;
33

44
namespace pax.XRechnung.NET.AnnotatedDtos;
55

src/pax.XRechnung.NET/AnnotatedDtos/InvoiceAnnotationDto.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using System.ComponentModel.DataAnnotations;
21
using pax.XRechnung.NET.BaseDtos;
2+
using System.ComponentModel.DataAnnotations;
33

44
namespace pax.XRechnung.NET.AnnotatedDtos;
55

@@ -29,15 +29,11 @@ public class InvoiceAnnotationDto : IInvoiceBaseDto
2929
[Required]
3030
[ValidCode(CodeListType.Currency_Codes_3)]
3131
public string DocumentCurrencyCode { get; set; } = "EUR";
32-
[Required]
33-
public string BuyerReference { get; set; } = string.Empty;
3432
public List<DocumentReferenceAnnotationDto> AdditionalDocumentReferences { get; set; } = [];
3533
public SellerAnnotationDto SellerParty { get; set; } = new SellerAnnotationDto();
3634
public BuyerAnnotationDto BuyerParty { get; set; } = new BuyerAnnotationDto();
3735
public PaymentAnnotationDto PaymentMeans { get; set; } = new PaymentAnnotationDto();
38-
[Required]
39-
[ValidCode(CodeListType.UNTDID_4461_3)]
40-
public string PaymentMeansTypeCode { get; set; } = "30";
36+
4137
public string PaymentTermsNote { get; set; } = string.Empty;
4238
public double PayableAmount { get; set; }
4339
public List<InvoiceLineAnnotationDto> InvoiceLines { get; set; } = [];

src/pax.XRechnung.NET/AnnotatedDtos/InvoiceLineAnnotationDto.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using System.ComponentModel.DataAnnotations;
21
using pax.XRechnung.NET.BaseDtos;
2+
using System.ComponentModel.DataAnnotations;
33

44
namespace pax.XRechnung.NET.AnnotatedDtos;
55
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
@@ -19,7 +19,7 @@ public class InvoiceLineAnnotationDto : IInvoiceLineBaseDto
1919
public string? Description { get; set; } = string.Empty;
2020
[Required]
2121
public string Name { get; set; } = string.Empty;
22-
public double LineTotal => Math.Round(Math.Round(Quantity, 2) * Math.Round(UnitPrice, 2), 2);
22+
public double LineTotal => Math.Round(Quantity * UnitPrice, 2);
2323
}
2424

2525
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member

0 commit comments

Comments
 (0)