diff --git a/app/services/flow/flow_state_machine.rb b/app/services/flow/flow_state_machine.rb index cc0e06f7c14..ab86cadd60d 100644 --- a/app/services/flow/flow_state_machine.rb +++ b/app/services/flow/flow_state_machine.rb @@ -176,6 +176,9 @@ def analytics_properties step: current_step, step_count: current_flow_step_counts[current_step_name], analytics_id: @analytics_id, + irs_reproofing: effective_user&.decorate&.reproof_for_irs?( + service_provider: current_sp, + ).present?, } end diff --git a/spec/controllers/idv/capture_doc_controller_spec.rb b/spec/controllers/idv/capture_doc_controller_spec.rb index 0faa9705452..b4e8d15962f 100644 --- a/spec/controllers/idv/capture_doc_controller_spec.rb +++ b/spec/controllers/idv/capture_doc_controller_spec.rb @@ -133,11 +133,32 @@ expect(response).to_not be_not_found end + it 'tracks expected events for irs reproofing' do + allow_any_instance_of(UserDecorator).to receive(:reproof_for_irs?).and_return(true) + mock_next_step(:capture_complete) + result = { + step: 'capture_complete', + flow_path: 'hybrid', + irs_reproofing: true, + step_count: 1, + analytics_id: 'Doc Auth', + } + + get :show, params: { step: 'capture_complete' } + + expect(@irs_attempts_api_tracker).not_to have_received(:idv_phone_upload_link_used) + + expect(@analytics).to have_received(:track_event).with( + 'IdV: doc auth capture_complete visited', result + ) + end + it 'tracks expected events' do mock_next_step(:capture_complete) result = { step: 'capture_complete', flow_path: 'hybrid', + irs_reproofing: false, step_count: 1, analytics_id: 'Doc Auth', } diff --git a/spec/controllers/idv/doc_auth_controller_spec.rb b/spec/controllers/idv/doc_auth_controller_spec.rb index ff71cd4dfac..57eb3dcfa91 100644 --- a/spec/controllers/idv/doc_auth_controller_spec.rb +++ b/spec/controllers/idv/doc_auth_controller_spec.rb @@ -94,7 +94,8 @@ end it 'tracks analytics' do - result = { step: 'welcome', flow_path: 'standard', step_count: 1, analytics_id: 'Doc Auth' } + result = { step: 'welcome', flow_path: 'standard', irs_reproofing: false, step_count: 1, + analytics_id: 'Doc Auth' } get :show, params: { step: 'welcome' } @@ -164,6 +165,7 @@ flow_path: 'standard', step_count: 1, pii_like_keypaths: [[:errors, :ssn], [:error_details, :ssn]], + irs_reproofing: false, analytics_id: 'Doc Auth', } @@ -200,6 +202,7 @@ }, step: 'welcome', flow_path: 'standard', + irs_reproofing: false, step_count: 1, analytics_id: 'Doc Auth', }