Skip to content

LG-8664 | Log Attempt Event for fraud account ops#7951

Merged
n1zyy merged 21 commits intomainfrom
mattw/LG-8664_profile_reviewed
Mar 28, 2023
Merged

LG-8664 | Log Attempt Event for fraud account ops#7951
n1zyy merged 21 commits intomainfrom
mattw/LG-8664_profile_reviewed

Conversation

@n1zyy
Copy link
Contributor

@n1zyy n1zyy commented Mar 9, 2023

🎫 Ticket

LG-8664

🛠 Summary of changes

When an account is either activated or shut down after review by the fraud team, we need to generate an AttemptEvent for it.

This requires keeping some session IDs around for the IRS to pass them offline, so this introduces a new FraudEvent (name subject to reconsideration in this PR) model for storing this information.

@jmhooper jmhooper force-pushed the mattw/LG-8664_profile_reviewed branch from 07b89c3 to 31f8336 Compare March 14, 2023 18:20
# It COULD make sense to put other stuff here and make this the primary way of tracking this,
# but the immediate need is to just have a way to link this data back to a user before there
# is a ServiceProviderIdentity.
class FraudEvent < ApplicationRecord
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FWIW I'm kind of using this as a placeholder name. I worry "event" is overloaded in meaning.

The problem is that really the class name should be something like WeirdTableToStashSessionIdsInThisEdgeCase, and I haven't been able to find a clear name for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe FraudReview? like the user is being reviewed for possible fraud, it's not confirmed fraud (which is what FraudEvent implies to me)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is definitely an improvement. That said, I think of "fraud review" as when happens when someone goes through these to approve/reject. But I like FraudReview a lot more.

Copy link
Contributor

Choose a reason for hiding this comment

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

FraudReviewRequest? something like that

@n1zyy n1zyy changed the title [WIP] LG-8664 | Log Attempt Event for fraud account ops LG-8664 | Log Attempt Event for fraud account ops Mar 23, 2023
@n1zyy n1zyy requested review from a team and zachmargolis March 23, 2023 21:35
fraud_event = user.fraud_event
irs_attempts_api_tracker&.fraud_review_adjudicated(
decision: 'pass',
fraud_event_id: fraud_event&.id,
Copy link
Contributor

@zachmargolis zachmargolis Mar 23, 2023

Choose a reason for hiding this comment

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

in general I think it's a bad pattern to expose our internal DB primary key ids in any API. I would add a uuid column (and use our NonNullUuid concern)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like that, if we're going to keep this.

There's a question of whether we actually need this parameter. It sounds like the client wants session IDs. It seems like this extra detail we have for free may help make things easier, in which case I'm on board with making it a UUID. But I just want to call out that this is only being included because it felt like a good idea to me, not because the requirements actually call for an identifier.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh! in that case, let's drop from the event it if there is no business case for it (maybe add the UUID column just in case since we can't go back in time and add it for the past)

@n1zyy
Copy link
Contributor Author

n1zyy commented Mar 23, 2023

Just pushed up some changes that should have this in good shape. But one note: Do not merge this without a feature flag. It's 7:30pm local though, so I'm going to eat. Dinner consumed; feature flag added.

@@ -1,4 +1,4 @@
# Represents a record of a phone number that has beed opted out of SMS in AWS Pinpoint
# Represents a record of a phone number that has been opted out of SMS in AWS Pinpoint
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happened across this while looking at how NonNullUuid was used.

Copy link
Contributor

Choose a reason for hiding this comment

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

ooops good catch

Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM, one last set of small comments

n1zyy and others added 2 commits March 27, 2023 15:32
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
@n1zyy n1zyy merged commit 3346dc1 into main Mar 28, 2023
@n1zyy n1zyy deleted the mattw/LG-8664_profile_reviewed branch March 28, 2023 01:35
@aduth aduth mentioned this pull request Mar 29, 2023
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.

3 participants