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
7 changes: 3 additions & 4 deletions app/controllers/idv/phone_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def new

def create
result = idv_form.submit(step_params)
analytics.track_event(Analytics::IDV_PHONE_CONFIRMATION_FORM, result.to_h)
analytics.idv_phone_confirmation_form_submitted(**result.to_h)
flash[:error] = result.first_error_message if !result.success?
return render :new, locals: { gpo_letter_available: gpo_letter_available } if !result.success?
submit_proofing_attempt
Expand Down Expand Up @@ -117,9 +117,8 @@ def failure_url(reason)
def async_state_done(async_state)
form_result = step.async_state_done(async_state)

analytics.track_event(
Analytics::IDV_PHONE_CONFIRMATION_VENDOR,
form_result.to_h.merge(
analytics.idv_phone_confirmation_vendor_submitted(
**form_result.to_h.merge(
pii_like_keypaths: [
[:errors, :phone],
[:context, :stages, :address],
Expand Down
2 changes: 0 additions & 2 deletions app/services/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ def session_started_at
IDV_INTRO_VISIT = 'IdV: intro visited'
IDV_JURISDICTION_VISIT = 'IdV: jurisdiction visited'
IDV_JURISDICTION_FORM = 'IdV: jurisdiction form submitted'
IDV_PHONE_CONFIRMATION_FORM = 'IdV: phone confirmation form'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is still referenced on main here, causing a 500 for me locally:

Analytics::IDV_PHONE_CONFIRMATION_FORM => :verify_phone,

I hit it after entering my password for a newly created account. Surprised that's not covered in a feature spec 🤔

Copy link
Copy Markdown
Contributor

@aduth aduth May 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprised that's not covered in a feature spec 🤔

Oh, it is 😬

https://app.circleci.com/pipelines/github/18F/identity-idp/72761/workflows/e4ed12fd-723b-4d2c-8d4e-9d6144db792c/jobs/122933

But how did it pass here? 🤔 Edit: Ah, I think it was unfortunate merge timing with #6202, which added the reference to the constant.

IDV_PHONE_CONFIRMATION_VENDOR = 'IdV: phone confirmation vendor'
IDV_PHONE_CONFIRMATION_OTP_RATE_LIMIT_ATTEMPTS = 'Idv: Phone OTP attempts rate limited'
IDV_PHONE_CONFIRMATION_OTP_RATE_LIMIT_LOCKED_OUT = 'Idv: Phone OTP rate limited user'
IDV_PHONE_CONFIRMATION_OTP_RATE_LIMIT_SENDS = 'Idv: Phone OTP sends rate limited'
Expand Down
34 changes: 34 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,40 @@ def idv_personal_key_confirm_visited(*)
track_event('IdV: personal key confirm visited')
end

# @identity.idp.event_name IdV: phone confirmation form
# @param [Boolean] success
# @param [Hash] errors
# The user submitted their phone on the phone confirmation page
def idv_phone_confirmation_form_submitted(
success:,
errors:,
**extra
)
track_event(
'IdV: phone confirmation form',
success: success,
errors: errors,
**extra,
)
end

# @identity.idp.event_name IdV: phone confirmation vendor
# @param [Boolean] success
# @param [Hash] errors
# The vendor finished the process of confirming the users phone
def idv_phone_confirmation_vendor_submitted(
success:,
errors:,
**extra
)
track_event(
'IdV: phone confirmation vendor',
success: success,
errors: errors,
**extra,
)
end

# @identity.idp.event_name IdV: phone confirmation otp submitted
# @param [Boolean] success
# @param [Hash] errors
Expand Down
12 changes: 6 additions & 6 deletions spec/controllers/idv/phone_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
}

expect(@analytics).to have_received(:track_event).with(
Analytics::IDV_PHONE_CONFIRMATION_FORM, result
'IdV: phone confirmation form', result
)
expect(subject.idv_session.vendor_phone_confirmation).to be_falsy
end
Expand Down Expand Up @@ -204,7 +204,7 @@
}

expect(@analytics).to have_received(:track_event).with(
Analytics::IDV_PHONE_CONFIRMATION_FORM, result
'IdV: phone confirmation form', result
)
end

Expand Down Expand Up @@ -313,10 +313,10 @@
}

expect(@analytics).to receive(:track_event).ordered.with(
Analytics::IDV_PHONE_CONFIRMATION_FORM, hash_including(:success)
'IdV: phone confirmation form', hash_including(:success)
)
expect(@analytics).to receive(:track_event).ordered.with(
Analytics::IDV_PHONE_CONFIRMATION_VENDOR, result
'IdV: phone confirmation vendor', result
)

put :create, params: { idv_phone_form: { phone: good_phone } }
Expand Down Expand Up @@ -365,13 +365,13 @@
}

expect(@analytics).to receive(:track_event).ordered.with(
Analytics::IDV_PHONE_CONFIRMATION_FORM, hash_including(:success)
'IdV: phone confirmation form', hash_including(:success)
)

put :create, params: { idv_phone_form: { phone: bad_phone } }

expect(@analytics).to receive(:track_event).ordered.with(
Analytics::IDV_PHONE_CONFIRMATION_VENDOR, result
'IdV: phone confirmation vendor', result
)
expect(response).to redirect_to idv_phone_path

Expand Down