diff --git a/app/services/doc_auth/mock/result_response.rb b/app/services/doc_auth/mock/result_response.rb index b1778865ada..4f1d388866a 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, @@ -33,12 +34,12 @@ 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') + 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') @@ -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? @@ -254,6 +255,13 @@ def create_response_info( extra: { liveness_checking_required: liveness_enabled }, }.compact end + + def failed_file_data(failed_alerts_data) + if attention_with_barcode? + failed_alerts_data&.delete(ATTENTION_WITH_BARCODE_ALERT) + end + failed_alerts_data + end end end end 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 +