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
1 change: 1 addition & 0 deletions app/controllers/idv/gpo_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def gpo_mail_service

def update_tracking
analytics.idv_gpo_address_letter_requested(resend: resend_requested?)
irs_attempts_api_tracker.idv_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
11 changes: 11 additions & 0 deletions app/services/irs_attempts_api/tracker_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ def idv_document_upload_rate_limited
)
end

# @param [Boolean] success
# @param [String] resend
# The Address validation letter has been requested by user
def idv_letter_requested(success:, resend:)
track_event(
:idv_letter_requested,
success: success,
resend: resend,
)
end

# @param [Boolean] success
# @param [String] phone_number
# The phone upload link was sent during the IDV process
Expand Down
15 changes: 15 additions & 0 deletions spec/controllers/idv/gpo_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
let(:user) { create(:user) }

before { stub_analytics }
before { stub_attempts_tracker }

describe 'before_actions' do
it 'includes authentication before_action' do
Expand Down Expand Up @@ -81,6 +82,13 @@
expect(response).to redirect_to idv_review_path
expect(subject.idv_session.address_verification_mechanism).to eq :gpo
end

it 'logs attempts api tracking' do
expect(@irs_attempts_api_tracker).to receive(:idv_letter_requested).
with(success: true, resend: false)

put :create
end
end

context 'resending a letter' do
Expand All @@ -102,6 +110,13 @@
expect_resend_letter_to_send_letter_and_redirect(otp: true)
end

it 'logs attempts api tracking' do
expect(@irs_attempts_api_tracker).to receive(:idv_letter_requested).
with(success: true, resend: true)

put :create
end

it 'redirects to capture password if pii is locked' do
pii_cacher = instance_double(Pii::Cacher)
allow(pii_cacher).to receive(:fetch).and_return(nil)
Expand Down