Skip to content

LG -7015 Redirect user to "Sorry" page on TMX verification failure#6827

Merged
theabrad merged 5 commits intomainfrom
lg-7015-device-profiling-redirect
Aug 25, 2022
Merged

LG -7015 Redirect user to "Sorry" page on TMX verification failure#6827
theabrad merged 5 commits intomainfrom
lg-7015-device-profiling-redirect

Conversation

@theabrad
Copy link
Contributor

Why?
If a user fails threatmetrix verification we want to redirect them to a come back later page.

changelog: Upcoming Features, Device Profiling, Redirect to come back
later URL upon threatmetrix profiling failing.
@theabrad theabrad requested a review from a team August 23, 2022 18:59
def device_profiling_failed?
return false unless IdentityConfig.store.proofing_device_profiling_collecting_enabled
proofing_component = ProofingComponent.find_by(user: current_user)
proofing_component.threatmetrix_review_status != 'pass'
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to make sure it's also not nil

end

it 'when device profiling fails redirect to come back later path' do
ProofingComponent.find_by(user: user).update(threatmetrix_review_status: 'fail')
Copy link
Contributor

Choose a reason for hiding this comment

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

can we get some tests with statuses like pass or nil?

elsif in_person_enrollment?
idv_in_person_ready_to_verify_url
elsif device_profiling_failed?
idv_come_back_later_url
Copy link
Contributor

Choose a reason for hiding this comment

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

we'll change this once we have real content, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this PR should also include a new stub page like /verify/setup_error that we'll use for the failure messaging (it can just say something like "Please contact support to continue account setup" or something)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

end

def device_profiling_failed?
return false unless IdentityConfig.store.proofing_device_profiling_collecting_enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be proofing_device_profiling_decisioning_enabled, yes?

Suggested change
return false unless IdentityConfig.store.proofing_device_profiling_collecting_enabled
return false unless IdentityConfig.store.proofing_device_profiling_decisioning_enabled

idv_come_back_later_url
elsif in_person_enrollment?
idv_in_person_ready_to_verify_url
elsif device_profiling_failed?
Copy link
Contributor

@aduth aduth Aug 24, 2022

Choose a reason for hiding this comment

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

Note that there are currently two implementations of the personal key step, controlled by the idv_api_enabled_steps feature flag. I'd expect we'd update both to keep the behaviors in sync.

The other:

def completion_url(result, user)
if result.extra[:profile_pending]
idv_come_back_later_url
elsif in_person_enrollment?(user)
idv_in_person_ready_to_verify_url
elsif current_sp
sign_up_completed_url
else
account_url
end
end

def device_profiling_failed?(user)
return false unless IdentityConfig.store.proofing_device_profiling_decisioning_enabled
proofing_component = ProofingComponent.find_by(user: user)
proofing_component.threatmetrix_review_status != 'pass'
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto about checking if this is nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean checking if proofing_component is nil or if threatmetrix_review_status is nil?

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant threatmetrix_review_status is nil

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 have a test for review status being nil and it returns true . I feel like an extra line checking for nil is unnecessary unless we change threatmetrix_review_status from 'pass' or 'fail' to a boolean in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah I see, so my expectation is that review status being nil is not a failure, that this method should return falsy in that case? Becaue we don't know that it's a for sure negative? and there may be users who fit into a gap of "the feature flag was enabled but we didn't run the check for them" so they don't have data

Copy link
Contributor Author

@theabrad theabrad Aug 24, 2022

Choose a reason for hiding this comment

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

ah so if it is nil let them pass?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah that's my expectation of how we could ensure the safest/smoothest launch

Copy link
Contributor

@jskinne3 jskinne3 Aug 24, 2022

Choose a reason for hiding this comment

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

I'd like to add my support to the idea that a missing review_status in the API response (which I assume is what a nil value for proofing_component.threatmetrix_review_status indicates) should have (for now) the same behavior as pass.

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

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 assuming we'll follow up with a new URL/page

Copy link
Contributor

@jskinne3 jskinne3 left a comment

Choose a reason for hiding this comment

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

added a comment

ProofingComponent.find_by(user: user)&.document_check == Idp::Constants::Vendors::USPS
end

def device_profiling_failed?(user)
Copy link
Contributor

Choose a reason for hiding this comment

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

To me it feels like a confusing double negative to say that the user passes the test if device_profiling_failed is false. It could be named device_profiling_passed? and return true when the user passes. Or, I would also find the name blocked_by_device_profiling? clearer if you still want it to return false on a pass.

@theabrad theabrad merged commit 6a3b5b8 into main Aug 25, 2022
@theabrad theabrad deleted the lg-7015-device-profiling-redirect branch August 25, 2022 14:58
@aduth aduth mentioned this pull request Aug 30, 2022
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.

5 participants