Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions app/services/doc_auth/mock/result_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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')
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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
41 changes: 41 additions & 0 deletions spec/features/idv/doc_auth/document_capture_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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