From 0b96880aa0d589da9424f816038c8fc9c11c1cf2 Mon Sep 17 00:00:00 2001
From: Stephanie Buadu <47737608+acn-sbuad@users.noreply.github.com>
Date: Mon, 22 Apr 2024 10:39:25 +0200
Subject: [PATCH] including ignorereservations when creating order in service
(#495)
* including ignorereservations when creating order in service
* force ignoreReservations value in constructor
* fixed test input
---
.../Models/Orders/NotificationOrder.cs | 4 ++--
src/Altinn.Notifications.Core/Services/OrderRequestService.cs | 3 ++-
.../Extensions/ServiceCollectionExtensions.cs | 2 +-
.../Notifications/OrdersController/OrdersControllerTests.cs | 3 ++-
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/Altinn.Notifications.Core/Models/Orders/NotificationOrder.cs b/src/Altinn.Notifications.Core/Models/Orders/NotificationOrder.cs
index cf5592bfd..e0058aad2 100644
--- a/src/Altinn.Notifications.Core/Models/Orders/NotificationOrder.cs
+++ b/src/Altinn.Notifications.Core/Models/Orders/NotificationOrder.cs
@@ -23,7 +23,7 @@ public class NotificationOrder : IBaseNotificationOrder
public NotificationChannel NotificationChannel { get; internal set; }
/// >
- public bool IgnoreReservation { get; set; }
+ public bool IgnoreReservation { get; internal set; }
/// >
public Creator Creator { get; internal set; }
@@ -53,7 +53,7 @@ public NotificationOrder(
Creator creator,
DateTime created,
List recipients,
- bool ignoreReservation = false)
+ bool ignoreReservation)
{
Id = id;
SendersReference = sendersReference;
diff --git a/src/Altinn.Notifications.Core/Services/OrderRequestService.cs b/src/Altinn.Notifications.Core/Services/OrderRequestService.cs
index 1494552e0..b23e664ce 100644
--- a/src/Altinn.Notifications.Core/Services/OrderRequestService.cs
+++ b/src/Altinn.Notifications.Core/Services/OrderRequestService.cs
@@ -61,7 +61,8 @@ public async Task RegisterNotificationOrder(No
orderRequest.NotificationChannel,
orderRequest.Creator,
created,
- orderRequest.Recipients);
+ orderRequest.Recipients,
+ orderRequest.IgnoreReservation);
NotificationOrder savedOrder = await _repository.Create(order);
diff --git a/src/Altinn.Notifications.Integrations/Extensions/ServiceCollectionExtensions.cs b/src/Altinn.Notifications.Integrations/Extensions/ServiceCollectionExtensions.cs
index da2f6b380..cade68686 100644
--- a/src/Altinn.Notifications.Integrations/Extensions/ServiceCollectionExtensions.cs
+++ b/src/Altinn.Notifications.Integrations/Extensions/ServiceCollectionExtensions.cs
@@ -45,7 +45,7 @@ public static void AddAltinnClients(this IServiceCollection services, IConfigura
{
_ = config.GetSection(nameof(PlatformSettings))
.Get()
- ?? throw new ArgumentNullException(nameof(config), "Required AltinnServiceSettings is missing from application configuration");
+ ?? throw new ArgumentNullException(nameof(config), "Required PlatformSettings is missing from application configuration");
services
.Configure(config.GetSection(nameof(PlatformSettings)))
diff --git a/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/OrdersControllerTests.cs b/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/OrdersControllerTests.cs
index da822e9d2..eb0ff39dc 100644
--- a/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/OrdersControllerTests.cs
+++ b/test/Altinn.Notifications.IntegrationTests/Notifications/OrdersController/OrdersControllerTests.cs
@@ -45,7 +45,8 @@ public OrdersControllerTests(IntegrationTestWebApplicationFactory());
+ new List(),
+ false);
_orderWithStatus = new(
Guid.NewGuid(),