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
2 changes: 1 addition & 1 deletion app/controllers/idv/gpo_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users/verify_personal_key_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 17 additions & 19 deletions app/services/irs_attempts_api/tracker_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ def idv_document_upload_submitted(
end

# @param [Boolean] success
# @param [Hash<Key, Array<String>>] 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

Expand All @@ -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<Key, Array<String>>] 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

Expand Down Expand Up @@ -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<Symbol,Array<Symbol>>] failure_reason
Expand All @@ -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
Expand Down
10 changes: 6 additions & 4 deletions spec/controllers/idv/gpo_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down