From a95fc19ec81c3f5b2b4329d41d36c3e1bd557623 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Fri, 23 Feb 2024 09:16:26 -0500 Subject: [PATCH 1/4] fix mock proofer to acknowledge selfie status when determining success [skip changelog] --- app/services/doc_auth/mock/result_response.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/services/doc_auth/mock/result_response.rb b/app/services/doc_auth/mock/result_response.rb index b1778865ada..2029ce68181 100644 --- a/app/services/doc_auth/mock/result_response.rb +++ b/app/services/doc_auth/mock/result_response.rb @@ -18,6 +18,7 @@ def initialize(uploaded_file, config, selfie_required = false) doc_type_supported: id_type_supported?, selfie_live: selfie_live?, selfie_quality_good: selfie_quality_good?, + selfie_status: selfie_status, extra: { doc_auth_result: doc_auth_result, portrait_match_results: portrait_match_results, @@ -85,7 +86,7 @@ def pii_from_doc end def success? - (errors.blank? || attention_with_barcode?) && id_type_supported? + doc_auth_success? && (selfie_check_performed? ? selfie_passed? : true) end def attention_with_barcode? From b969b467226c52fdaa83d8c19349f8824b70a94d Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Fri, 23 Feb 2024 15:49:53 -0500 Subject: [PATCH 2/4] parse errors when attention with barcode --- app/services/doc_auth/mock/result_response.rb | 9 +++- .../idv/doc_auth/document_capture_spec.rb | 41 +++++++++++++++++++ ...ential_barcode_attention_liveness_fail.yml | 24 +++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 spec/fixtures/ial2_test_credential_barcode_attention_liveness_fail.yml diff --git a/app/services/doc_auth/mock/result_response.rb b/app/services/doc_auth/mock/result_response.rb index 2029ce68181..92f8a623d24 100644 --- a/app/services/doc_auth/mock/result_response.rb +++ b/app/services/doc_auth/mock/result_response.rb @@ -34,12 +34,17 @@ def errors @errors ||= begin file_data = parsed_data_from_uploaded_file - if file_data.blank? || attention_with_barcode? + if file_data.blank? {} else doc_auth_result = file_data.dig('doc_auth_result') image_metrics = file_data.dig('image_metrics') - failed = file_data.dig('failed_alerts') + + if attention_with_barcode? + failed_file_data = file_data.dup.dig('failed_alerts') + failed_file_data.delete(ATTENTION_WITH_BARCODE_ALERT) + end + failed = failed_file_data passed = file_data.dig('passed_alerts') face_match_result = file_data.dig('portrait_match_results', 'FaceMatchResult') classification_info = file_data.dig('classification_info') diff --git a/spec/features/idv/doc_auth/document_capture_spec.rb b/spec/features/idv/doc_auth/document_capture_spec.rb index fcfc5da4c30..db820bf5297 100644 --- a/spec/features/idv/doc_auth/document_capture_spec.rb +++ b/spec/features/idv/doc_auth/document_capture_spec.rb @@ -383,6 +383,47 @@ inline_error = strip_tags(t('doc_auth.errors.general.selfie_failure')) expect(page).to have_content(inline_error) end + + context 'with Attention with Barcode' do + it 'try again and page show selfie fail inline error message' do + visit_idp_from_oidc_sp_with_ial2 + sign_in_and_2fa_user(user) + complete_doc_auth_steps_before_document_capture_step + attach_images( + Rails.root.join( + 'spec', 'fixtures', + 'ial2_test_credential_barcode_attention_liveness_fail.yml' + ), + ) + attach_selfie( + Rails.root.join( + 'spec', 'fixtures', + 'ial2_test_credential_barcode_attention_liveness_fail.yml' + ), + ) + submit_images + message = strip_tags(t('errors.doc_auth.selfie_not_live_or_poor_quality_heading')) + expect(page).to have_content(message) + detail_message = strip_tags(t('doc_auth.errors.alerts.selfie_not_live')) + security_message = strip_tags( + t( + 'idv.warning.attempts_html', + count: IdentityConfig.store.doc_auth_max_attempts - 1, + ), + ) + + expect(page).to have_content(detail_message << "\n" << security_message) + review_issues_header = strip_tags( + t('errors.doc_auth.selfie_not_live_or_poor_quality_heading'), + ) + expect(page).to have_content(review_issues_header) + expect(page).to have_current_path(idv_document_capture_path) + click_try_again + expect(page).to have_current_path(idv_document_capture_path) + inline_error = strip_tags(t('doc_auth.errors.general.selfie_failure')) + expect(page).to have_content(inline_error) + end + end end context 'when selfie check is not enabled (flag off, and/or in production)' do diff --git a/spec/fixtures/ial2_test_credential_barcode_attention_liveness_fail.yml b/spec/fixtures/ial2_test_credential_barcode_attention_liveness_fail.yml new file mode 100644 index 00000000000..132502d887e --- /dev/null +++ b/spec/fixtures/ial2_test_credential_barcode_attention_liveness_fail.yml @@ -0,0 +1,24 @@ +portrait_match_results: + # returns the portrait match result + FaceMatchResult: Fail + # returns the liveness result + FaceErrorMessage: 'Liveness: NotLive' +doc_auth_result: Attention +document: + first_name: Jane + last_name: Doe + middle_name: Q + address1: 1800 F Street + address2: Apt 3 + city: Bayside + state: NY + zipcode: '11364' + dob: 10/06/1938 + phone: +1 314-555-1212 + state_id_jurisdiction: 'ND' + state_id_number: 'S59397998' + state_id_type: drivers_license +failed_alerts: + - name: 2D Barcode Read + result: Attention + From b030c98a7e3592b741e6ddca426ec5ba045fb3d5 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Fri, 23 Feb 2024 16:00:16 -0500 Subject: [PATCH 3/4] refactor failed_file_data --- app/services/doc_auth/mock/result_response.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/services/doc_auth/mock/result_response.rb b/app/services/doc_auth/mock/result_response.rb index 92f8a623d24..8e9cbc427f6 100644 --- a/app/services/doc_auth/mock/result_response.rb +++ b/app/services/doc_auth/mock/result_response.rb @@ -39,12 +39,7 @@ def errors else doc_auth_result = file_data.dig('doc_auth_result') image_metrics = file_data.dig('image_metrics') - - if attention_with_barcode? - failed_file_data = file_data.dup.dig('failed_alerts') - failed_file_data.delete(ATTENTION_WITH_BARCODE_ALERT) - end - failed = failed_file_data + failed = failed_file_data(file_data.dup) passed = file_data.dig('passed_alerts') face_match_result = file_data.dig('portrait_match_results', 'FaceMatchResult') classification_info = file_data.dig('classification_info') @@ -260,6 +255,14 @@ def create_response_info( extra: { liveness_checking_required: liveness_enabled }, }.compact end + + def failed_file_data(failed_data) + if attention_with_barcode? + failed_data = failed_data.dig('failed_alerts') + failed_data.delete(ATTENTION_WITH_BARCODE_ALERT) + end + failed_data + end end end end From 41f61e1b6c1b8ee54b03ba253439175d32e96460 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Mon, 26 Feb 2024 12:12:50 -0500 Subject: [PATCH 4/4] refactore failed_file_data --- app/services/doc_auth/mock/result_response.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/services/doc_auth/mock/result_response.rb b/app/services/doc_auth/mock/result_response.rb index 8e9cbc427f6..4f1d388866a 100644 --- a/app/services/doc_auth/mock/result_response.rb +++ b/app/services/doc_auth/mock/result_response.rb @@ -39,7 +39,7 @@ def errors else doc_auth_result = file_data.dig('doc_auth_result') image_metrics = file_data.dig('image_metrics') - failed = failed_file_data(file_data.dup) + failed = failed_file_data(file_data.dig('failed_alerts')&.dup) passed = file_data.dig('passed_alerts') face_match_result = file_data.dig('portrait_match_results', 'FaceMatchResult') classification_info = file_data.dig('classification_info') @@ -256,12 +256,11 @@ def create_response_info( }.compact end - def failed_file_data(failed_data) + def failed_file_data(failed_alerts_data) if attention_with_barcode? - failed_data = failed_data.dig('failed_alerts') - failed_data.delete(ATTENTION_WITH_BARCODE_ALERT) + failed_alerts_data&.delete(ATTENTION_WITH_BARCODE_ALERT) end - failed_data + failed_alerts_data end end end