feat(domain): pass the registrationId to the ACL as the zaak reference (refs #78)
OpenZaakWorker forwards registration.Id to IAclClient.OpenZaakAsync so the zaak's identificatie equals the reference the citizen sees on the submit confirmation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,12 +15,13 @@ public class AclHttpClientTests
|
||||
var client = Client(capture.Responds(HttpStatusCode.OK,
|
||||
"""{"zaakUrl":"http://openzaak/zaken/api/v1/zaken/abc"}"""));
|
||||
|
||||
var url = await client.OpenZaakAsync("123456782");
|
||||
var url = await client.OpenZaakAsync("123456782", "reg-42");
|
||||
|
||||
Assert.Equal("http://openzaak/zaken/api/v1/zaken/abc", url.ToString());
|
||||
Assert.Equal(HttpMethod.Post, capture.Seen!.Method);
|
||||
Assert.Equal("http://acl/zaken", capture.Seen.RequestUri!.ToString());
|
||||
Assert.Contains("\"bsn\":\"123456782\"", capture.Body);
|
||||
Assert.Contains("\"reference\":\"reg-42\"", capture.Body);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -29,7 +30,7 @@ public class AclHttpClientTests
|
||||
var capture = new RequestCapture();
|
||||
var client = Client(capture.Responds(HttpStatusCode.BadGateway));
|
||||
|
||||
await Assert.ThrowsAsync<HttpRequestException>(() => client.OpenZaakAsync("123456782"));
|
||||
await Assert.ThrowsAsync<HttpRequestException>(() => client.OpenZaakAsync("123456782", "reg-1"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -38,7 +39,7 @@ public class AclHttpClientTests
|
||||
var capture = new RequestCapture();
|
||||
var client = Client(capture.Responds(HttpStatusCode.OK, "null"));
|
||||
|
||||
var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => client.OpenZaakAsync("123456782"));
|
||||
var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => client.OpenZaakAsync("123456782", "reg-1"));
|
||||
Assert.Contains("empty", ex.Message, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,15 +50,17 @@ internal sealed class FakeAclClient(Uri? zaakUrl = null) : IAclClient
|
||||
private readonly Uri _zaakUrl = zaakUrl ?? DefaultZaakUrl;
|
||||
|
||||
public string? OpenedForBsn { get; private set; }
|
||||
public string? OpenedWithReference { get; private set; }
|
||||
public int CallCount { get; private set; }
|
||||
|
||||
public Uri? ApprovedZaakUrl { get; private set; }
|
||||
public int ApproveCallCount { get; private set; }
|
||||
|
||||
public Task<Uri> OpenZaakAsync(string bsn, CancellationToken ct = default)
|
||||
public Task<Uri> OpenZaakAsync(string bsn, string reference, CancellationToken ct = default)
|
||||
{
|
||||
CallCount++;
|
||||
OpenedForBsn = bsn;
|
||||
OpenedWithReference = reference;
|
||||
return Task.FromResult(_zaakUrl);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ public class OpenZaakWorkerTests
|
||||
|
||||
Assert.Equal(FakeAclClient.DefaultZaakUrl, zaakUrl);
|
||||
Assert.Equal("123456782", acl.OpenedForBsn);
|
||||
// The registration's own id is handed to the ACL as the zaak reference (identificatie),
|
||||
// so the openbaar register can show the reference the zorgprofessional received (#78).
|
||||
Assert.Equal(registration.Id.ToString(), acl.OpenedWithReference);
|
||||
var saved = await store.GetAsync(registration.Id);
|
||||
Assert.Equal(FakeAclClient.DefaultZaakUrl, saved!.ZaakUrl);
|
||||
Assert.Equal(1, store.SaveCount);
|
||||
|
||||
Reference in New Issue
Block a user