-
Notifications
You must be signed in to change notification settings - Fork 122
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
LG-14673: Add SP info to fraud review events #11390
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5ed2911
Update review-reject to attribute events to SP
matthinz b9c3f96
Update review-pass to attribute events to SP
matthinz 04c76a1
Allow logging SP without a request
matthinz 82097d8
Don't log extraneous event
matthinz 330161e
Add test for logging SP without request
matthinz 3b97c8b
Add parameter documentation for Analytics initializer
matthinz 5d05779
Update analytics spec
matthinz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,6 +177,7 @@ def run(args:, config:) | |
messages = [] | ||
|
||
users.each do |user| | ||
profile = nil | ||
profile_fraud_review_pending_at = nil | ||
success = false | ||
|
||
|
@@ -187,7 +188,6 @@ def run(args:, config:) | |
elsif FraudReviewChecker.new(user).fraud_review_eligible? | ||
profile = user.fraud_review_pending_profile | ||
profile_fraud_review_pending_at = profile.fraud_review_pending_at | ||
profile_age_in_seconds = profile.profile_age_in_seconds | ||
profile.reject_for_fraud(notify_user: true) | ||
success = true | ||
|
||
|
@@ -211,18 +211,23 @@ def run(args:, config:) | |
end | ||
|
||
Analytics.new( | ||
user: user, request: nil, session: {}, sp: nil, | ||
user: user, | ||
request: nil, | ||
session: {}, | ||
sp: profile&.initiating_service_provider_issuer, | ||
).fraud_review_rejected( | ||
success:, | ||
errors: analytics_error_hash, | ||
exception: nil, | ||
profile_fraud_review_pending_at: profile_fraud_review_pending_at, | ||
profile_age_in_seconds: profile_age_in_seconds, | ||
profile_fraud_review_pending_at:, | ||
profile_age_in_seconds: profile&.profile_age_in_seconds, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (suggestion, non-blocking): I think it is worthwhile keeping the profile attr wrapping methods to streamline reading as |
||
) | ||
end | ||
|
||
if config.include_missing? | ||
(uuids - users.map(&:uuid)).each do |missing_uuid| | ||
missing_uuids = (uuids - users.map(&:uuid)) | ||
|
||
if config.include_missing? && !missing_uuids.empty? | ||
missing_uuids.each do |missing_uuid| | ||
table, messages = log_message( | ||
uuid: missing_uuid, | ||
log: log_text[:missing_uuid], | ||
|
@@ -264,6 +269,7 @@ def run(args:, config:) | |
|
||
messages = [] | ||
users.each do |user| | ||
profile = nil | ||
profile_fraud_review_pending_at = nil | ||
success = false | ||
|
||
|
@@ -273,7 +279,6 @@ def run(args:, config:) | |
elsif FraudReviewChecker.new(user).fraud_review_eligible? | ||
profile = user.fraud_review_pending_profile | ||
profile_fraud_review_pending_at = profile.fraud_review_pending_at | ||
profile_age_in_seconds = profile.profile_age_in_seconds | ||
profile.activate_after_passing_review | ||
success = true | ||
|
||
|
@@ -305,18 +310,22 @@ def run(args:, config:) | |
end | ||
|
||
Analytics.new( | ||
user: user, request: nil, session: {}, sp: nil, | ||
user: user, | ||
request: nil, | ||
session: {}, | ||
sp: profile&.initiating_service_provider_issuer, | ||
).fraud_review_passed( | ||
success:, | ||
errors: analytics_error_hash, | ||
exception: nil, | ||
profile_fraud_review_pending_at: profile_fraud_review_pending_at, | ||
profile_age_in_seconds: profile_age_in_seconds, | ||
profile_age_in_seconds: profile&.profile_age_in_seconds, | ||
) | ||
end | ||
|
||
if config.include_missing? | ||
(uuids - users.map(&:uuid)).each do |missing_uuid| | ||
missing_uuids = (uuids - users.map(&:uuid)) | ||
if config.include_missing? && !missing_uuids.empty? | ||
missing_uuids.each do |missing_uuid| | ||
table, messages = log_message( | ||
uuid: missing_uuid, | ||
log: log_text[:missing_uuid], | ||
|
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to triple check, but I forgot what the type of
sp
was as an attribute, since we're here, WDYT of adding type documentation to the initialzer for this class likeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On that note, would it be worthwhile to rename the
sp
param tosp_issuer
or justissuer
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree with that... probably not going to do in this PR but standardizing usage of
sp
vsissuer
vssp_issuer
across the codebase would be great. I think I'd be in favor of:sp
= AServiceProvider
instancesp_issuer
=sp.issuer
, an issuer string