Interfaces: Include Zugferd2.2/Factur-X 1.0 in schemata, allow additional filenames for Factur-X invoices

This commit is contained in:
Jonathan Jenne 2022-03-28 11:37:50 +02:00
parent ef7683a587
commit 5d722f70e3
3 changed files with 4444 additions and 13 deletions

View File

@ -123,25 +123,26 @@ Public Class ZUGFeRDInterface
Dim oXmlDocument As XPathDocument
If Results Is Nothing Then
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.")
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei, weil die Attachments nicht gelesen werden konnten.")
End If
If Results.Count = 0 Then
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.")
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei, weil sie keine Attachments enthält.")
End If
Dim oFound As Boolean = False
Dim oFoundResult As PDFEmbeds.EmbeddedFile = Nothing
Dim oValidFilenames As New List(Of String) From {
PDFEmbeds.ZUGFERD_XML_FILENAME.ToUpper,
PDFEmbeds.FACTUR_X_XML_FILENAME_DE.ToUpper,
PDFEmbeds.FACTUR_X_XML_FILENAME_FR.ToUpper
}
For Each oResult In Results
If oResult.FileName.ToUpper() = PDFEmbeds.ZUGFERD_XML_FILENAME.ToUpper() Then
oFound = True
oFoundResult = oResult
End If
Next
' Find the first file which filename matches the valid filenames for embedded invoice files
Dim oFoundResult As PDFEmbeds.EmbeddedFile = Results.
Where(Function(result) oValidFilenames.Contains(result.FileName.ToUpper)).
FirstOrDefault()
If Not oFound Then
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei.")
If oFoundResult Is Nothing Then
Throw New ZUGFeRDExecption(ErrorType.NoZugferd, "Datei ist keine ZUGFeRD Datei, weil die zugferd-invoice.xml nicht gefunden wurde.")
End If
Try
@ -170,7 +171,8 @@ Public Class ZUGFeRDInterface
Dim oTypes As New List(Of Type) From {
GetType(ZUGFeRD.Version1_0.CrossIndustryDocumentType),
GetType(ZUGFeRD.Version2_0.CrossIndustryInvoiceType),
GetType(ZUGFeRD.Version2_1_1.CrossIndustryInvoiceType)
GetType(ZUGFeRD.Version2_1_1.CrossIndustryInvoiceType),
GetType(ZUGFeRD.Version2_2_FacturX.CrossIndustryInvoiceType)
}
For Each oType In oTypes

View File

@ -7,6 +7,8 @@ Public Class PDFEmbeds
Private ReadOnly Logger As Logger
Public Const ZUGFERD_XML_FILENAME = "ZUGFeRD-invoice.xml"
Public Const FACTUR_X_XML_FILENAME_FR = "factur-x.xml"
Public Const FACTUR_X_XML_FILENAME_DE = "xrechnung.xml"
Public Class EmbeddedFile
Public FileName As String