Merge Commit

This commit is contained in:
Developer01 2025-01-21 18:07:37 +01:00
commit 54c94e11a6
13 changed files with 168 additions and 76 deletions

View File

@ -32,15 +32,18 @@ Partial Class Form1
Me.GroupBox2 = New System.Windows.Forms.GroupBox() Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.Button7 = New System.Windows.Forms.Button() Me.Button7 = New System.Windows.Forms.Button()
Me.GroupBox3 = New System.Windows.Forms.GroupBox() Me.GroupBox3 = New System.Windows.Forms.GroupBox()
Me.txtMD5Checksum = New System.Windows.Forms.TextBox()
Me.txtPropName = New System.Windows.Forms.TextBox() Me.txtPropName = New System.Windows.Forms.TextBox()
Me.GroupBox4 = New System.Windows.Forms.GroupBox() Me.GroupBox4 = New System.Windows.Forms.GroupBox()
Me.Button6 = New System.Windows.Forms.Button() Me.Button6 = New System.Windows.Forms.Button()
Me.FolderBrowserDialog1 = New System.Windows.Forms.FolderBrowserDialog() Me.FolderBrowserDialog1 = New System.Windows.Forms.FolderBrowserDialog()
Me.txtMD5Checksum = New System.Windows.Forms.TextBox() Me.GroupBox5 = New System.Windows.Forms.GroupBox()
Me.Button5 = New System.Windows.Forms.Button()
Me.GroupBox1.SuspendLayout() Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout() Me.GroupBox2.SuspendLayout()
Me.GroupBox3.SuspendLayout() Me.GroupBox3.SuspendLayout()
Me.GroupBox4.SuspendLayout() Me.GroupBox4.SuspendLayout()
Me.GroupBox5.SuspendLayout()
Me.SuspendLayout() Me.SuspendLayout()
' '
'OpenFileDialog1 'OpenFileDialog1
@ -64,7 +67,7 @@ Partial Class Form1
Me.ListBox1.FormattingEnabled = True Me.ListBox1.FormattingEnabled = True
Me.ListBox1.Location = New System.Drawing.Point(378, 8) Me.ListBox1.Location = New System.Drawing.Point(378, 8)
Me.ListBox1.Name = "ListBox1" Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(532, 472) Me.ListBox1.Size = New System.Drawing.Size(532, 602)
Me.ListBox1.TabIndex = 1 Me.ListBox1.TabIndex = 1
' '
'Button2 'Button2
@ -136,6 +139,15 @@ Partial Class Form1
Me.GroupBox3.TabStop = False Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "Open PDF and calculate Checksum" Me.GroupBox3.Text = "Open PDF and calculate Checksum"
' '
'txtMD5Checksum
'
Me.txtMD5Checksum.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.ZUGFeRDTest.My.MySettings.Default, "MD5Cheksum", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
Me.txtMD5Checksum.Location = New System.Drawing.Point(6, 49)
Me.txtMD5Checksum.Name = "txtMD5Checksum"
Me.txtMD5Checksum.Size = New System.Drawing.Size(348, 20)
Me.txtMD5Checksum.TabIndex = 5
Me.txtMD5Checksum.Text = Global.ZUGFeRDTest.My.MySettings.Default.MD5Cheksum
'
'txtPropName 'txtPropName
' '
Me.txtPropName.Location = New System.Drawing.Point(6, 48) Me.txtPropName.Location = New System.Drawing.Point(6, 48)
@ -163,20 +175,31 @@ Partial Class Form1
Me.Button6.Text = "Find and Extract XML Path Value" Me.Button6.Text = "Find and Extract XML Path Value"
Me.Button6.UseVisualStyleBackColor = True Me.Button6.UseVisualStyleBackColor = True
' '
'txtMD5Checksum 'GroupBox5
' '
Me.txtMD5Checksum.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.ZUGFeRDTest.My.MySettings.Default, "MD5Cheksum", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)) Me.GroupBox5.Controls.Add(Me.Button5)
Me.txtMD5Checksum.Location = New System.Drawing.Point(6, 49) Me.GroupBox5.Location = New System.Drawing.Point(12, 490)
Me.txtMD5Checksum.Name = "txtMD5Checksum" Me.GroupBox5.Name = "GroupBox5"
Me.txtMD5Checksum.Size = New System.Drawing.Size(348, 20) Me.GroupBox5.Size = New System.Drawing.Size(360, 122)
Me.txtMD5Checksum.TabIndex = 5 Me.GroupBox5.TabIndex = 12
Me.txtMD5Checksum.Text = Global.ZUGFeRDTest.My.MySettings.Default.MD5Cheksum Me.GroupBox5.TabStop = False
Me.GroupBox5.Text = "GroupBox5"
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(6, 19)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(221, 23)
Me.Button5.TabIndex = 11
Me.Button5.Text = "Write Binary to PDF"
Me.Button5.UseVisualStyleBackColor = True
' '
'Form1 'Form1
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(916, 492) Me.ClientSize = New System.Drawing.Size(916, 633)
Me.Controls.Add(Me.GroupBox5)
Me.Controls.Add(Me.GroupBox4) Me.Controls.Add(Me.GroupBox4)
Me.Controls.Add(Me.GroupBox3) Me.Controls.Add(Me.GroupBox3)
Me.Controls.Add(Me.GroupBox2) Me.Controls.Add(Me.GroupBox2)
@ -190,6 +213,7 @@ Partial Class Form1
Me.GroupBox3.PerformLayout() Me.GroupBox3.PerformLayout()
Me.GroupBox4.ResumeLayout(False) Me.GroupBox4.ResumeLayout(False)
Me.GroupBox4.PerformLayout() Me.GroupBox4.PerformLayout()
Me.GroupBox5.ResumeLayout(False)
Me.ResumeLayout(False) Me.ResumeLayout(False)
End Sub End Sub
@ -209,4 +233,6 @@ Partial Class Form1
Friend WithEvents Button6 As Button Friend WithEvents Button6 As Button
Friend WithEvents Button7 As Button Friend WithEvents Button7 As Button
Friend WithEvents FolderBrowserDialog1 As FolderBrowserDialog Friend WithEvents FolderBrowserDialog1 As FolderBrowserDialog
Friend WithEvents GroupBox5 As GroupBox
Friend WithEvents Button5 As Button
End Class End Class

