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
33 changes: 22 additions & 11 deletions app/services/idv/steps/verify_base_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ def process_async_state(current_async_state)
delete_async
mark_step_incomplete(:verify)
@flow.analytics.idv_proofing_resolution_result_missing
log_idv_verification_submitted_event(
success: false,
failure_reason: { idv_verification: [:timeout] },
)
elsif current_async_state.done?
async_state_done(current_async_state)
end
Expand All @@ -244,18 +248,8 @@ def async_state_done(current_async_state)
pii_like_keypaths: [[:errors, :ssn], [:response_body, :first_name]],
},
)
pii_from_doc = pii || {}
@flow.irs_attempts_api_tracker.idv_verification_submitted(
log_idv_verification_submitted_event(
success: form_response.success?,
document_state: pii_from_doc[:state],
document_number: pii_from_doc[:state_id_number],
document_issued: pii_from_doc[:state_id_issued],
document_expiration: pii_from_doc[:state_id_expiration],
first_name: pii_from_doc[:first_name],
last_name: pii_from_doc[:last_name],
date_of_birth: pii_from_doc[:dob],
address: pii_from_doc[:address1],
ssn: pii_from_doc[:ssn],
failure_reason: @flow.irs_attempts_api_tracker.parse_failure_reason(form_response),
)

Expand Down Expand Up @@ -314,6 +308,23 @@ def idv_result_to_form_response(
def redact(text)
text.gsub(/[a-z]/i, 'X').gsub(/\d/i, '#')
end

def log_idv_verification_submitted_event(success: false, failure_reason: nil)
pii_from_doc = pii || {}
@flow.irs_attempts_api_tracker.idv_verification_submitted(
success: success,
document_state: pii_from_doc[:state],
document_number: pii_from_doc[:state_id_number],
document_issued: pii_from_doc[:state_id_issued],
document_expiration: pii_from_doc[:state_id_expiration],
first_name: pii_from_doc[:first_name],
last_name: pii_from_doc[:last_name],
date_of_birth: pii_from_doc[:dob],
address: pii_from_doc[:address1],
ssn: pii_from_doc[:ssn],
failure_reason: failure_reason,
)
end
end
end
end
26 changes: 26 additions & 0 deletions spec/features/idv/doc_auth/verify_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,32 @@
click_idv_continue
expect(page).to have_current_path(idv_phone_path)
end

it 'tracks attempts tracker event with failure reason' do
expect(fake_attempts_tracker).to receive(:idv_verification_submitted).with(
success: false,
failure_reason: { idv_verification: [:timeout] },
document_state: 'MT',
document_number: '1111111111111',
document_issued: '2019-12-31',
document_expiration: '2099-12-31',
first_name: 'FAKEY',
last_name: 'MCFAKERSON',
date_of_birth: '1938-10-06',
address: '1 FAKE RD',
ssn: '900-66-1234',
)
sign_in_and_2fa_user
complete_doc_auth_steps_before_verify_step

allow(DocumentCaptureSession).to receive(:find_by).
and_return(nil)

click_idv_continue
expect(page).to have_content(t('idv.failure.timeout'))
expect(page).to have_current_path(idv_doc_auth_verify_step)
allow(DocumentCaptureSession).to receive(:find_by).and_call_original
end
end

context 'async timed out' do
Expand Down