Skip to content

AMCR-259 - Add "reason" and "confirm" cancellation screens & store cancelled state#45

Open
timabell wants to merge 10 commits into
mainfrom
AMCR-259-add-cancel-steps
Open

AMCR-259 - Add "reason" and "confirm" cancellation screens & store cancelled state#45
timabell wants to merge 10 commits into
mainfrom
AMCR-259-add-cancel-steps

Conversation

@timabell

@timabell timabell commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Add reason & cancellation pages to cancel certificate flow

  1. Replace the single-step cancel action with a reason page and a confirmation page
  2. Record the cancellation & reason through the waste-obligations API.

New flow is:

  1. GET /cancel/reason - display reason page
  2. POST /cancel/reason - submit and validate selected reason
  3. GET /cancel/check - redirects to viewing check page
  4. POST /cancel - perform the actual cancellation

Implemented tickets

Screenshots

direct scheme
shutter_20267-17_01 shutter_20267-17_02
shutter_20267-17_03 shutter_20267-17_04

timabell and others added 2 commits July 17, 2026 09:19
Replace the single-step cancel action with a reason page and a confirmation
page, and record the cancellation through the waste-obligations API.

New flow is:

1. GET  /cancel/reason  # display reason page
2. POST /cancel/reason  # submit and validate selected reason
3. GET  /cancel/check   # redirects to viewing check page
4. POST /cancel         # perform the actual cancellation

The selected reason is carried statelessly between the two steps — in the
confirmation URL (?reason=) and a hidden form field to follow REST and
ensure reliable behaviour when multiple browser tabs in use.

Remove `inline` style that was used to align button & link as they are now both links.

Based on prototype at https://github.com/defra-design/regulator-responsibility-prototype/blob/3839b9d2a40168799ee4b9fe93019a1d7e9e80d1/app/views/v3/certificates-of-compliance/main/cancel-certificate.njk

- https://eaflood.atlassian.net/browse/AMCR-259
- https://eaflood.atlassian.net/browse/AMCR-263

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
To make it clear during testing that that is not expected to work yet
and will be done in a follow-up ticket.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@timabell timabell changed the title AMCR 259 add cancel steps AMCR-259 - Add "reason" and "confirm" cancellation screens & store cancelled state Jul 17, 2026
Comment thread src/server/routes/certificatesOfCompliance/cancel/index.js
@timabell
timabell force-pushed the AMCR-259-add-cancel-steps branch from adaf307 to 8591a79 Compare July 17, 2026 12:01
timabell and others added 4 commits July 17, 2026 13:14
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
"compliance-schemes" and "Unknown organisation" each appeared 3+ times;
replace the uses with COMPLIANCE_SCHEMES / UNKNOWN_ORGANISATION constants.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collapse the three near-identical showObligations tests into one test.each.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Use the existing shared statusCodes constant rather than a bare literal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@timabell
timabell force-pushed the AMCR-259-add-cancel-steps branch from 8591a79 to 6568e1b Compare July 17, 2026 12:15
timabell and others added 3 commits July 17, 2026 13:30
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The declaration-not-found fallback reused the name of the no-id branch's
variable; rename it fallbackObligationData.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The function was 89 lines; extract the useMockApi branch into
getMockDeclarationDetail so both stay under the 75-line limit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@timabell

Copy link
Copy Markdown
Contributor Author

more sonarqube whackamole pushed

SonarQube thinks this is an actual todo.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
56 New Critical Issues (required ≤ 0)
14 New Major Issues (required ≤ 0)

See analysis details on SonarQube Cloud

💡 Need a hand with PR review? Try Gitar by Sonar!

@timabell

Copy link
Copy Markdown
Contributor Author

All sonarqube issues on this pr's diff addressed. ✔️

It seems to be still showing "issues" on lines that were not touched by this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants