diff --git a/src/Common/Infrastructure/FeatureToggles.cs b/src/Common/Infrastructure/FeatureToggles.cs
index 0f966f26b..2c91dec41 100644
--- a/src/Common/Infrastructure/FeatureToggles.cs
+++ b/src/Common/Infrastructure/FeatureToggles.cs
@@ -212,6 +212,13 @@ public class CorrectDeregulationAddressToggle : IFeatureToggle
public CorrectDeregulationAddressToggle(bool featureEnabled) => FeatureEnabled = featureEnabled;
}
+ public class CorrectRemovalAddressToggle : IFeatureToggle
+ {
+ public bool FeatureEnabled { get; }
+
+ public CorrectRemovalAddressToggle(bool featureEnabled) => FeatureEnabled = featureEnabled;
+ }
+
public class ReaddressStreetNameAddressesToggle : IFeatureToggle
{
public bool FeatureEnabled { get; }
diff --git a/src/Public.Api/Address/BackOffice/AddressBackOfficerController-CorrectRemoval.cs b/src/Public.Api/Address/BackOffice/AddressBackOfficerController-CorrectRemoval.cs
new file mode 100644
index 000000000..d566546fb
--- /dev/null
+++ b/src/Public.Api/Address/BackOffice/AddressBackOfficerController-CorrectRemoval.cs
@@ -0,0 +1,92 @@
+namespace Public.Api.Address.BackOffice
+{
+ using System.Threading;
+ using System.Threading.Tasks;
+ using AddressRegistry.Api.Oslo.Address.Detail;
+ using Be.Vlaanderen.Basisregisters.Api.Exceptions;
+ using Common.Infrastructure;
+ using Common.Infrastructure.Extensions;
+ using Infrastructure;
+ using Infrastructure.Swagger;
+ using Microsoft.AspNetCore.Http;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Infrastructure;
+ using RestSharp;
+ using Swashbuckle.AspNetCore.Annotations;
+ using Swashbuckle.AspNetCore.Filters;
+ using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails;
+
+ public partial class AddressBackOfficeController
+ {
+ public const string CorrectRemovalRoute = "adressen/{objectId}/acties/corrigeren/verwijdering";
+
+ ///
+ /// Corrigeer de verwijdering van een adres (v2).
+ ///
+ /// Identificator van het adres.
+ ///
+ ///
+ ///
+ /// If-Match header met ETag van de laatst gekende versie van het adres (optioneel).
+ ///
+ /// Als het ticket succesvol is aangemaakt.
+ /// Als uw verzoek foutieve data bevat.
+ /// Als u niet geauthenticeerd bent om deze actie uit te voeren.
+ /// Als u niet beschikt over de correcte rechten om deze actie uit te voeren.
+ /// Als het adres niet gevonden kan worden.
+ /// Als het gevraagde formaat niet beschikbaar is.
+ /// Als de If-Match header niet overeenkomt met de laatste ETag.
+ /// Als het aantal requests per seconde de limiet overschreven heeft.
+ /// Als er een interne fout is opgetreden.
+ ///
+ [ApiOrder(ApiOrder.Address.Edit + 16)]
+ [ProducesResponseType(StatusCodes.Status202Accepted)]
+ [ProducesResponseType(typeof(Be.Vlaanderen.Basisregisters.BasicApiProblem.ValidationProblemDetails), StatusCodes.Status400BadRequest)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status403Forbidden)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status412PreconditionFailed)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status429TooManyRequests)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)]
+ [SwaggerResponseHeader(StatusCodes.Status202Accepted, "location", "string", "De URL van het aangemaakte ticket.")]
+ [SwaggerResponseHeader(StatusCodes.Status202Accepted, "x-correlation-id", "string", "Correlatie identificator van de response.")]
+ [SwaggerResponseExample(StatusCodes.Status400BadRequest, typeof(BadRequestResponseExamplesV2))]
+ [SwaggerResponseExample(StatusCodes.Status401Unauthorized, typeof(UnauthorizedOAuthResponseExamplesV2))]
+ [SwaggerResponseExample(StatusCodes.Status403Forbidden, typeof(ForbiddenOAuthResponseExamplesV2))]
+ [SwaggerResponseExample(StatusCodes.Status404NotFound, typeof(AddressNotFoundResponseExamples))]
+ [SwaggerResponseExample(StatusCodes.Status412PreconditionFailed, typeof(PreconditionFailedResponseExamplesV2))]
+ [SwaggerResponseExample(StatusCodes.Status429TooManyRequests, typeof(TooManyRequestsResponseExamplesV2))]
+ [SwaggerResponseExample(StatusCodes.Status500InternalServerError, typeof(InternalServerErrorResponseExamplesV2))]
+ [SwaggerOperation(Description = "Correctie van de verwijdering van een adres. Gekoppelde busnummers worden niet mee gecorrigeerd.")]
+ [HttpPost(CorrectRemovalRoute, Name = nameof(CorrectRemovalAddress))]
+ public async Task CorrectRemovalAddress(
+ [FromRoute] int objectId,
+ [FromServices] IActionContextAccessor actionContextAccessor,
+ [FromServices] ProblemDetailsHelper problemDetailsHelper,
+ [FromServices] CorrectRemovalAddressToggle featureToggle,
+ [FromHeader(Name = HeaderNames.IfMatch)] string? ifMatch,
+ CancellationToken cancellationToken = default)
+ {
+ if (!featureToggle.FeatureEnabled)
+ {
+ return NotFound();
+ }
+
+ var contentFormat = DetermineFormat(actionContextAccessor.ActionContext);
+
+ RestRequest BackendRequest() => new RestRequest(CorrectRemovalRoute, Method.Post)
+ .AddParameter("objectId", objectId, ParameterType.UrlSegment)
+ .AddHeaderIfMatch(ifMatch)
+ .AddHeaderAuthorization(actionContextAccessor);
+
+ var value = await GetFromBackendWithBadRequestAsync(
+ contentFormat.ContentType,
+ BackendRequest,
+ CreateDefaultHandleBadRequest(),
+ problemDetailsHelper,
+ cancellationToken: cancellationToken);
+
+ return new BackendResponseResult(value, BackendResponseResultOptions.ForBackOffice());
+ }
+ }
+}
diff --git a/src/Public.Api/Infrastructure/Configuration/FeatureToggleOptions.cs b/src/Public.Api/Infrastructure/Configuration/FeatureToggleOptions.cs
index 15b329226..cb7f5f401 100644
--- a/src/Public.Api/Infrastructure/Configuration/FeatureToggleOptions.cs
+++ b/src/Public.Api/Infrastructure/Configuration/FeatureToggleOptions.cs
@@ -36,6 +36,7 @@ public class FeatureToggleOptions
public bool CorrectRetirementAddress { get; set; }
public bool CorrectRegularizationAddress { get; set; }
public bool CorrectDeregulationAddress { get; set; }
+ public bool CorrectRemovalAddress { get; set; }
public bool ReaddressStreetNameAddresses { get; set; }
public bool PlanBuilding { get; set; }
diff --git a/src/Public.Api/Infrastructure/Startup.cs b/src/Public.Api/Infrastructure/Startup.cs
index ef8e9667b..c0b6b8643 100644
--- a/src/Public.Api/Infrastructure/Startup.cs
+++ b/src/Public.Api/Infrastructure/Startup.cs
@@ -364,6 +364,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
.AddSingleton(c => new CorrectRetirementAddressToggle(c.GetRequiredService>().Value.CorrectRetirementAddress))
.AddSingleton(c => new CorrectRegularizationAddressToggle(c.GetRequiredService>().Value.CorrectRegularizationAddress))
.AddSingleton(c => new CorrectDeregulationAddressToggle(c.GetRequiredService>().Value.CorrectDeregulationAddress))
+ .AddSingleton(c => new CorrectRemovalAddressToggle(c.GetRequiredService>().Value.CorrectRemovalAddress))
.AddSingleton(c => new ReaddressStreetNameAddressesToggle(c.GetRequiredService>().Value.ReaddressStreetNameAddresses))
.AddSingleton(c => new PlanBuildingToggle(c.GetRequiredService>().Value.PlanBuilding))
diff --git a/src/Public.Api/appsettings.json b/src/Public.Api/appsettings.json
index 33b4ca6ca..44dcc3350 100755
--- a/src/Public.Api/appsettings.json
+++ b/src/Public.Api/appsettings.json
@@ -441,6 +441,7 @@
"CorrectRetirementAddress": false,
"CorrectRegularizationAddress": false,
"CorrectDeregulationAddress": false,
+ "CorrectRemovalAddress": false,
"ReaddressStreetNameAddresses": false,
"PlanBuilding": false,