PO-3412 Implementing exact offence code match#2384
Draft
ChrisGarratt122 wants to merge 3 commits intomasterfrom
Draft
PO-3412 Implementing exact offence code match#2384ChrisGarratt122 wants to merge 3 commits intomasterfrom
ChrisGarratt122 wants to merge 3 commits intomasterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira link
See PO-3412
Change description
Problem
Entering an offence code that is valid itself but also has related sub-codes could show an incorrect “Offence not found” message in Manual Account Creation.
Example:
CD71039CD71039,CD71039A,CD71039B,CD71039CCD71039is present in the response and the intended code to displayThis created an inconsistent journey because the review screen could still appear to show the correct offence later in the flow.
Cause
The cause of this was the conditional logic on
fines-mac-offence-code-hint.component.htmlset to display the retrieved offence code only whenresponse.count === 1. This means when a code not only pulls itself down from the backend but also all sub-codes the response count is more than 1 and this condition defaults the page to show "No offence found".In general multiple codes being returned in the response hasn't been accounted and these issues affected a few places:
That affected a few places:
offence_idwhenresponse.count === 1count === 1refData[0], which only worked if the exact match happened to be the first returned itemSo for multi-result responses containing a valid exact match, we could:
offence_idunsetSolution
The primary fix here is to change the condition that determines between displaying the offence code or error. Instead of checking for the number of responses, we should be looking for an exact match from all codes in a given response.
Fixes:
offence_idfrom that exact matchThis keeps the behaviour consistent across:
Considerations
Testing done
Manual testing
Unit testing
The testing approach focused on the exact-match behaviour across the full offence-code journey: service tests were used to verify that when the API returns multiple related offences, the lookup only succeeds if one record exactly matches the user-entered code, including both the positive case (CD71039 returned alongside CD71039A/B/C) and the negative case where similar results are returned but no exact match exists; targeted component tests then confirmed that the same rule is reflected in the UI, so the offence hint panel and both review displays now show the correct offence title and “Offence found” state for exact matches, and continue to show “Offence not found” where no exact match is present, removing any dependency on response ordering.
Security Vulnerability Assessment
CVE Suppression: Are there any CVEs present in the codebase (either newly introduced or pre-existing) that are being intentionally suppressed or ignored by this commit?
Checklist