feat(acl,domain): cancel the ZGW zaak on document-timeout expiry (S-10c, closes #106) #109

Merged
not merged 11 commits from feat/106-close-zaak-on-timeout into main 2026-07-21 13:58:16 +00:00
2 changed files with 15 additions and 1 deletions
Showing only changes of commit c1e48c90e0 - Show all commits
@@ -14,6 +14,7 @@ Feature: Een documenttermijn laten verlopen
When the 30-day document timer fires When the 30-day document timer fires
And the document-timeout worker runs And the document-timeout worker runs
Then the registration is verlopen Then the registration is verlopen
And the zaak is cancelled in ZGW
Scenario: Tijdig aangeleverde documenten laten de registratie niet vervallen Scenario: Tijdig aangeleverde documenten laten de registratie niet vervallen
Given a registration parked at the WachtOpDocumenten task Given a registration parked at the WachtOpDocumenten task
@@ -21,3 +22,4 @@ Feature: Een documenttermijn laten verlopen
And the 30-day document timer fires And the 30-day document timer fires
And the document-timeout worker runs And the document-timeout worker runs
Then the registration is not verlopen Then the registration is not verlopen
And the zaak is not cancelled in ZGW
@@ -17,8 +17,11 @@ namespace Acceptance.Steps;
[Scope(Feature = "Een documenttermijn laten verlopen")] [Scope(Feature = "Een documenttermijn laten verlopen")]
public sealed class EenDocumentTermijnVerlopenSteps public sealed class EenDocumentTermijnVerlopenSteps
{ {
private static readonly Uri ZaakUrl = new("http://openzaak/zaken/api/v1/zaken/acc-timeout");
private readonly InMemoryDocumentTimeoutClient _flowable = new(); private readonly InMemoryDocumentTimeoutClient _flowable = new();
private readonly Support.InMemoryRegistrationStore _store = new(); private readonly Support.InMemoryRegistrationStore _store = new();
private readonly InMemoryAclClient _acl = new();
private Registration _registration = null!; private Registration _registration = null!;
private string _processInstanceId = ""; private string _processInstanceId = "";
@@ -26,6 +29,9 @@ public sealed class EenDocumentTermijnVerlopenSteps
public async Task GivenARegistrationParkedAtWachtOpDocumenten() public async Task GivenARegistrationParkedAtWachtOpDocumenten()
{ {
_registration = Registration.Submit("123456782"); _registration = Registration.Submit("123456782");
// By the time it parks at WachtOpDocumenten its zaak has been opened (OpenZaakAanmaken runs
// earlier), so a timeout has a zaak to cancel.
_registration.AttachZaak(ZaakUrl);
await _store.SaveAsync(_registration); await _store.SaveAsync(_registration);
_processInstanceId = _flowable.ParkWaitingForDocuments(_registration.Id); _processInstanceId = _flowable.ParkWaitingForDocuments(_registration.Id);
} }
@@ -39,7 +45,7 @@ public sealed class EenDocumentTermijnVerlopenSteps
[When("the document-timeout worker runs")] [When("the document-timeout worker runs")]
public async Task WhenTheTimeoutWorkerRuns() public async Task WhenTheTimeoutWorkerRuns()
=> await new RegistratieVerlopenProcessor( => await new RegistratieVerlopenProcessor(
_flowable, new ExpireRegistrationWorker(_store), _flowable, new ExpireRegistrationWorker(_store, _acl),
NullLogger<RegistratieVerlopenProcessor>.Instance).PumpOnceAsync(5); NullLogger<RegistratieVerlopenProcessor>.Instance).PumpOnceAsync(5);
[Then("the registration is verlopen")] [Then("the registration is verlopen")]
@@ -49,4 +55,10 @@ public sealed class EenDocumentTermijnVerlopenSteps
[Then("the registration is not verlopen")] [Then("the registration is not verlopen")]
public async Task ThenTheRegistrationIsNotVerlopen() public async Task ThenTheRegistrationIsNotVerlopen()
=> Assert.Equal(RegistrationStatus.Ingediend, (await _store.GetAsync(_registration.Id))!.Status); => Assert.Equal(RegistrationStatus.Ingediend, (await _store.GetAsync(_registration.Id))!.Status);
[Then("the zaak is cancelled in ZGW")]
public void ThenTheZaakIsCancelled() => Assert.Equal(ZaakUrl, _acl.CancelledZaakUrl);
[Then("the zaak is not cancelled in ZGW")]
public void ThenTheZaakIsNotCancelled() => Assert.Null(_acl.CancelledZaakUrl);
} }