ZUGFeRD Service/WebService: Lesen/Auswertung neue Config-Schalter. GDPicture-Lizenz-Abfrage

This commit is contained in:
2025-01-10 10:50:35 +01:00
parent 64c9f14ec9
commit c6756e13aa
11 changed files with 103 additions and 52 deletions

View File

@@ -40,6 +40,9 @@ namespace ZUGFeRDRESTService.Controllers
private bool _AllowXRechnung;
private bool _AllowZugferd2x;
private bool _AllowZugferd10;
private bool _AllowPeppolBISBill3x;
private string _GDPictureVersion;
public ValidationController(ILogging logging, IDatabase database, IConfiguration Config)
{
@@ -49,21 +52,22 @@ namespace ZUGFeRDRESTService.Controllers
_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
// - Zugferd files
// - Filesizes
ParseConfig(Config);
_database = database;
var oGDPictureKey = database.GetGDPictureKey();
var oPropertyMap = database.GetPropertyMap();
_zugferd = new ZUGFeRDInterface(_logConfig, oGDPictureKey, new ZugferdOptions()
{
AllowFacturX_Filename = _AllowFacturX,
AllowXRechnung_Filename = _AllowXRechnung,
AllowZugferd_1_0_Schema = _AllowZugferd10,
AllowZugferd_2_x_Schema = _AllowZugferd2x
AllowZugferd_2_x_Schema = _AllowZugferd2x,
AllowPeppol_3017_Schema = _AllowPeppolBISBill3x
});
_props = new PropertyValues(_logConfig);
@@ -115,6 +119,19 @@ namespace ZUGFeRDRESTService.Controllers
_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))
{
_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
List<string> oErrors = ex.ErrorType switch
var oErrors = new List<string>();
switch (ex.ErrorType)
{
// Errors contains the list of missing fields
ErrorType.MissingProperties => oPropertyResult.MissingProperties,
_ => new List<string>()
};
case ErrorType.MissingProperties:
oErrors.AddRange(from item in oPropertyResult.MissingProperties
select item.Description);
break;
default:
break;
}
_logger.Info($"Responding with message: [{oMessage}]");
return new ValidationResponse()