test(workflow): start carries diploma origin as a process variable (S-13, refs #14)

Add DiplomaOrigin (Binnenlands/Buitenlands) to the Registration aggregate and
submit command, and thread it through the process-start port so the workflow's
DMN can route on it (ADR proposal #100). Failing Workflow Client test asserts the
diplomaOrigin start variable; the client takes the origin but does not emit it yet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-17 11:54:28 +02:00
parent 7bcbc726ce
commit 1969297c97
8 changed files with 69 additions and 17 deletions

View File

@@ -2,8 +2,10 @@ using Big.Domain;
namespace Big.Application;
/// <summary>A zorgprofessional's request to register, in domain language. No ZGW concepts.</summary>
public sealed record SubmitRegistrationCommand(string Bsn);
/// <summary>A zorgprofessional's request to register, in domain language. No ZGW concepts. The
/// diploma origin defaults to domestic (the DigiD path); a foreign (eIDAS) submission sets it to
/// <see cref="DiplomaOrigin.Buitenlands"/> so the workflow's DMN routes it through CBGV-advies (S-13).</summary>
public sealed record SubmitRegistrationCommand(string Bsn, DiplomaOrigin DiplomaOrigin = DiplomaOrigin.Binnenlands);
/// <summary>
/// The submit use case: create the <see cref="Registration"/> aggregate (INGEDIEND), persist it,
@@ -18,13 +20,14 @@ public sealed class SubmitRegistration(IRegistrationStore store, IWorkflowClient
{
ArgumentNullException.ThrowIfNull(command);
var registration = Registration.Submit(command.Bsn);
var registration = Registration.Submit(command.Bsn, command.DiplomaOrigin);
// Persist before starting the process so the worker can correlate the OpenZaakAanmaken
// job back to an aggregate that already exists (ADR-0009).
await store.SaveAsync(registration, ct);
var processInstanceId = await workflow.StartRegistrationProcessAsync(registration.Id, ct);
var processInstanceId = await workflow.StartRegistrationProcessAsync(
registration.Id, registration.DiplomaOrigin, ct);
registration.RecordProcessStarted(processInstanceId);
await store.SaveAsync(registration, ct);