Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fraud check #3331

Merged
merged 2 commits into from
Nov 1, 2024
Merged

Add fraud check #3331

merged 2 commits into from
Nov 1, 2024

Conversation

rjlynch
Copy link
Contributor

@rjlynch rjlynch commented Oct 18, 2024

Add fraud check

Adds a mechanisim for admins to upload a csv of known risky trns and
ninos that will cause claims with these attributes to be flagged in the
admin ui.

Flagged values can be removed by uploading a CSV without those values.

We've added some new functionality to the task/index notification
banner. The banner now supports rendering multiple messages. If there is
a single banner notification is falls back to the original view and
renders a p tag, with multiple notifications it now renders a list.

Notes for review

The main changes in this PR is the introduction of the RiskIndicator model, the new admin controllers for managing the fraud risk CSV, and the changes to the admin/tasks/index banner notification to support rendering multiple messages.
Probably best to start by reviewing the new app/controllers/admin/fraud_risk_csv_uploads_controller.rb as that's where the new flow kicks off.
Also of note is the new claim verifier app/models/automated_checks/claim_verifiers/fraud_risk.rb. This claim verifier doesn't create a task (not a requirement in the ticket but may be wanted in future), however a claim verifier seemed like the natural place to create a fraud risk note on the ticket.

Acceptance criteria

  • When a known TRN submits a claim, the claim is flagged in the main body of the claim. A note needs to be created in the notes section to explain this, similar to the hold/unhold feature.

  • The claim cannot be approved, these feature is disabled

fraud-prevention-walkthrough.mp4

@rjlynch rjlynch added the deploy Deploy a review app for this PR label Oct 18, 2024
@rjlynch rjlynch force-pushed the CAPT-1185/flag-known-ninos-and-trns branch from 31fbf38 to a2e1ee0 Compare October 18, 2024 16:05
@rjlynch rjlynch force-pushed the CAPT-1185/flag-known-ninos-and-trns branch from a2e1ee0 to fa57085 Compare October 18, 2024 16:13
@rjlynch rjlynch force-pushed the CAPT-1185/flag-known-ninos-and-trns branch from fa57085 to 7fb712a Compare October 18, 2024 16:16
@rjlynch rjlynch force-pushed the CAPT-1185/flag-known-ninos-and-trns branch from 7fb712a to 953d6e5 Compare October 21, 2024 09:43
@rjlynch rjlynch marked this pull request as ready for review October 21, 2024 10:49
@rjlynch rjlynch force-pushed the CAPT-1185/flag-known-ninos-and-trns branch 3 times, most recently from c13d4e3 to c006d04 Compare October 24, 2024 13:43
@rjlynch rjlynch force-pushed the CAPT-1185/flag-known-ninos-and-trns branch from c006d04 to 8de2fda Compare October 24, 2024 13:55
return false unless valid?

ApplicationRecord.transaction do
RiskIndicator.where.not(id: records.map(&:id)).destroy_all
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it have been easier to delete everything then just re-add the whatevers in the CSV?
not sure if this methodology has any benefits?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be a bit easier, just seemed weird to create new records when the data hasn't changed!

@rjlynch rjlynch force-pushed the CAPT-1185/flag-known-ninos-and-trns branch from 8de2fda to 7bdfa3a Compare October 24, 2024 15:47
@rjlynch rjlynch force-pushed the CAPT-1185/flag-known-ninos-and-trns branch from 7bdfa3a to 8d9c0ab Compare October 28, 2024 13:54
@rjlynch rjlynch force-pushed the CAPT-1185/flag-known-ninos-and-trns branch 2 times, most recently from 476b4ff to 15a1c37 Compare October 29, 2024 15:58
Comment on lines +25 to +29
<%= govuk_link_to(
"Download CSV",
admin_fraud_risk_csv_download_path(format: :csv),
class: "govuk-button"
) %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds a mechanisim for admins to upload a csv of known risky trns and
ninos that will cause claims with these attributes to be flagged in the
admin ui.

Flagged values can be removed by uploading a CSV without those values.

We've added some new functionality to the task/index notification
banner. The banner now supports rendering multiple messages. If there is
a single banner notification is falls back to the original view and
renders a p tag, with multiple notifications it now renders a list.
When the fraud risk csv is uploaded add notes to any claims with
matching details.
@rjlynch rjlynch force-pushed the CAPT-1185/flag-known-ninos-and-trns branch from 15a1c37 to 5939d35 Compare November 1, 2024 13:52
@rjlynch rjlynch merged commit 8e8c405 into master Nov 1, 2024
14 checks passed
@rjlynch rjlynch deleted the CAPT-1185/flag-known-ninos-and-trns branch November 1, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
business reviewed deploy Deploy a review app for this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants