ZUGFeRD: Improve logging for ZUGFeRD Service
This commit is contained in:
@@ -27,6 +27,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Public HISTORY_ID As Integer
|
||||
|
||||
' List of allowed extensions for PDF/A Attachments
|
||||
' This list should not contain xml so the zugferd xml file will be filtered out
|
||||
Private ReadOnly AllowedExtensions As List(Of String) = New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"}
|
||||
|
||||
Private ReadOnly _logger As Logger
|
||||
@@ -185,22 +186,23 @@ Public Class ImportZUGFeRDFiles
|
||||
Catch ex As ZUGFeRDExecption
|
||||
Select Case ex.ErrorType
|
||||
Case ZUGFeRDInterface.ErrorType.NoZugferd
|
||||
_logger.Warn("File is not a valid ZUGFeRD document! Skipping.")
|
||||
_logger.Warn("File [{0}] is not a valid ZUGFeRD document! Skipping.", oFile.Name)
|
||||
oEmailAttachmentFiles.Add(oFile)
|
||||
Continue For
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.NoValidZugferd
|
||||
_logger.Warn("File is an Incorrectly formatted ZUGFeRD document!")
|
||||
_logger.Warn("File [{0}] is an Incorrectly formatted ZUGFeRD document!", oFile.Name)
|
||||
Throw New InvalidFerdException()
|
||||
|
||||
Case Else
|
||||
_logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", oFile.FullName)
|
||||
_logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", oFile.Name)
|
||||
Throw ex
|
||||
End Select
|
||||
End Try
|
||||
|
||||
' Extract all attachments with the extensions specified in `AllowedExtensions`.
|
||||
' If you need to extract and use embedded xml files, you need to filter out the zugferd-invoice.xml yourself.
|
||||
' Right now the zugferd-invoice.xml is filtered out because `AllowedExtensions` does not contain `xml`.
|
||||
Dim oAttachments = oAttachmentExtractor.Extract(oFile.FullName, AllowedExtensions)
|
||||
If oAttachments Is Nothing Then
|
||||
_logger.Warn("Attachments for file [{0}] could not be extracted", oFile.FullName)
|
||||
|
||||
Reference in New Issue
Block a user