From 11ef26d8cc540145638c93ddefc7540bebe09f40 Mon Sep 17 00:00:00 2001 From: Niek Otten Date: Mon, 20 Jul 2026 09:42:07 +0200 Subject: [PATCH] feat(domain): Registration.Expire() lapses an open registration to Verlopen (refs #102) Adds the terminal Verlopen status and Expire(), reusing the RequireOpenForDecision guard so only an INGEDIEND/IN_BEHANDELING registration can lapse; idempotent once Verlopen. Co-Authored-By: Claude Opus 4.8 (1M context) --- services/domain/Big.Domain/Registration.cs | 20 +++++++++++++++++-- .../domain/Big.Domain/RegistrationStatus.cs | 4 ++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/services/domain/Big.Domain/Registration.cs b/services/domain/Big.Domain/Registration.cs index 51f20cf..a3b3503 100644 --- a/services/domain/Big.Domain/Registration.cs +++ b/services/domain/Big.Domain/Registration.cs @@ -133,8 +133,24 @@ public sealed class Registration Status = RegistrationStatus.Ingetrokken; } - // A decision (or withdrawal) is only valid while the registration is still open (INGEDIEND or - // IN_BEHANDELING). + /// + /// Expire the registration — the 30-day document-wait timer fired before the required documents + /// were supplied, so the registratie process cancels the case (S-10a). Allowed while it is still + /// open (INGEDIEND or IN_BEHANDELING) and needs no zaak; a decided (INGESCHREVEN/AFGEWEZEN) or + /// withdrawn (INGETROKKEN) registration can no longer expire. Re-expiring one already + /// is a no-op — the worker job may be redelivered (§8.6). + /// + public void Expire() + { + if (Status == RegistrationStatus.Verlopen) + return; + + RequireOpenForDecision(nameof(Expire)); + Status = RegistrationStatus.Verlopen; + } + + // A decision (or withdrawal, or expiry) is only valid while the registration is still open + // (INGEDIEND or IN_BEHANDELING). private void RequireOpenForDecision(string decision) { if (Status is not (RegistrationStatus.Ingediend or RegistrationStatus.InBehandeling)) diff --git a/services/domain/Big.Domain/RegistrationStatus.cs b/services/domain/Big.Domain/RegistrationStatus.cs index fccfac7..5e8a28c 100644 --- a/services/domain/Big.Domain/RegistrationStatus.cs +++ b/services/domain/Big.Domain/RegistrationStatus.cs @@ -21,4 +21,8 @@ public enum RegistrationStatus /// Withdrawn by the zorgprofessional before a decision (S-11). Terminal. Ingetrokken, + + /// Lapsed: the required documents were not supplied within the 30-day window, so the + /// registratie process cancelled the case (S-10a). Terminal. + Verlopen, }