diff --git a/app/controllers/idv/gpo_controller.rb b/app/controllers/idv/gpo_controller.rb index 0e1e80bf5c5..9349eae4872 100644 --- a/app/controllers/idv/gpo_controller.rb +++ b/app/controllers/idv/gpo_controller.rb @@ -47,7 +47,7 @@ def step_indicator_current_step def update_tracking analytics.idv_gpo_address_letter_requested(resend: resend_requested?) - irs_attempts_api_tracker.idv_letter_requested(success: true, resend: resend_requested?) + irs_attempts_api_tracker.idv_gpo_letter_requested(success: true, resend: resend_requested?) create_user_event(:gpo_mail_sent, current_user) ProofingComponent.create_or_find_by(user: current_user).update(address_check: 'gpo_letter') diff --git a/app/controllers/users/verify_personal_key_controller.rb b/app/controllers/users/verify_personal_key_controller.rb index b7a80b6ae66..f8efef18562 100644 --- a/app/controllers/users/verify_personal_key_controller.rb +++ b/app/controllers/users/verify_personal_key_controller.rb @@ -22,7 +22,7 @@ def new def create if throttle.throttled_else_increment? - irs_attempts_api_tracker.personal_key_reactivation_rate_limited(success: false) + irs_attempts_api_tracker.personal_key_reactivation_rate_limited render_throttled else result = personal_key_form.submit diff --git a/app/services/irs_attempts_api/tracker_events.rb b/app/services/irs_attempts_api/tracker_events.rb index 333b0458636..37a08646cdc 100644 --- a/app/services/irs_attempts_api/tracker_events.rb +++ b/app/services/irs_attempts_api/tracker_events.rb @@ -138,13 +138,13 @@ def idv_document_upload_submitted( end # @param [Boolean] success - # @param [Hash>] failure_reason displays GPO submission failed - # GPO verification submitted from Letter sent to verify address - def idv_gpo_verification_submitted(success:, failure_reason: nil) + # @param [String] resend + # The Address validation letter has been requested by user + def idv_gpo_letter_requested(success:, resend:) track_event( - :idv_gpo_verification_submitted, + :idv_gpo_letter_requested, success: success, - failure_reason: failure_reason, + resend: resend, ) end @@ -156,13 +156,13 @@ def idv_gpo_verification_rate_limited end # @param [Boolean] success - # @param [String] resend - # The Address validation letter has been requested by user - def idv_letter_requested(success:, resend:) + # @param [Hash>] failure_reason displays GPO submission failed + # GPO verification submitted from Letter sent to verify address + def idv_gpo_verification_submitted(success:, failure_reason: nil) track_event( - :idv_letter_requested, + :idv_gpo_verification_submitted, success: success, - resend: resend, + failure_reason: failure_reason, ) end @@ -604,6 +604,13 @@ def mfa_login_webauthn_roaming(success:) ) end + # Tracks when User personal key has been rate limited by too many attempts + def personal_key_reactivation_rate_limited + track_event( + :personal_key_reactivation_rate_limited, + ) + end + # Tracks when user has entered personal key after forgot password steps # @param [Boolean] success # @param [Hash>] failure_reason @@ -615,15 +622,6 @@ def personal_key_reactivation_submitted(success:, failure_reason: nil) ) end - # Tracks when User personal key has been rate limited by too many attempts - # @param [Boolean] success - def personal_key_reactivation_rate_limited(success:) - track_event( - :personal_key_reactivation_rate_limited, - success: success, - ) - end - # Tracks when user confirms registration email # @param [Boolean] success # @param [String] email diff --git a/spec/controllers/idv/gpo_controller_spec.rb b/spec/controllers/idv/gpo_controller_spec.rb index 534f09977b2..8d88b9b4933 100644 --- a/spec/controllers/idv/gpo_controller_spec.rb +++ b/spec/controllers/idv/gpo_controller_spec.rb @@ -3,8 +3,10 @@ describe Idv::GpoController do let(:user) { create(:user) } - before { stub_analytics } - before { stub_attempts_tracker } + before do + stub_analytics + stub_attempts_tracker + end describe 'before_actions' do it 'includes authentication before_action' do @@ -102,7 +104,7 @@ end it 'logs attempts api tracking' do - expect(@irs_attempts_api_tracker).to receive(:idv_letter_requested). + expect(@irs_attempts_api_tracker).to receive(:idv_gpo_letter_requested). with(success: true, resend: false) put :create @@ -129,7 +131,7 @@ end it 'logs attempts api tracking' do - expect(@irs_attempts_api_tracker).to receive(:idv_letter_requested). + expect(@irs_attempts_api_tracker).to receive(:idv_gpo_letter_requested). with(success: true, resend: true) put :create