-
Notifications
You must be signed in to change notification settings - Fork 166
LG-10423: Update PII Validation to Validate Document ID Number #9777
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
Merged
charleyf
merged 14 commits into
main
from
charley/lg-10423-validate-document-id-number-is-read-from-id-document
Dec 22, 2023
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dd9697e
Add new pii block for test
charleyf 510aaa2
Get 'good_pii' test working
charleyf c454d22
Add new required PII to tests
charleyf 9d32954
Use a shared error message text
charleyf 76d7e61
Fix image uploads tests
charleyf 831d525
changelog: User-Facing Improvements, DocAuth, Validate that state_id_…
charleyf 6f4d80e
Fix lint problem
charleyf b5d55df
Add keys to translation files
charleyf b6e613c
Fix puerto rican address fixture
charleyf e7545c8
Fix fixture files
charleyf af8267d
Use general error message instead due to current content freeze
charleyf 0545cf3
Merge branch 'main' into charley/lg-10423-validate-document-id-number…
charleyf 7ca3039
Put :state_id_number at the top of the file
charleyf d5b82f6
Add test for missing state_id_number
charleyf 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -6,6 +6,8 @@ | |
| let(:document_filename_regex) { /^[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}\.[a-z]+$/ } | ||
| let(:base64_regex) { /^[a-z0-9+\/]+=*$/i } | ||
| let(:selfie_img) { nil } | ||
| let(:state_id_number) { 'S59397998' } | ||
|
|
||
| describe '#create' do | ||
| subject(:action) do | ||
| post :create, params: params | ||
|
|
@@ -491,6 +493,7 @@ | |
| state_id_type: state_id_type, | ||
| dob: dob, | ||
| state_id_jurisdiction: jurisdiction, | ||
| state_id_number: state_id_number, | ||
| zipcode: zipcode, | ||
| }, | ||
| ), | ||
|
|
@@ -508,7 +511,7 @@ | |
| :idv_document_upload_submitted, | ||
| success: false, | ||
| document_state: 'ND', | ||
| document_number: nil, | ||
|
charleyf marked this conversation as resolved.
|
||
| document_number: state_id_number, | ||
| document_issued: nil, | ||
| document_expiration: nil, | ||
| first_name: nil, | ||
|
|
@@ -597,7 +600,7 @@ | |
| :idv_document_upload_submitted, | ||
| success: false, | ||
| document_state: 'ND', | ||
| document_number: nil, | ||
| document_number: state_id_number, | ||
| document_issued: nil, | ||
| document_expiration: nil, | ||
| first_name: nil, | ||
|
|
@@ -686,7 +689,7 @@ | |
| :idv_document_upload_submitted, | ||
| success: false, | ||
| document_state: 'Maryland', | ||
| document_number: nil, | ||
| document_number: state_id_number, | ||
| document_issued: nil, | ||
| document_expiration: nil, | ||
| first_name: 'FAKEY', | ||
|
|
@@ -702,6 +705,92 @@ | |
| end | ||
| end | ||
|
|
||
| context 'but doc_pii validation fails due to missing state_id_number' do | ||
|
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. @amirbey Adding a test is a good idea. Did it here. |
||
| let(:state_id_number) { nil } | ||
|
|
||
| it 'tracks state_id_number validation errors in analytics' do | ||
| stub_analytics | ||
| stub_attempts_tracker | ||
|
|
||
| expect(@analytics).to receive(:track_event).with( | ||
| 'IdV: doc auth image upload form submitted', | ||
| success: true, | ||
| errors: {}, | ||
| user_id: user.uuid, | ||
| attempts: 1, | ||
| remaining_attempts: IdentityConfig.store.doc_auth_max_attempts - 1, | ||
| pii_like_keypaths: pii_like_keypaths, | ||
| flow_path: 'standard', | ||
| front_image_fingerprint: an_instance_of(String), | ||
| back_image_fingerprint: an_instance_of(String), | ||
| ) | ||
|
|
||
| expect(@analytics).to receive(:track_event).with( | ||
| 'IdV: doc auth image upload vendor submitted', | ||
| success: true, | ||
| errors: {}, | ||
| attention_with_barcode: false, | ||
| async: false, | ||
| billed: true, | ||
| exception: nil, | ||
| doc_auth_result: 'Passed', | ||
| state: 'ND', | ||
| state_id_type: 'drivers_license', | ||
| user_id: user.uuid, | ||
| attempts: 1, | ||
| remaining_attempts: IdentityConfig.store.doc_auth_max_attempts - 1, | ||
| client_image_metrics: { | ||
| front: { glare: 99.99 }, | ||
| back: { glare: 99.99 }, | ||
| }, | ||
| pii_like_keypaths: pii_like_keypaths, | ||
| flow_path: 'standard', | ||
| vendor_request_time_in_ms: a_kind_of(Float), | ||
| front_image_fingerprint: an_instance_of(String), | ||
| back_image_fingerprint: an_instance_of(String), | ||
| doc_type_supported: boolean, | ||
| ) | ||
|
|
||
| expect(@analytics).to receive(:track_event).with( | ||
| 'IdV: doc auth image upload vendor pii validation', | ||
| success: false, | ||
| errors: { | ||
| state_id_number: [I18n.t('doc_auth.errors.general.no_liveness')], | ||
| }, | ||
| error_details: { | ||
| state_id_number: { blank: true }, | ||
| }, | ||
| attention_with_barcode: false, | ||
| user_id: user.uuid, | ||
| attempts: 1, | ||
| remaining_attempts: IdentityConfig.store.doc_auth_max_attempts - 1, | ||
| pii_like_keypaths: pii_like_keypaths, | ||
| flow_path: 'standard', | ||
| front_image_fingerprint: an_instance_of(String), | ||
| back_image_fingerprint: an_instance_of(String), | ||
| classification_info: hash_including(:Front, :Back), | ||
| ) | ||
|
|
||
| expect(@irs_attempts_api_tracker).to receive(:track_event).with( | ||
| :idv_document_upload_submitted, | ||
| success: false, | ||
| document_back_image_filename: nil, | ||
| document_front_image_filename: nil, | ||
| document_image_encryption_key: nil, | ||
| document_state: 'ND', | ||
| document_number: state_id_number, | ||
| document_issued: nil, | ||
| document_expiration: nil, | ||
| first_name: 'FAKEY', | ||
| last_name: 'MCFAKERSON', | ||
| date_of_birth: '10/06/1938', | ||
| address: address1, | ||
| ) | ||
|
|
||
| action | ||
| end | ||
| end | ||
|
|
||
| context 'but doc_pii validation fails due to invalid DOB' do | ||
| let(:dob) { nil } | ||
|
|
||
|
|
@@ -775,7 +864,7 @@ | |
| document_front_image_filename: nil, | ||
| document_image_encryption_key: nil, | ||
| document_state: 'ND', | ||
| document_number: nil, | ||
| document_number: state_id_number, | ||
| document_issued: nil, | ||
| document_expiration: nil, | ||
| first_name: 'FAKEY', | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ document: | |
| dob: 10/06/1938 | ||
| phone: +1 314-555-1212 | ||
| state_id_jurisdiction: 'ND' | ||
| state_id_number: 'S59397998' | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -9,3 +9,4 @@ document: | |
| zipcode: '11364' | ||
| phone: +1 314-555-1212 | ||
| state_id_jurisdiction: 'NY' | ||
| state_id_number: 'S59397998' | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ document: | |
| dob: 01/06/1998 | ||
| phone: +1 787-555-1212 | ||
| state_id_jurisdiction: 'PR' | ||
| state_id_number: 'S59397998' | ||
This file contains hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.