## S-10c · Close the ZGW zaak on document-timeout expiry (closes #106) Completes the S-10a/S-10b boundary flagged in ADR-0017: when a registration's 30-day document term lapses, the domain now cancels the **ZGW zaak** as well as marking the aggregate `Verlopen`, so OpenZaak and the register no longer diverge. ### What it does On expiry the `ExpireRegistrationWorker` calls the ACL to set the zaak to a distinct, non-terminal **`Geannuleerd`** status with a **`Vervallen`** resultaat (vs the approval `Afgehandeld` + `Geregistreerd`), resolved **by omschrijving** in the ACL — the ACL-first ordering mirrors approval so a failed ZGW call leaves the job for redelivery rather than diverging the two. **Path:** Flowable P30D timer → `RegistratieVerlopen` job → domain `ExpireRegistrationWorker` → ACL `POST /annuleringen` → ZGW `resultaten` + `statussen` (Geannuleerd) → aggregate `Verlopen`. ### Layers touched (each red→green) - **ACL gateway** — `SetZaakToCancellationStatusAsync` (Geannuleerd + Vervallen by name); approval now resolves its `Geregistreerd` resultaat by name too (a second resultaattype now exists). - **ACL service/API** — `AclService.CancelZaakAsync` + `POST /annuleringen`. - **Domain** — `IAclClient.CancelZaakAsync` + client; expiry worker cancels the zaak before advancing to `Verlopen`, guarded against redelivery double-cancel. - **Seed** — non-terminal `Geannuleerd` statustype (volgnummer 2; `Afgehandeld` → 3) + `Vervallen` resultaattype, both idempotent by omschrijving and sharing the zaaktype's procestype. - **Verify/integration** — ACL↔OpenZaak integration test (live `Geannuleerd` + resultaat); `run-domain-check.sh` fires the real P30D timer and asserts the zaak reaches `Geannuleerd` end-to-end; BDD scenario asserts cancel-on-timeout vs untouched-when-in-time. - **Docs** — ADR-0019 (cancellation modelling decision), demo-script, BACKLOG. ### Design note (ADR-0019) ZGW allows only one eindstatus per zaaktype, so `Geannuleerd` is modelled as a **non-terminal** status (it records a cancellation status + resultaat but does not set `einddatum`). This follows the issue's explicit "distinct statustype + resultaat" outcome; the shared-eindstatus alternative is recorded in the ADR. ### Tests Unit + acceptance all green locally (Acl 38, Big 134, Acceptance 17, Bff 33, EventSubscriber 19). Integration + verify-stack run in CI (need live OpenZaak + selectielijst egress). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #109
This commit was merged in pull request #109.
This commit is contained in:
@@ -114,6 +114,19 @@ public sealed class OpenZaakFixture : IDisposable
|
||||
return fallback ?? throw new InvalidOperationException($"No statustypen for zaaktype {zaaktypeUrl}");
|
||||
}
|
||||
|
||||
/// <summary>Resolve a statustype by its omschrijving (e.g. the S-10c "Geannuleerd" cancellation status).</summary>
|
||||
public async Task<Uri> FindStatustypeByOmschrijvingAsync(Uri zaaktypeUrl, string omschrijving, CancellationToken ct = default)
|
||||
{
|
||||
var query = new Uri(BaseUrl,
|
||||
"/catalogi/api/v1/statustypen?status=alles&zaaktype=" + Uri.EscapeDataString(zaaktypeUrl.ToString()));
|
||||
var page = await GetJsonAsync(query, ct);
|
||||
foreach (var st in page.GetProperty("results").EnumerateArray())
|
||||
if (st.TryGetProperty("omschrijving", out var o) && o.GetString() == omschrijving)
|
||||
return new Uri(st.GetProperty("url").GetString()!);
|
||||
|
||||
throw new InvalidOperationException($"No '{omschrijving}' statustype for zaaktype {zaaktypeUrl}");
|
||||
}
|
||||
|
||||
// A ZGW (vng-api-common) HS256 JWT, mirroring the seed's client. Minted here
|
||||
// rather than reusing Acl.Infrastructure's internal minter to keep that internal.
|
||||
private string MintToken()
|
||||
|
||||
@@ -75,6 +75,39 @@ public sealed class OpenZaakGatewayIntegrationTests(OpenZaakFixture stack)
|
||||
Assert.Equal(eindstatustype.ToString(), status.GetProperty("statustype").GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Cancelling_a_zaak_records_the_geannuleerd_status_and_a_resultaat()
|
||||
{
|
||||
var zaaktype = await stack.FindPublishedBigZaaktypeAsync();
|
||||
Assert.True(zaaktype is not null,
|
||||
"No published BIG-REGISTRATIE zaaktype found in OpenZaak — bring the stack up and " +
|
||||
"seed it with OZ_PUBLISH=1 (`make integration` does this).");
|
||||
|
||||
var gateway = new OpenZaakGateway(stack.Http, stack.Options);
|
||||
var zaakUrl = await gateway.OpenZaakAsync(new ZaakRequest(
|
||||
Bronorganisatie: "517439943",
|
||||
VerantwoordelijkeOrganisatie: "517439943",
|
||||
Vertrouwelijkheidaanduiding: "openbaar",
|
||||
Zaaktype: zaaktype!,
|
||||
Startdatum: DateOnly.FromDateTime(DateTime.UtcNow),
|
||||
Identificatie: Guid.NewGuid().ToString()));
|
||||
|
||||
await gateway.SetZaakToCancellationStatusAsync(zaakUrl, zaaktype!, DateOnly.FromDateTime(DateTime.UtcNow));
|
||||
|
||||
// The zaak's current status is the Geannuleerd statustype — distinct from the approval eindstatus.
|
||||
var zaak = await stack.GetZaakAsync(zaakUrl);
|
||||
var statusUrl = zaak.GetProperty("status").GetString();
|
||||
Assert.False(string.IsNullOrEmpty(statusUrl), "the cancelled zaak has no current status");
|
||||
|
||||
var status = await stack.GetJsonAsync(new Uri(statusUrl!));
|
||||
var geannuleerd = await stack.FindStatustypeByOmschrijvingAsync(zaaktype!, "Geannuleerd");
|
||||
Assert.Equal(geannuleerd.ToString(), status.GetProperty("statustype").GetString());
|
||||
|
||||
// ...and a resultaat is recorded (OpenZaak requires it before a closing/terminal status).
|
||||
Assert.False(string.IsNullOrEmpty(zaak.GetProperty("resultaat").GetString()),
|
||||
"the cancelled zaak has no resultaat");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Storing_a_diploma_creates_a_real_informatieobject_related_to_the_zaak()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user