All checks were successful
## What & why S-09b (#75, split from #10) — the **approval flow** that completes the walking skeleton. A behandelaar can now approve a submitted registration; the entry flips from `INGEDIEND` to `INGESCHREVEN` in the public register. Flow: `POST /registrations/{id}/approve` (domain) → ACL sets the zaak eindstatus (ZGW `/statussen`) → OpenZaak → NRC → event-subscriber → projection → openbaar. ## Changes (bottom-up, each red→green TDD) - **Domain** — `RegistrationStatus.Ingeschreven` + `Registration.Approve()` (guards: opened zaak, only from INGEDIEND); `ApproveRegistration` use case (idempotent) + temp `POST /registrations/{id}/approve` endpoint; `IAclClient.ApproveZaakAsync`. - **ACL** — resolves the zaaktype's **eindstatus** from the catalogus (`isEindstatus` / highest volgnummer) and POSTs a ZGW status; exposed as `POST /statussen`. Unit + real-OpenZaak integration test. - **Event-subscriber** — binds NRC `hoofdObject`, projects a `status`/`create` as `INGESCHREVEN` keyed on the zaak (updates the existing row), **without reading OpenZaak** (§8.1). Retains the ZGW `resource` in the log (new column + EF migration) so a rebuild reproduces the status. - **e2e** — extended: submit → public INGEDIEND → approve → public INGESCHREVEN. - **Docs** — ADR-0011 (the two non-obvious decisions + the walking-skeleton assumption) + demo note. ## Key decisions (see ADR-0011) - **ACL discovers the eindstatus** (chosen over injecting a statustype URL): no new config/seed plumbing, domain stays ZGW-ignorant. - **Any post-creation status-set ⇒ INGESCHREVEN**: in the walking skeleton the only status ever set after creation is the approval, and the subscriber may not read ZGW — documented to tighten when more transitions arrive (S-12+). ## Verification - All .NET unit suites green locally (domain 47, acl 11, event-subscriber 14, bff 16, acceptance 7); Release build + `dotnet format` clean. - No new compose config (the eindstatus-discovery approach avoided it). - The real-OpenZaak integration test (ACL status-set) and the full submit→approve→visible e2e run in CI `verify-stack` (live NRC→projection + selectielijst egress, not reproducible locally). closes #75 Reviewed-on: #77
40 lines
2.0 KiB
C#
40 lines
2.0 KiB
C#
namespace EventSubscriber.Application;
|
|
|
|
/// <summary>
|
|
/// An inbound NRC (Open Notificaties) notification, as Open Notificaties POSTs it to an
|
|
/// abonnement callback. Only the fields the projection needs are modelled; the full ZGW
|
|
/// "Notificatie" resource also carries <c>aanmaakdatum</c> and <c>kenmerken</c> which the
|
|
/// minimal projection ignores (bsn is deferred — see ADR-0008). For a <c>zaken</c>/<c>zaak</c>/<c>create</c>
|
|
/// notification <c>hoofdObject</c> and <c>resourceUrl</c> are both the created zaak's URL.
|
|
/// </summary>
|
|
public sealed record Notification(
|
|
string Kanaal,
|
|
string Resource,
|
|
string Actie,
|
|
Uri ResourceUrl,
|
|
Uri? HoofdObject = null)
|
|
{
|
|
/// <summary>A zaak being created — projected as INGEDIEND.</summary>
|
|
public bool IsZaakCreated =>
|
|
Kanaal == "zaken" && Resource == "zaak" && Actie == "create";
|
|
|
|
/// <summary>A status being set on a zaak — the approval, projected as INGESCHREVEN (S-09b). In the
|
|
/// walking skeleton the only status ever set after creation is the approval, and the subscriber may
|
|
/// not read OpenZaak (§8.1), so any status-create is taken as the approval.</summary>
|
|
public bool IsZaakStatusSet =>
|
|
Kanaal == "zaken" && Resource == "status" && Actie == "create";
|
|
|
|
/// <summary>The zaak UUID used as the projection key. For a status notification the resource URL is
|
|
/// the status, so the zaak comes from <c>hoofdObject</c> (which, for a zaak-create, equals the
|
|
/// resource URL) — see the NRC payload note.</summary>
|
|
public string ZaakId => (HoofdObject ?? ResourceUrl).Segments[^1].Trim('/');
|
|
|
|
/// <summary>
|
|
/// A deterministic dedup key. Open Notificaties carries no notification id and may
|
|
/// redeliver, so the key is derived from the immutable notification content: two
|
|
/// deliveries of the same zaak-create collapse to one. (NRC may also deliver
|
|
/// out of order; the projector tolerates that — order does not change the outcome.)
|
|
/// </summary>
|
|
public string IdempotencyKey => $"{Kanaal}:{Resource}:{Actie}:{ResourceUrl}";
|
|
}
|