feat(acl,domain): cancel the ZGW zaak on document-timeout expiry (S-10c, closes #106) #109
@@ -31,6 +31,14 @@ public sealed class ExpireRegistrationWorker(IRegistrationStore store, IAclClien
|
||||
if (registration.Status is not (RegistrationStatus.Ingediend or RegistrationStatus.InBehandeling))
|
||||
return;
|
||||
|
||||
// Cancel the ZGW zaak before advancing the aggregate (mirrors the approval path): if the ACL
|
||||
// call fails it throws, the aggregate stays open, and the job is redelivered (§8.6) — rather
|
||||
// than leaving the aggregate VERLOPEN while the zaak stays open. The status guard above stops a
|
||||
// redelivered job from cancelling the zaak twice (a second resultaat would be a 400). A
|
||||
// registration expired before its zaak was opened has nothing to cancel.
|
||||
if (registration.ZaakUrl is not null)
|
||||
await acl.CancelZaakAsync(registration.ZaakUrl, ct);
|
||||
|
||||
registration.Expire();
|
||||
await store.SaveAsync(registration, ct);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user