diff --git a/Documentation/OMC - Documentation.md b/Documentation/OMC - Documentation.md index c872348d..ce68d290 100644 --- a/Documentation/OMC - Documentation.md +++ b/Documentation/OMC - Documentation.md @@ -1,6 +1,6 @@

OMC Documentation

-v.1.12.2 +v.1.12.3 © 2023-2024, Worth Systems. diff --git a/EventsHandler/Api/EventsHandler/Constants/DefaultValues.cs b/EventsHandler/Api/EventsHandler/Constants/DefaultValues.cs index 35bfd23f..791dacbd 100644 --- a/EventsHandler/Api/EventsHandler/Constants/DefaultValues.cs +++ b/EventsHandler/Api/EventsHandler/Constants/DefaultValues.cs @@ -12,7 +12,7 @@ internal static class ApiController { internal const string Route = "[controller]"; - internal const string Version = "1.122"; + internal const string Version = "1.123"; } #endregion diff --git a/EventsHandler/Api/EventsHandler/Dockerfile b/EventsHandler/Api/EventsHandler/Dockerfile index fd81f4b5..54f3cea3 100644 --- a/EventsHandler/Api/EventsHandler/Dockerfile +++ b/EventsHandler/Api/EventsHandler/Dockerfile @@ -1,11 +1,11 @@ #See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. -FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src COPY ["EventsHandler/Api/EventsHandler/EventsHandler.csproj", "EventsHandler/Api/EventsHandler/"] RUN dotnet restore "EventsHandler/Api/EventsHandler/EventsHandler.csproj" diff --git a/EventsHandler/Api/EventsHandler/Extensions/DateTimeExtensions.cs b/EventsHandler/Api/EventsHandler/Extensions/DateTimeExtensions.cs index e5a002b2..9029db8b 100644 --- a/EventsHandler/Api/EventsHandler/Extensions/DateTimeExtensions.cs +++ b/EventsHandler/Api/EventsHandler/Extensions/DateTimeExtensions.cs @@ -11,6 +11,7 @@ internal static class DateTimeExtensions { private static readonly TimeZoneInfo s_cetTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time"); private static readonly CultureInfo s_dutchCulture = new("nl-NL"); + private const string DutchDateFormat = "dd-MM-yyyy"; /// /// Converts the given into a representation of the local (Dutch) date. @@ -18,7 +19,7 @@ internal static class DateTimeExtensions /// The source date time. /// /// The representation of a date in the following format: - /// 2024-09-15 + /// 15-09-2024 /// internal static string ConvertToDutchDateString(this DateTime dateTime) { @@ -29,7 +30,21 @@ internal static string ConvertToDutchDateString(this DateTime dateTime) } // Formatting the date and time - return dateTime.ToString("yyyy-MM-dd", s_dutchCulture); + return dateTime.ToString(DutchDateFormat, s_dutchCulture); + } + + /// + /// Converts the given into a representation of the local (Dutch) date. + /// + /// The source date. + /// + /// The representation of a date in the following format: + /// 15-09-2024 + /// + internal static string ConvertToDutchDateString(this DateOnly date) + { + // Formatting the date and time + return date.ToString(DutchDateFormat, s_dutchCulture); } } } \ No newline at end of file diff --git a/EventsHandler/Api/EventsHandler/Services/DataProcessing/Strategy/Implementations/DecisionMadeScenario.cs b/EventsHandler/Api/EventsHandler/Services/DataProcessing/Strategy/Implementations/DecisionMadeScenario.cs index e3b783b3..f6ae99ae 100644 --- a/EventsHandler/Api/EventsHandler/Services/DataProcessing/Strategy/Implementations/DecisionMadeScenario.cs +++ b/EventsHandler/Api/EventsHandler/Services/DataProcessing/Strategy/Implementations/DecisionMadeScenario.cs @@ -141,15 +141,15 @@ protected override Dictionary GetEmailPersonalization(CommonPart s_emailPersonalization["klant.achternaam"] = partyData.Surname; s_emailPersonalization["besluit.identificatie"] = this._decision.Identification; - s_emailPersonalization["besluit.datum"] = $"{this._decision.Date:O}"; + s_emailPersonalization["besluit.datum"] = $"{this._decision.Date.ConvertToDutchDateString()}"; s_emailPersonalization["besluit.toelichting"] = this._decision.Explanation; s_emailPersonalization["besluit.bestuursorgaan"] = this._decision.GoverningBody; - s_emailPersonalization["besluit.ingangsdatum"] = $"{this._decision.EffectiveDate:O}"; - s_emailPersonalization["besluit.vervaldatum"] = $"{this._decision.ExpirationDate:O}"; + s_emailPersonalization["besluit.ingangsdatum"] = $"{this._decision.EffectiveDate.ConvertToDutchDateString()}"; + s_emailPersonalization["besluit.vervaldatum"] = $"{this._decision.ExpirationDate.ConvertToDutchDateString()}"; s_emailPersonalization["besluit.vervalreden"] = this._decision.ExpirationReason; - s_emailPersonalization["besluit.publicatiedatum"] = $"{this._decision.PublicationDate:O}"; - s_emailPersonalization["besluit.verzenddatum"] = $"{this._decision.ShippingDate:O}"; - s_emailPersonalization["besluit.uiterlijkereactiedatum"] = $"{this._decision.ResponseDate:O}"; + s_emailPersonalization["besluit.publicatiedatum"] = $"{this._decision.PublicationDate.ConvertToDutchDateString()}"; + s_emailPersonalization["besluit.verzenddatum"] = $"{this._decision.ShippingDate.ConvertToDutchDateString()}"; + s_emailPersonalization["besluit.uiterlijkereactiedatum"] = $"{this._decision.ResponseDate.ConvertToDutchDateString()}"; s_emailPersonalization["besluittype.omschrijving"] = this._decisionType.Name; s_emailPersonalization["besluittype.omschrijvingGeneriek"] = this._decisionType.Description; @@ -160,7 +160,7 @@ protected override Dictionary GetEmailPersonalization(CommonPart s_emailPersonalization["zaak.identificatie"] = this._case.Identification; s_emailPersonalization["zaak.omschrijving"] = this._case.Name; - s_emailPersonalization["zaak.registratiedatum"] = $"{this._case.RegistrationDate:O}"; + s_emailPersonalization["zaak.registratiedatum"] = $"{this._case.RegistrationDate.ConvertToDutchDateString()}"; s_emailPersonalization["zaaktype.omschrijving"] = this._caseType.Name; s_emailPersonalization["zaaktype.omschrijvingGeneriek"] = this._caseType.Description; @@ -284,7 +284,7 @@ private string PrepareDataJson(string subject, string body, string commaSeparate return $"\"onderwerp\":\"{(subject.IsNullOrEmpty() ? missing : subject)}\"," + $"\"berichtTekst\":\"{(body.IsNullOrEmpty() ? missing : body)}\"," + - $"\"publicatiedatum\":\"{this._decision.PublicationDate:O}\"," + + $"\"publicatiedatum\":\"{this._decision.PublicationDate.ConvertToDutchDateString()}\"," + $"\"referentie\":\"{this._decisionResource.DecisionUri}\"," + $"\"handelingsperspectief\":\"informatie verstrekken\"," + $"\"geopend\":false," + diff --git a/EventsHandler/Api/EventsHandler/Services/DataProcessing/Strategy/Implementations/TaskAssignedScenario.cs b/EventsHandler/Api/EventsHandler/Services/DataProcessing/Strategy/Implementations/TaskAssignedScenario.cs index 0f98a7ef..e6786b39 100644 --- a/EventsHandler/Api/EventsHandler/Services/DataProcessing/Strategy/Implementations/TaskAssignedScenario.cs +++ b/EventsHandler/Api/EventsHandler/Services/DataProcessing/Strategy/Implementations/TaskAssignedScenario.cs @@ -124,7 +124,7 @@ protected override Dictionary GetEmailPersonalization(CommonPart private static string GetFormattedExpirationDate(bool isValid, DateTime expirationDate) { return isValid - ? expirationDate.ConvertToDutchDateString() // 2001-01-01 + ? expirationDate.ConvertToDutchDateString() // 01-01-2001 : DefaultValues.Models.DefaultEnumValueName; } diff --git a/EventsHandler/Api/EventsHandler/Services/Serialization/Converters/DateTimeJsonConverter.cs b/EventsHandler/Api/EventsHandler/Services/Serialization/Converters/DateTimeJsonConverter.cs index 7a805970..306d6b0c 100644 --- a/EventsHandler/Api/EventsHandler/Services/Serialization/Converters/DateTimeJsonConverter.cs +++ b/EventsHandler/Api/EventsHandler/Services/Serialization/Converters/DateTimeJsonConverter.cs @@ -1,5 +1,6 @@ // © 2024, Worth Systems. +using EventsHandler.Extensions; using System.Text.Json; using System.Text.Json.Serialization; @@ -26,7 +27,7 @@ public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, Jso /// public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) { - writer.WriteStringValue($"{value:O}"); + writer.WriteStringValue($"{value.ConvertToDutchDateString()}"); } } } \ No newline at end of file diff --git a/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Extensions/DateTimeExtensionsTests.cs b/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Extensions/DateTimeExtensionsTests.cs index 49ebe8ad..e288235f 100644 --- a/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Extensions/DateTimeExtensionsTests.cs +++ b/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Extensions/DateTimeExtensionsTests.cs @@ -19,9 +19,9 @@ public void ConvertToDutchDateString_LocalDutchDateTime_ReturnsExpectedLocalDutc private static IEnumerable<(string Id, DateTime DateTime, string ExpectedResult)> GetDateTimeCases() { - yield return ("#1", DateTime.MinValue, "0001-01-01"); - yield return ("#2", DateTime.MaxValue, "9999-12-31"); - yield return ("#3", new DateTime(2024, 09, 19, 14, 10, 00), "2024-09-19"); + yield return ("#1", DateTime.MinValue, "01-01-0001"); + yield return ("#2", DateTime.MaxValue, "31-12-9999"); + yield return ("#3", new DateTime(2024, 09, 19, 14, 10, 00), "19-09-2024"); } [Test] @@ -34,7 +34,20 @@ public void ConvertToDutchDateString_UtcDateTime_ReturnsExpectedLocalDutchDateSt string actualResult = utcTime.ConvertToDutchDateString(); // Assert - Assert.That(actualResult, Is.EqualTo("2025-01-01")); // NOTE: UTC time is behind the local Dutch time + Assert.That(actualResult, Is.EqualTo("01-01-2025")); // NOTE: UTC time is behind the local Dutch time + } + + [Test] + public void ConvertToDutchDateString_DateOnly_ReturnsExpectedLocalDutchDateString() + { + // Arrange + DateOnly date = new(2024, 12, 31); + + // Act + string actualResult = date.ConvertToDutchDateString(); + + // Assert + Assert.That(actualResult, Is.EqualTo("31-12-2024")); } } } \ No newline at end of file diff --git a/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/DataProcessing/Strategy/Implementations/DecisionMadeScenarioTests.cs b/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/DataProcessing/Strategy/Implementations/DecisionMadeScenarioTests.cs index ac213c53..c67fdcc0 100644 --- a/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/DataProcessing/Strategy/Implementations/DecisionMadeScenarioTests.cs +++ b/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/DataProcessing/Strategy/Implementations/DecisionMadeScenarioTests.cs @@ -303,15 +303,15 @@ public async Task GetPersonalizationAsync_ReturnsExpectedPersonalization(Distrib $"\"klant.voorvoegselAchternaam\":null," + $"\"klant.achternaam\":\"Chan\"," + $"\"besluit.identificatie\":\"\"," + - $"\"besluit.datum\":\"0001-01-01\"," + + $"\"besluit.datum\":\"01-01-0001\"," + $"\"besluit.toelichting\":\"\"," + $"\"besluit.bestuursorgaan\":\"\"," + - $"\"besluit.ingangsdatum\":\"0001-01-01\"," + - $"\"besluit.vervaldatum\":\"0001-01-01\"," + + $"\"besluit.ingangsdatum\":\"01-01-0001\"," + + $"\"besluit.vervaldatum\":\"01-01-0001\"," + $"\"besluit.vervalreden\":\"\"," + - $"\"besluit.publicatiedatum\":\"0001-01-01\"," + - $"\"besluit.verzenddatum\":\"0001-01-01\"," + - $"\"besluit.uiterlijkereactiedatum\":\"0001-01-01\"," + + $"\"besluit.publicatiedatum\":\"01-01-0001\"," + + $"\"besluit.verzenddatum\":\"01-01-0001\"," + + $"\"besluit.uiterlijkereactiedatum\":\"01-01-0001\"," + $"\"besluittype.omschrijving\":\"\"," + $"\"besluittype.omschrijvingGeneriek\":\"\"," + $"\"besluittype.besluitcategorie\":\"\"," + @@ -320,7 +320,7 @@ public async Task GetPersonalizationAsync_ReturnsExpectedPersonalization(Distrib $"\"besluittype.toelichting\":\"\"," + $"\"zaak.identificatie\":\"ZAAK-2024-00000000001\"," + $"\"zaak.omschrijving\":\"\"," + - $"\"zaak.registratiedatum\":\"0001-01-01\"," + + $"\"zaak.registratiedatum\":\"01-01-0001\"," + $"\"zaaktype.omschrijving\":\"\"," + $"\"zaaktype.omschrijvingGeneriek\":\"\"" + $"}}"; diff --git a/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/DataProcessing/Strategy/Implementations/TaskAssignedScenarioTests.cs b/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/DataProcessing/Strategy/Implementations/TaskAssignedScenarioTests.cs index 9f577457..853772d7 100644 --- a/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/DataProcessing/Strategy/Implementations/TaskAssignedScenarioTests.cs +++ b/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/DataProcessing/Strategy/Implementations/TaskAssignedScenarioTests.cs @@ -323,14 +323,14 @@ public async Task TryGetDataAsync_ValidTaskType_Open_AssignedToEntity_Whiteliste #region GetPersonalizationAsync() // Person [TestCase(DistributionChannels.Email, IdTypes.Bsn, false, "-", "no")] - [TestCase(DistributionChannels.Email, IdTypes.Bsn, true, "2024-07-24", "yes")] + [TestCase(DistributionChannels.Email, IdTypes.Bsn, true, "24-07-2024", "yes")] [TestCase(DistributionChannels.Sms, IdTypes.Bsn, false, "-", "no")] - [TestCase(DistributionChannels.Sms, IdTypes.Bsn, true, "2024-07-24", "yes")] + [TestCase(DistributionChannels.Sms, IdTypes.Bsn, true, "24-07-2024", "yes")] // Organization [TestCase(DistributionChannels.Email, IdTypes.Kvk, false, "-", "no")] - [TestCase(DistributionChannels.Email, IdTypes.Kvk, true, "2024-07-24", "yes")] + [TestCase(DistributionChannels.Email, IdTypes.Kvk, true, "24-07-2024", "yes")] [TestCase(DistributionChannels.Sms, IdTypes.Kvk, false, "-", "no")] - [TestCase(DistributionChannels.Sms, IdTypes.Kvk, true, "2024-07-24", "yes")] + [TestCase(DistributionChannels.Sms, IdTypes.Kvk, true, "24-07-2024", "yes")] public async Task GetPersonalizationAsync_SpecificDateTime_ReturnsExpectedPersonalization( DistributionChannels testDistributionChannel, IdTypes idType, bool isExpirationDateGiven, string testExpirationDate, string isExpirationDateGivenText) { diff --git a/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/Serialization/SpecificSerializerTests.cs b/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/Serialization/SpecificSerializerTests.cs index 59f758b6..35514f08 100644 --- a/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/Serialization/SpecificSerializerTests.cs +++ b/EventsHandler/Tests/UnitTests/EventsHandler.Tests/Services/Serialization/SpecificSerializerTests.cs @@ -1,6 +1,7 @@ // © 2024, Worth Systems. using EventsHandler.Constants; +using EventsHandler.Extensions; using EventsHandler.Mapping.Enums.NotificatieApi; using EventsHandler.Mapping.Enums.Objecten; using EventsHandler.Mapping.Enums.Objecten.vNijmegen; @@ -608,7 +609,7 @@ public void Serialize_TaskObject_Hague_Default_ReturnsExpectedJson(bool isDefaul $"\"zaak\":\"{DefaultValues.Models.EmptyUri}\"," + $"\"title\":\"\"," + $"\"status\":\"-\"," + - $"\"verloopdatum\":\"{DateTime.MinValue:O}\"," + + $"\"verloopdatum\":\"{DateTime.MinValue.ConvertToDutchDateString()}\"," + $"\"identificatie\":{{" + $"\"type\":\"-\"," + $"\"value\":\"\"" + @@ -638,7 +639,7 @@ public void Serialize_TaskObject_Nijmegen_Default_ReturnsExpectedJson(bool isDef $"\"uuid\":\"{Guid.Empty}\"," + $"\"registratie\":\"-\"" + $"}}," + - $"\"verloopdatum\":\"{DateTime.MinValue:O}\"," + + $"\"verloopdatum\":\"{DateTime.MinValue.ConvertToDutchDateString()}\"," + $"\"identificatie\":{{" + $"\"type\":\"-\"," + $"\"value\":\"\"" + @@ -684,7 +685,7 @@ public void Serialize_TaskObject_Hague_ValidModel_ReturnsExpectedJson() $"\"zaak\":\"{TestUrl}\"," + $"\"title\":\"{TestString}\"," + $"\"status\":\"open\"," + - $"\"verloopdatum\":\"2024-09-05T15:45:30.0000000Z\"," + + $"\"verloopdatum\":\"05-09-2024\"," + $"\"identificatie\":{{" + $"\"type\":\"bsn\"," + $"\"value\":\"{TestString}\"" + @@ -737,7 +738,7 @@ public void Serialize_TaskObject_Nijmegen_ValidModel_ReturnsExpectedJson() $"\"uuid\":\"{Guid.Empty}\"," + $"\"registratie\":\"zaak\"" + $"}}," + - $"\"verloopdatum\":\"2024-09-05T15:45:30.0000000Z\"," + + $"\"verloopdatum\":\"05-09-2024\"," + $"\"identificatie\":{{" + $"\"type\":\"bsn\"," + $"\"value\":\"{TestString}\"" + @@ -839,7 +840,7 @@ public void Serialize_CommonTaskData_ReturnsExpectedJson() $"\"CaseId\":\"{testGuid}\"," + $"\"Title\":\"text\"," + $"\"Status\":\"open\"," + - $"\"ExpirationDate\":\"9999-12-31T23:59:59.9999999\"," + + $"\"ExpirationDate\":\"31-12-9999\"," + $"\"Identification\":{{" + $"\"type\":\"bsn\"," + $"\"value\":\"123456789\"" +