diff --git a/Interfaces/ZUGFeRDInterface.vb b/Interfaces/ZUGFeRDInterface.vb
index 0b6a59da..e717bff1 100644
--- a/Interfaces/ZUGFeRDInterface.vb
+++ b/Interfaces/ZUGFeRDInterface.vb
@@ -64,6 +64,7 @@ Public Class ZUGFeRDInterface
Public ElementName As String
Public ElementValue As String
Public ErrorMessage As String
+ Public ErrorMessageDE As String
End Class
'''
diff --git a/Interfaces/ZUGFeRDInterface/Validator.vb b/Interfaces/ZUGFeRDInterface/Validator.vb
index bef87b34..2016f0cc 100644
--- a/Interfaces/ZUGFeRDInterface/Validator.vb
+++ b/Interfaces/ZUGFeRDInterface/Validator.vb
@@ -28,7 +28,8 @@ Public Class Validator
pResult.ValidationErrors.Add(New ZugferdValidationError() With {
.ElementName = oNode.Name.LocalName,
.ElementValue = oNode.Value,
- .ErrorMessage = "Value could not be parsed as Decimal"
+ .ErrorMessage = "Value could not be parsed as Decimal.",
+ .ErrorMessageDE = "Der Wert konnte nicht in eine Dezimalzahl umgewandelt werden."
})
End If
Next
@@ -50,7 +51,8 @@ Public Class Validator
pResult.ValidationErrors.Add(New ZugferdValidationError() With {
.ElementName = oNode.Name.LocalName,
.ElementValue = oNode.Value,
- .ErrorMessage = "Invalid CurrencyCode. Only 3-Character codes are allowed."
+ .ErrorMessage = "Invalid CurrencyCode. Only 3-Character codes are allowed.",
+ .ErrorMessageDE = "Ungültiger Währungscode. Es sind nur 3-stellige Codes erlaubt."
})
End If
Next
@@ -76,7 +78,8 @@ Public Class Validator
pResult.ValidationErrors.Add(New ZugferdValidationError() With {
.ElementName = oNode.Name.LocalName,
.ElementValue = oCurrencyID,
- .ErrorMessage = "Invalid currencyID. Only 3-Character codes or empty values are allowed."
+ .ErrorMessage = "Invalid currencyID. Only 3-Character codes or empty values are allowed.",
+ .ErrorMessageDE = "Ungültige WährungsID. Es sind nur 3-Zeichen lange Codes oder ein leerer Wert erlaubt."
})
End If
Next
diff --git a/Jobs/ZUGFeRD/EmailFunctions.vb b/Jobs/ZUGFeRD/EmailFunctions.vb
index 2569c01c..8cdc51f8 100644
--- a/Jobs/ZUGFeRD/EmailFunctions.vb
+++ b/Jobs/ZUGFeRD/EmailFunctions.vb
@@ -33,8 +33,11 @@ Namespace ZUGFeRD
''' Name of the Portal from config
''' ID for E-Mail-Template from config
''' Error Code
+ ''' Zusätzlicher Parameter 1
+ ''' Zusätzlicher Parameter 2
Public Sub AddToEmailQueueMSSQL(pMessageId As String, pBodyText As String, pEmailData As EmailData, pSourceProcedure As String,
- pEmailAccountId As Integer, pNamePortal As String, pTemplateId As Integer, pErrorCode As ErrorCode)
+ pEmailAccountId As Integer, pNamePortal As String, pTemplateId As Integer, pErrorCode As ErrorCode,
+ pParameter1 As String, pParameter2 As String)
Dim useLegacyMethod = True
Dim oErrorCode As String = String.Empty
@@ -89,7 +92,7 @@ Namespace ZUGFeRD
AddToEmailQueueMSSQL(pMessageId, pBodyText, pEmailData, pSourceProcedure, pEmailAccountId, pNamePortal)
Else
_logger.Debug("New rejection mail logic is configured!")
- AddToEmailQueueMSSQL(pMessageId, pTemplateId, oErrorCode, pEmailAccountId)
+ AddToEmailQueueMSSQL(pMessageId, pTemplateId, oErrorCode, pEmailAccountId, pParameter1, pParameter2)
End If
End Sub
@@ -103,7 +106,18 @@ Namespace ZUGFeRD
''' GUID for TBDD_EMAIL_TEMPLATE from config
''' ErrorID (TBDD_GUI_LANGUAGE_PHRASE)
''' Sending profile from config
- Private Sub AddToEmailQueueMSSQL(pMessageId As String, pTemplateId As Integer, pErrorCode As String, pEmailAccountId As Integer)
+ ''' Zusätzlicher Parameter 1
+ ''' Zusätzlicher Parameter 2
+ Private Sub AddToEmailQueueMSSQL(pMessageId As String, pTemplateId As Integer, pErrorCode As String, pEmailAccountId As Integer,
+ pParameter1 As String, pParameter2 As String)
+
+ If pParameter1.IsNullOrEmpty Then
+ pParameter1 = ""
+ End If
+
+ If pParameter2.IsNullOrEmpty Then
+ pParameter2 = ""
+ End If
Try
Dim oExecute = $"EXECUTE dbo.PRDD_SEND_REJECTION_MAIL
@@ -113,6 +127,8 @@ Namespace ZUGFeRD
, 'ZUGFeRD Service'
, {pTemplateId}
, '{pErrorCode}'
+ , '{pParameter1}'
+ , '{pParameter2}'
, 77
"
If _mssql.ExecuteNonQuery(oExecute) = False Then
diff --git a/Jobs/ZUGFeRD/EmailStrings.vb b/Jobs/ZUGFeRD/EmailStrings.vb
index f5daa1bd..5c0d9406 100644
--- a/Jobs/ZUGFeRD/EmailStrings.vb
+++ b/Jobs/ZUGFeRD/EmailStrings.vb
@@ -9,25 +9,34 @@
Public Const EMAIL_SUBJECT_REJECTED = "@NAME_ZUGFERD_PORTAL: Beleg abgelehnt"
Public Const EMAIL_SUBJECT_EXCEPTION = "@NAME_ZUGFERD_PORTAL: Unbehandelte Ausnahme"
+ ' OutOfMemoryException = 20009
+ ' UnhandledException = 20010
+ ' FileMoveException = 200011
Public Const EMAIL_UNHANDLED_EXCEPTION = """
Beim Verarbeiten der Datei mit der Message ID '{0}' ist ein schwerer Fehler aufgetreten.
Fehlerbeschreibung: {1}
{2}
"""
+ ' MissingValueException = 20007
Public Const EMAIL_MISSINGPROPERTIES_1 = "Die angehängte Datei entspricht nicht dem WISAG ZUGFeRD-Format: {0}
"
- Public Const EMAIL_MISSINGPROPERTIES_2 = "Die folgenden Eigenschaften wurden als ERFORDERLICH eingestuft, wurden aber nicht gefunden:
"
+ Public Const EMAIL_MISSINGPROPERTIES_2 = "Die folgenden Eigenschaften wurden als ERFORDERLICH eingestuft, wurden aber nicht gefunden:
"
+ ' MD5HashException = 20002
Public Const EMAIL_MD5_ERROR = "Die von Ihnen gesendete Rechnung ({0}) wurde bereits von unserem System verarbeitet.
"
+ ' ValidationException = 20001
Public Const EMAIL_VALIDATION_ERROR = "
Die von Ihnen gesendete Rechnung hat die ZUGFeRD Validierung nicht bestanden.
Die folgenden Felder sind nicht korrekt:
"
+ ' TooMuchFerdsException = 20005
Public Const EMAIL_TOO_MUCH_FERDS = "In Ihrer Email ({0}) sind mehr als ein ZUGFeRD Dokument enthalten. Bitte prüfen Sie die Rechnungsanhänge. Nur eine Rechnung darf das ZUGFeRD-Format enthalten.
"
+ ' NoFerdsException = 20006
Public Const EMAIL_NO_FERDS = "Ihre Email ({0}) enthielt keine ZUGFeRD-Dokumente.
"
+ ' FileSizeLimitReachedException = 20008
Public Const EMAIL_FILE_SIZE_REACHED = "
Die von Ihnen gesendete Rechnung oder einer der Rechnungs-Anhänge überschreitet die erlaubte Größe von {0} MB.
Die folgende Datei hat die erlaubte Größe überschritten:
"
+ ' InvalidFerdException = 20004
Public Const EMAIL_INVALID_DOCUMENT = "
Ihre Email ({0}) enthielt ein ZUGFeRD Dokument, welches aber inkorrekt formatiert wurde.
Mögliche Gründe für ein inkorrektes Format sind:
"
+ ' UnsupportedFerdException = 20003
Public Const EMAIL_UNSUPPORTED_DOCUMENT = "
Ihre Email ({0}) enthielt ein ZUGFeRD Format ({1}), welches zur Zeit noch nicht freigeschaltet ist.
"
diff --git a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb
index 3d4c7e27..f1650f3b 100644
--- a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb
+++ b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb
@@ -222,13 +222,15 @@ Public Class ImportZUGFeRDFiles
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, oMessage)
Dim oErrorList As String = ""
+ Dim oErrorListDE As String = ""
For Each oError In oErrors
- oErrorList += $"Element '{oError.ElementName}' mit Wert '{oError.ElementValue}': {oError.ErrorMessage}"
+ oErrorList += $"Element '{oError.ElementName}' with Value '{oError.ElementValue}': {oError.ErrorMessage}"
+ oErrorListDE += $"Element '{oError.ElementName}' mit Wert '{oError.ElementValue}': {oError.ErrorMessageDE}"
Next
Dim oBody = String.Format(EmailStrings.EMAIL_VALIDATION_ERROR, oErrorList)
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
- _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "ValidationException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.ValidationException)
+ _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "ValidationException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.ValidationException, oErrorListDE, oErrorList)
AddRejectedState(oMessageId, "ValidationException", "Die Rechnungsvalidierung ist fehlgeschlagen!", "", oSQLTransaction)
Catch ex As MD5HashException
@@ -241,7 +243,7 @@ Public Class ImportZUGFeRDFiles
Dim oBody = String.Format(EmailStrings.EMAIL_MD5_ERROR, ex.FileName)
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
- _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MD5HashException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MD5HashException)
+ _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MD5HashException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MD5HashException, ex.FileName, "")
AddRejectedState(oMessageId, "MD5HashException", "Die gesendete Rechnung wurde bereits verarbeitet!", "", oSQLTransaction)
Catch ex As UnsupportedFerdException
@@ -254,7 +256,7 @@ Public Class ImportZUGFeRDFiles
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
Dim oBody As String = String.Format(EmailStrings.EMAIL_UNSUPPORTED_DOCUMENT, oEmailData.Subject, ex.XmlFile)
- _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "UnsupportedFerdException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnsupportedFerdException)
+ _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "UnsupportedFerdException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnsupportedFerdException, ex.XmlFile, "")
AddRejectedState(oMessageId, "UnsupportedFerdException", "Nicht unterstütztes Datenformat", "", oSQLTransaction)
Catch ex As InvalidFerdException
@@ -267,7 +269,7 @@ Public Class ImportZUGFeRDFiles
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
Dim oBody = String.Format(EmailStrings.EMAIL_INVALID_DOCUMENT, oEmailData.Subject)
- _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "InvalidFerdException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.InvalidFerdException)
+ _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "InvalidFerdException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.InvalidFerdException, "", "")
AddRejectedState(oMessageId, "InvalidFerdException", "Inkorrekte Formate", "", oSQLTransaction)
Catch ex As TooMuchFerdsException
@@ -278,7 +280,7 @@ Public Class ImportZUGFeRDFiles
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
Dim oBody = String.Format(EmailStrings.EMAIL_TOO_MUCH_FERDS, oEmailData.Subject)
- _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "TooMuchFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.TooMuchFerdsException)
+ _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "TooMuchFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.TooMuchFerdsException, "", "")
AddRejectedState(oMessageId, "TooMuchFerdsException", "Email enthielt mehr als ein ZUGFeRD-Dokument", "", oSQLTransaction)
Catch ex As NoFerdsException
@@ -289,7 +291,7 @@ Public Class ImportZUGFeRDFiles
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
Dim oBody = String.Format(EmailStrings.EMAIL_NO_FERDS, oEmailData.Subject)
- _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "NoFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.NoFerdsException)
+ _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "NoFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.NoFerdsException, "", "")
AddRejectedState(oMessageId, "NoFerdsException", " Email enthielt keine ZUGFeRD-Dokumente", "", oSQLTransaction)
Catch ex As MissingValueException
@@ -302,9 +304,14 @@ Public Class ImportZUGFeRDFiles
_history.Update_HistoryEntry(oMessageId, oMD5CheckSum, $"REJECTED - Missing Required Properties: [{oMessage}]")
+ Dim oMissingFieldList As String = ""
+ For Each oMissingFieldDescription In ex.MissingProperties
+ oMissingFieldList += $"{oMissingFieldDescription}"
+ Next
+
Dim oBody = _email.CreateBodyForMissingProperties(ex.File.Name, ex.MissingProperties)
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
- _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MissingValueException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MissingValueException)
+ _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MissingValueException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MissingValueException, ex.File.Name, oMissingFieldList)
AddRejectedState(oMessageId, "MissingValueException", "Es fehlten ZugferdSpezifikationen", oMessage, oSQLTransaction)
Catch ex As FileSizeLimitReachedException
@@ -322,7 +329,7 @@ Public Class ImportZUGFeRDFiles
Dim oBody = String.Format(EmailStrings.EMAIL_FILE_SIZE_REACHED, oArgs.MaxAttachmentSizeInMegaBytes, oFileWithoutMessageId)
- _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "FileSizeLimitReachedException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.FileSizeLimitReachedException)
+ _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "FileSizeLimitReachedException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.FileSizeLimitReachedException, oArgs.MaxAttachmentSizeInMegaBytes, oFileWithoutMessageId)
AddRejectedState(oMessageId, "FileSizeLimitReachedException", "Erlaubte Dateigröße überschritten", "", oSQLTransaction)
@@ -341,7 +348,7 @@ Public Class ImportZUGFeRDFiles
.From = oArgs.ExceptionEmailAddress,
.Subject = $"OutOfMemoryException im ZUGFeRD-Parser @ {oMessageId}"
}
- _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "OutOfMemoryException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.OutOfMemoryException)
+ _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "OutOfMemoryException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
' Rollback Transaction
oSQLTransaction.Rollback()
@@ -360,7 +367,7 @@ Public Class ImportZUGFeRDFiles
.From = oArgs.ExceptionEmailAddress,
.Subject = $"UnhandledException im ZUGFeRD-Parser @ {oMessageId}"
}
- _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "UnhandledException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException)
+ _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "UnhandledException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
' Rollback Transaction
oSQLTransaction.Rollback()
@@ -386,7 +393,7 @@ Public Class ImportZUGFeRDFiles
.From = oArgs.ExceptionEmailAddress,
.Subject = $"FileMoveException im ZUGFeRD-Parser @ {oMessageId}"
}
- _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "FileMoveException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.FileMoveException)
+ _email.AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "FileMoveException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
_logger.Warn("Could not move files!")
_logger.Error(ex)