-
Notifications
You must be signed in to change notification settings - Fork 166
LG-8693: Verify residential address with LexisNexis #8343
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
Changes from all commits
93bd8a3
1574aed
6680284
d007ee2
140c4ea
2291ba1
f40be44
fadddc0
2526e6c
71ac679
73078cd
8703a04
4f3a44a
299a3d0
c2c82ef
5367240
7f6ddfe
9206f4b
6fe706d
ac6eadd
16a7ca7
e84e576
34aea45
305eb9c
b3c371b
6fc01c8
b9417f4
3d616ba
aaef68b
8a0c508
4e9c8c5
4550d59
18f4a57
96629bd
c06fa9a
d85d355
146516e
e178cdb
31c3fb6
be39fa8
1c5f370
17fbf3a
5153e00
be64854
27f90a2
973477c
9fe958f
662860c
20b9948
ce5966d
2e1177c
e38d320
054fe80
c505183
13e7c2e
4d066ca
8ecfa2b
9f7a465
1f3a799
54795ea
fc3279a
5c70b8a
2c52f9c
4e5387c
914aa6f
80fc53d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,27 +33,41 @@ def proof( | |
| user_email: user_email, | ||
| ) | ||
|
|
||
| # todo(LG-8693): Begin verifying both the user's residential address and identity document | ||
| # address | ||
| applicant_pii = with_state_id_address(applicant_pii) if double_address_verification | ||
|
|
||
| resolution_result = proof_resolution( | ||
| residential_instant_verify_result = proof_residential_address_if_needed( | ||
| applicant_pii: applicant_pii, | ||
| timer: timer, | ||
| double_address_verification: double_address_verification, | ||
| ) | ||
| state_id_result = proof_state_id_if_needed( | ||
| applicant_pii: applicant_pii, | ||
|
|
||
| applicant_pii_transformed = applicant_pii.clone | ||
| if double_address_verification | ||
| applicant_pii_transformed = with_state_id_address(applicant_pii_transformed) | ||
| end | ||
|
|
||
| instant_verify_result = proof_id_address_with_lexis_nexis_if_needed( | ||
| applicant_pii: applicant_pii_transformed, | ||
| timer: timer, | ||
| resolution_result: resolution_result, | ||
| residential_instant_verify_result: residential_instant_verify_result, | ||
| double_address_verification: double_address_verification, | ||
| ) | ||
|
|
||
| state_id_result = proof_id_with_aamva_if_needed( | ||
| applicant_pii: applicant_pii_transformed, | ||
| timer: timer, | ||
| residential_instant_verify_result: residential_instant_verify_result, | ||
| instant_verify_result: instant_verify_result, | ||
| should_proof_state_id: should_proof_state_id, | ||
| double_address_verification: double_address_verification, | ||
| ) | ||
|
|
||
| ResultAdjudicator.new( | ||
| device_profiling_result: device_profiling_result, | ||
| double_address_verification: double_address_verification, | ||
| resolution_result: resolution_result, | ||
| resolution_result: instant_verify_result, | ||
| should_proof_state_id: should_proof_state_id, | ||
| state_id_result: state_id_result, | ||
| residential_resolution_result: residential_instant_verify_result, | ||
| same_address_as_id: applicant_pii[:same_address_as_id], | ||
| ) | ||
| end | ||
|
|
||
|
|
@@ -86,20 +100,70 @@ def proof_with_threatmetrix_if_needed( | |
| end | ||
| end | ||
|
|
||
| def proof_resolution(applicant_pii:, timer:) | ||
| def proof_residential_address_if_needed( | ||
| applicant_pii:, | ||
| timer:, | ||
| double_address_verification: | ||
| ) | ||
| return residential_address_unnecessary_result unless double_address_verification | ||
|
|
||
| timer.time('residential address') do | ||
| resolution_proofer.proof(applicant_pii) | ||
| end | ||
| end | ||
|
|
||
| def residential_address_unnecessary_result | ||
|
Contributor
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. is this for the case where a user has not been presented DAV and so they only have their state id address?
Contributor
Author
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. You're correct this is for the case where a user is not going through the double address verification flow and only one address is verified. Relevant code here. I wouldn't say that "they only have their state id address," because before DAV, someone could enter their address on the pre-DAV address page and check that their current address does not appear on their state-issued id. Link to figma here.
Contributor
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. i think it might be helpful to include a short comment above each of these functions that briefly describes the use case |
||
| Proofing::AddressResult.new( | ||
| success: true, errors: {}, exception: nil, vendor_name: 'ResidentialAddressNotRequired', | ||
eileen-nava marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
| end | ||
|
|
||
| def resolution_cannot_pass | ||
| Proofing::AddressResult.new( | ||
| success: false, errors: {}, exception: nil, vendor_name: 'ResolutionCannotPass', | ||
| ) | ||
| end | ||
|
|
||
| def proof_id_address_with_lexis_nexis_if_needed(applicant_pii:, timer:, | ||
| residential_instant_verify_result:, | ||
| double_address_verification:) | ||
| if applicant_pii[:same_address_as_id] == 'true' && double_address_verification == true | ||
| return residential_instant_verify_result | ||
| end | ||
| return resolution_cannot_pass unless residential_instant_verify_result.success? | ||
|
|
||
| timer.time('resolution') do | ||
| resolution_proofer.proof(applicant_pii) | ||
| end | ||
| end | ||
|
|
||
| def proof_state_id_if_needed( | ||
| def should_proof_state_id_with_aamva?(double_address_verification:, same_address_as_id:, | ||
| should_proof_state_id:, instant_verify_result:, | ||
| residential_instant_verify_result:) | ||
| return false unless should_proof_state_id | ||
| if double_address_verification == false || same_address_as_id == 'true' | ||
| user_can_pass_after_state_id_check?(instant_verify_result) | ||
| else | ||
| residential_instant_verify_result.success? | ||
| end | ||
NavaTim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
|
|
||
| def proof_id_with_aamva_if_needed( | ||
| applicant_pii:, timer:, | ||
| resolution_result:, | ||
| should_proof_state_id: | ||
| residential_instant_verify_result:, | ||
| instant_verify_result:, | ||
| should_proof_state_id:, | ||
| double_address_verification: | ||
| ) | ||
| unless should_proof_state_id && user_can_pass_after_state_id_check?(resolution_result) | ||
| return out_of_aamva_jurisdiction_result | ||
| end | ||
| same_address_as_id = applicant_pii[:same_address_as_id] | ||
| should_proof_state_id_with_aamva = should_proof_state_id_with_aamva?( | ||
| double_address_verification:, | ||
| same_address_as_id:, | ||
| should_proof_state_id:, | ||
| instant_verify_result:, | ||
| residential_instant_verify_result:, | ||
| ) | ||
| return out_of_aamva_jurisdiction_result unless should_proof_state_id_with_aamva | ||
|
|
||
| timer.time('state_id') do | ||
| state_id_proofer.proof(applicant_pii) | ||
|
|
||
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 think that
progressive_proofer.rbretains too much of the complexity of this process & needs some of the logic extracted into modules. One clear point of separation would be using a separate module as a results factory that could contain all of the customized calls toProofing::AddressResult.new.