File diff suppressed because one or more lines are too long

View File

@ -50,6 +50,10 @@
<OptionInfer>On</OptionInfer> <OptionInfer>On</OptionInfer>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="DigitalData.Modules.Config, Version=1.2.2.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Database, Version=2.3.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Database, Version=2.3.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath> <HintPath>..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>

View File

@ -2,23 +2,30 @@
Public Property Custom As New CustomConfig Public Property Custom As New CustomConfig
Public Property MSSQLConnectionString As String = "" Public Property MSSQLConnectionString As String = ""
Public Property MSSQLEmailOutAccountID As String = 1 Public Property MSSQLEmailOutAccountID As String = 1
Public Property PORTAL_NAME As String = "WISAG-Portal" Public Property PORTAL_NAME As String = "WISAG-Portal"
Public Property JobInterval As Integer = 10 Public Property JobInterval As Integer = 10
Public Property ExceptionEmailAddress As String = "wisag-flow@digitaldata.works" Public Property ExceptionEmailAddress As String = "wisag-flow@digitaldata.works"
Public Property Debug As Boolean = False Public Property Debug As Boolean = False
Public Property WatchDirectory As String = String.Empty Public Property WatchDirectory As String = String.Empty
Public Property SuccessDirectory As String = String.Empty
Public Property ErrorDirectory As String = String.Empty
Public Property OriginalEmailDirectory As String = String.Empty
Public Property RejectedEmailDirectory As String = String.Empty
Public Property AttachmentsSubDirectory As String = String.Empty
Public Property NonZugferdDirectory As String = String.Empty
Public Property SuccessDirectory As String = String.Empty
Public Property ErrorDirectory As String = String.Empty
Public Property OriginalEmailDirectory As String = String.Empty
Public Property RejectedEmailDirectory As String = String.Empty
Public Property AttachmentsSubDirectory As String = String.Empty
Public Property NonZugferdDirectory As String = String.Empty
Public Class CustomConfig Public Class CustomConfig
''' <summary> ''' <summary>
@ -49,9 +56,21 @@
''' </summary> ''' </summary>
Public Property RejectionTemplateId As Integer = 0 Public Property RejectionTemplateId As Integer = 0
''' <summary>
''' Enthält die Version des GDPicture Modules,
''' für das der Lizenzschlüssel aus TBDD_3RD_PARTY_MODULES
''' gelesen werden soll.
''' </summary>
Public Property GDPictureVersion As String = ""
Public Property AllowFacturX As Boolean = False Public Property AllowFacturX As Boolean = False
Public Property AllowXRechnung As Boolean = False Public Property AllowXRechnung As Boolean = False
Public Property AllowZugferd10 As Boolean = True Public Property AllowZugferd10 As Boolean = True
Public Property AllowZugferd2x As Boolean = True Public Property AllowZugferd2x As Boolean = True
Public Property AllowPeppolBISBill3x As Boolean = False
End Class End Class
End Class End Class

View File

@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")> <Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Digital Data")> <Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("DDZUGFeRDService")> <Assembly: AssemblyProduct("DDZUGFeRDService")>
<Assembly: AssemblyCopyright("Copyright © 2024")> <Assembly: AssemblyCopyright("Copyright © 2025")>
<Assembly: AssemblyTrademark("2.8.6.0")> <Assembly: AssemblyTrademark("2.8.8.0")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.8.6.0")> <Assembly: AssemblyVersion("2.8.8.0")>
<Assembly: AssemblyFileVersion("2.8.6.0")> <Assembly: AssemblyFileVersion("2.8.8.0")>

View File

@ -52,7 +52,9 @@ Public Class ThreadRunner
.AllowXRechnung = _config.Config.Custom.AllowXRechnung, .AllowXRechnung = _config.Config.Custom.AllowXRechnung,
.AllowZugferd10 = _config.Config.Custom.AllowZugferd10, .AllowZugferd10 = _config.Config.Custom.AllowZugferd10,
.AllowZugferd2x = _config.Config.Custom.AllowZugferd2x, .AllowZugferd2x = _config.Config.Custom.AllowZugferd2x,
.RejectionTemplateId = _config.Config.Custom.RejectionTemplateId .AllowPeppolBISBill3x = _config.Config.Custom.AllowPeppolBISBill3x,
.RejectionTemplateId = _config.Config.Custom.RejectionTemplateId,
.GDPictureVersion = _config.Config.Custom.GDPictureVersion
} }
oArgs = LoadFolderConfig(oArgs) oArgs = LoadFolderConfig(oArgs)
@ -64,6 +66,7 @@ Public Class ThreadRunner
_logger.Debug("MaxAttachmentSizeInMegaBytes: [{0}]", oArgs.MaxAttachmentSizeInMegaBytes) _logger.Debug("MaxAttachmentSizeInMegaBytes: [{0}]", oArgs.MaxAttachmentSizeInMegaBytes)
_logger.Debug("MinFileAgeInMinutes: [{0}]", oArgs.MinFileAgeInMinutes) _logger.Debug("MinFileAgeInMinutes: [{0}]", oArgs.MinFileAgeInMinutes)
_logger.Debug("RejectionTemplateId: [{0}]", oArgs.RejectionTemplateId) _logger.Debug("RejectionTemplateId: [{0}]", oArgs.RejectionTemplateId)
_logger.Debug("GDPictureVersion: [{0}]", oArgs.GDPictureVersion)
_jobArguments = oArgs _jobArguments = oArgs

View File

@ -3,19 +3,30 @@
public class Config public class Config
{ {
public string Name { get; set; } public string Name { get; set; }
public string LogPath { get; set; } public string LogPath { get; set; }
public string MSSQLConnectionString { get; set; } public string MSSQLConnectionString { get; set; }
public string MaxFileSizeInMegabytes { get; set; } public string MaxFileSizeInMegabytes { get; set; }
public string GDPictureVersion { get; set; }
public ZugferdConfig Zugferd { get; set; } public ZugferdConfig Zugferd { get; set; }
} }
public class ZugferdConfig public class ZugferdConfig
{ {
public bool AllowFacturX { get; set; } = false; public bool AllowFacturX { get; set; } = false;
public bool AllowXRechnung { get; set; } = false; public bool AllowXRechnung { get; set; } = false;
public bool AllowZugferd10 { get; set; } = true; public bool AllowZugferd10 { get; set; } = true;
public bool AllowZugferd2x { get; set; } = true; public bool AllowZugferd2x { get; set; } = true;
public bool AllowPeppolBISBill3x { get; set; } = false;
} }
} }

View File

@ -40,6 +40,9 @@ namespace ZUGFeRDRESTService.Controllers
private bool _AllowXRechnung; private bool _AllowXRechnung;
private bool _AllowZugferd2x; private bool _AllowZugferd2x;
private bool _AllowZugferd10; private bool _AllowZugferd10;
private bool _AllowPeppolBISBill3x;
private string _GDPictureVersion;
public ValidationController(ILogging logging, IDatabase database, IConfiguration Config) public ValidationController(ILogging logging, IDatabase database, IConfiguration Config)
{ {
@ -49,21 +52,22 @@ namespace ZUGFeRDRESTService.Controllers
_logger.Debug("Validation Controller initializing"); _logger.Debug("Validation Controller initializing");
_database = database;
var oGDPictureKey = database.GetGDPictureKey();
var oPropertyMap = database.GetPropertyMap();
// Read config file and assign all option flags related to // Read config file and assign all option flags related to
// - Zugferd files // - Zugferd files
// - Filesizes // - Filesizes
ParseConfig(Config); ParseConfig(Config);
_database = database;
var oGDPictureKey = database.GetGDPictureKey();
var oPropertyMap = database.GetPropertyMap();
_zugferd = new ZUGFeRDInterface(_logConfig, oGDPictureKey, new ZugferdOptions() _zugferd = new ZUGFeRDInterface(_logConfig, oGDPictureKey, new ZugferdOptions()
{ {
AllowFacturX_Filename = _AllowFacturX, AllowFacturX_Filename = _AllowFacturX,
AllowXRechnung_Filename = _AllowXRechnung, AllowXRechnung_Filename = _AllowXRechnung,
AllowZugferd_1_0_Schema = _AllowZugferd10, AllowZugferd_1_0_Schema = _AllowZugferd10,
AllowZugferd_2_x_Schema = _AllowZugferd2x AllowZugferd_2_x_Schema = _AllowZugferd2x,
AllowPeppol_3017_Schema = _AllowPeppolBISBill3x
}); });
_props = new PropertyValues(_logConfig); _props = new PropertyValues(_logConfig);
@ -115,6 +119,19 @@ namespace ZUGFeRDRESTService.Controllers
_AllowZugferd10 = true; _AllowZugferd10 = true;
} }
if (!bool.TryParse(oZugferdConfig["AllowPeppolBISBill3x"], out _AllowPeppolBISBill3x))
{
_logger.Info("Configuration AllowPeppolBISBill3x was not set. Using default value [{0}]", false);
_AllowPeppolBISBill3x = false;
}
_GDPictureVersion = oAppConfig["GDPictureVersion"];
if (string.IsNullOrEmpty(_GDPictureVersion))
{
_logger.Info("Configuration GDPictureVersion was not set. Using default value [string.Empty]");
_GDPictureVersion = string.Empty;
}
if (!int.TryParse(oAppConfig["MaxFileSizeInMegabytes"], out _MaxFileSizeInMegabytes)) if (!int.TryParse(oAppConfig["MaxFileSizeInMegabytes"], out _MaxFileSizeInMegabytes))
{ {
_logger.Info("Configuration MaxFileSizeInMegabytes was not set. Using default value [{0}]", MAX_FILE_SIZE_DEFAULT); _logger.Info("Configuration MaxFileSizeInMegabytes was not set. Using default value [{0}]", MAX_FILE_SIZE_DEFAULT);
@ -238,12 +255,17 @@ namespace ZUGFeRDRESTService.Controllers
}; };
// Determine if any errors should be sent in the response // Determine if any errors should be sent in the response
List<string> oErrors = ex.ErrorType switch var oErrors = new List<string>();
switch (ex.ErrorType)
{ {
// Errors contains the list of missing fields case ErrorType.MissingProperties:
ErrorType.MissingProperties => oPropertyResult.MissingProperties, oErrors.AddRange(from item in oPropertyResult.MissingProperties
_ => new List<string>() select item.Description);
}; break;
default:
break;
}
_logger.Info($"Responding with message: [{oMessage}]"); _logger.Info($"Responding with message: [{oMessage}]");
return new ValidationResponse() return new ValidationResponse()

View File

@ -1,14 +1,10 @@
using System; using DigitalData.Modules.Database;
using DigitalData.Modules.Interfaces;
using DigitalData.Modules.Config;
using Microsoft.Extensions.Configuration;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Data.SqlClient; using DigitalData.Modules.Logging;
using System.Linq;
using System.Threading.Tasks;
using DigitalData.Modules.Database;
using DigitalData.Modules.Interfaces;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
namespace ZUGFeRDRESTService namespace ZUGFeRDRESTService
{ {
@ -18,6 +14,11 @@ namespace ZUGFeRDRESTService
private string _gdPictureKey = null; private string _gdPictureKey = null;
private Dictionary<string, XmlItemProperty> _propertyMap = null; private Dictionary<string, XmlItemProperty> _propertyMap = null;
private LogConfig _logConfig = null;
private string _connString;
private string _GDPictureVersion;
private const string QUERY_GET_GDPICTURE_KEY = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'"; private const string QUERY_GET_GDPICTURE_KEY = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'";
private const string QUERY_GET_PROPERTY_MAP = "SELECT * FROM TBDD_ZUGFERD_XML_ITEMS WHERE ACTIVE = 1 ORDER BY XML_PATH"; private const string QUERY_GET_PROPERTY_MAP = "SELECT * FROM TBDD_ZUGFERD_XML_ITEMS WHERE ACTIVE = 1 ORDER BY XML_PATH";
@ -25,12 +26,14 @@ namespace ZUGFeRDRESTService
public Database(ILogging Logging, IConfiguration Config) public Database(ILogging Logging, IConfiguration Config)
{ {
var oLogConfig = Logging.LogConfig; _logConfig = Logging.LogConfig;
var oLogger = Logging.LogConfig.GetLogger(); var oLogger = Logging.LogConfig.GetLogger();
var oAppConfig = Config.GetSection("Config"); var oAppConfig = Config.GetSection("Config");
_connString = oAppConfig["MSSQLConnectionString"];
_GDPictureVersion = oAppConfig["GDPictureVersion"];
oLogger.Debug("Establishing MSSQL Database connection.."); oLogger.Debug("Establishing MSSQL Database connection..");
MSSQL = new MSSQLServer(oLogConfig, oAppConfig["MSSQLConnectionString"]); MSSQL = new MSSQLServer(_logConfig, _connString);
oLogger.Debug("MSSQL Connection: [{0}]", MSSQL.CurrentConnectionString); oLogger.Debug("MSSQL Connection: [{0}]", MSSQL.CurrentConnectionString);
@ -39,8 +42,7 @@ namespace ZUGFeRDRESTService
public string GetGDPictureKey() public string GetGDPictureKey()
{ {
if (_gdPictureKey == null) _gdPictureKey = ConfigDbFunct.GetProductLicense("GDPICTURE", _GDPictureVersion, _logConfig, _connString);
_gdPictureKey = MSSQL.GetScalarValue(QUERY_GET_GDPICTURE_KEY).ToString();
return _gdPictureKey; return _gdPictureKey;
} }

View File

@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ZUGFeRDRESTService namespace ZUGFeRDRESTService
{ {

View File

@ -1,14 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog.Web;
using DigitalData.Modules.Logging;
using System.Reflection;
namespace ZUGFeRDRESTService namespace ZUGFeRDRESTService
{ {

View File

@ -1,15 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using System;
namespace ZUGFeRDRESTService namespace ZUGFeRDRESTService
{ {

View File

@ -22,8 +22,10 @@
"AllowZugferd10": true, "AllowZugferd10": true,
"AllowZugferd2x": false, "AllowZugferd2x": false,
"AllowFacturX": false, "AllowFacturX": false,
"AllowXRechnung": false "AllowXRechnung": false,
"AllowPeppolBISBill3x": false
}, },
"MaxFileSizeInMegabytes": 25 "GDPictureVersion": "",
"MaxFileSizeInMegabytes": 25
} }
} }