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: 2 additions & 0 deletions app/controllers/concerns/idv/verify_info_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,15 @@ def process_async_state(current_async_state)
end

if current_async_state.in_progress?
analytics.idv_doc_auth_verify_polling_wait_visited
render 'shared/wait'
return
end

return if confirm_not_rate_limited_after_doc_auth

if current_async_state.none?
analytics.idv_doc_auth_verify_visited(**analytics_arguments)
render :show
elsif current_async_state.missing?
analytics.idv_proofing_resolution_result_missing
Expand Down
1 change: 0 additions & 1 deletion app/controllers/idv/in_person/verify_info_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def show
@ssn = idv_session.ssn
@pii = pii

analytics.idv_doc_auth_verify_visited(**analytics_arguments)
Funnel::DocAuth::RegisterStep.new(current_user.id, sp_session[:issuer]).
call('verify', :view, true) # specify in_person?

Expand Down
1 change: 0 additions & 1 deletion app/controllers/idv/verify_info_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def show
@ssn = idv_session.ssn
@pii = pii

analytics.idv_doc_auth_verify_visited(**analytics_arguments)
Funnel::DocAuth::RegisterStep.new(current_user.id, sp_session[:issuer]).
call('verify', :view, true)

Expand Down
6 changes: 6 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,12 @@ def idv_doc_auth_submitted_pii_validation(
)
end

# User visits IdV verify step waiting on a resolution proofing job result
# @identity.idp.previous_event_name IdV: doc auth verify visited
def idv_doc_auth_verify_polling_wait_visited
track_event(:idv_doc_auth_verify_polling_wait_visited)
end

# rubocop:disable Layout/LineLength
# @param ab_tests [Hash] Object that holds A/B test data (legacy A/B tests may include attributes outside the scope of this object)
# @param acuant_sdk_upgrade_ab_test_bucket [String] A/B test bucket for Acuant document capture SDK upgrades
Expand Down
78 changes: 67 additions & 11 deletions spec/controllers/idv/in_person/verify_info_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,6 @@
end

describe '#show' do
let(:analytics_name) { 'IdV: doc auth verify visited' }
let(:analytics_args) do
{
analytics_id: 'In Person Proofing',
flow_path: 'standard',
step: 'verify',
}.merge(ab_test_args)
end

it 'renders the show template' do
get :show

Expand All @@ -75,10 +66,32 @@

expect(@analytics).to have_logged_event(
'IdV: doc auth verify visited',
hash_including(**analytics_args, same_address_as_id: true),
{
analytics_id: 'In Person Proofing',
flow_path: 'standard',
step: 'verify',
same_address_as_id: true,
}.merge(ab_test_args),
)
end

context 'when the user is rate limited' do
before do
RateLimiter.new(
user: subject.current_user,
rate_limit_type: :idv_resolution,
).increment_to_limited!
end

it 'redirects to rate limited url' do
get :show

expect(response).to redirect_to idv_session_errors_failure_url

expect(@analytics).to have_logged_event('Rate Limit Reached', limiter_type: :idv_resolution)
end
end

context 'when done' do
let(:review_status) { 'review' }
let(:async_state) { instance_double(ProofingSessionAsyncResult) }
Expand Down Expand Up @@ -111,10 +124,53 @@

expect(@analytics).to have_logged_event(
'IdV: doc auth verify proofing results',
hash_including(**analytics_args, success: true),
hash_including(
{
success: true,
analytics_id: 'In Person Proofing',
flow_path: 'standard',
step: 'verify',
same_address_as_id: true,
}.merge(ab_test_args),
),
)
end
end

context 'when the resolution proofing job has not completed' do
let(:async_state) do
ProofingSessionAsyncResult.new(status: ProofingSessionAsyncResult::IN_PROGRESS)
end

before do
allow(controller).to receive(:load_async_state).and_return(async_state)
end

it 'renders the wait template' do
get :show

expect(response).to render_template 'shared/wait'
expect(@analytics).to have_logged_event(:idv_doc_auth_verify_polling_wait_visited)
end
end

context 'when the resolution proofing job result is missing' do
let(:async_state) do
ProofingSessionAsyncResult.new(status: ProofingSessionAsyncResult::MISSING)
end

before do
allow(controller).to receive(:load_async_state).and_return(async_state)
end

it 'renders a timeout error' do
get :show

expect(response).to render_template :show
expect(controller.flash[:error]).to eq(I18n.t('idv.failure.timeout'))
expect(@analytics).to have_logged_event('IdV: proofing resolution result missing')
end
end
end

describe '#update' do
Expand Down
65 changes: 54 additions & 11 deletions spec/controllers/idv/verify_info_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@
end

describe '#show' do
let(:analytics_name) { 'IdV: doc auth verify visited' }
let(:analytics_args) do
{
analytics_id: 'Doc Auth',
flow_path: 'standard',
step: 'verify',
}.merge(ab_test_args)
end

it 'renders the show template' do
get :show

Expand All @@ -64,7 +55,14 @@
it 'sends analytics_visited event' do
get :show

expect(@analytics).to have_logged_event(analytics_name, analytics_args)
expect(@analytics).to have_logged_event(
'IdV: doc auth verify visited',
{
analytics_id: 'Doc Auth',
flow_path: 'standard',
step: 'verify',
}.merge(ab_test_args),
)
end

it 'updates DocAuthLog verify_view_count' do
Expand Down Expand Up @@ -126,6 +124,8 @@
get :show

expect(response).to redirect_to idv_session_errors_ssn_failure_url

expect(@analytics).to have_logged_event('Rate Limit Reached', limiter_type: :proof_ssn)
end
end

Expand All @@ -141,6 +141,8 @@
get :show

expect(response).to redirect_to idv_session_errors_failure_url

expect(@analytics).to have_logged_event('Rate Limit Reached', limiter_type: :idv_resolution)
end
end

Expand Down Expand Up @@ -292,7 +294,13 @@

expect(@analytics).to have_logged_event(
'IdV: doc auth verify proofing results',
hash_including(**analytics_args, success: true, analytics_id: 'Doc Auth'),
hash_including(
{
analytics_id: 'Doc Auth',
flow_path: 'standard',
step: 'verify',
}.merge(ab_test_args),
),
)
end
end
Expand Down Expand Up @@ -326,6 +334,41 @@
end
end
end

context 'when the resolution proofing job has not completed' do
let(:async_state) do
ProofingSessionAsyncResult.new(status: ProofingSessionAsyncResult::IN_PROGRESS)
end

before do
allow(controller).to receive(:load_async_state).and_return(async_state)
end

it 'renders the wait template' do
get :show

expect(response).to render_template 'shared/wait'
expect(@analytics).to have_logged_event(:idv_doc_auth_verify_polling_wait_visited)
end
end

context 'when the reolution proofing job result is missing' do
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.

Suggested change
context 'when the reolution proofing job result is missing' do
context 'when the resolution proofing job result is missing' do

let(:async_state) do
ProofingSessionAsyncResult.new(status: ProofingSessionAsyncResult::MISSING)
end

before do
allow(controller).to receive(:load_async_state).and_return(async_state)
end

it 'renders a timeout error' do
get :show

expect(response).to render_template :show
expect(controller.flash[:error]).to eq(I18n.t('idv.failure.timeout'))
expect(@analytics).to have_logged_event('IdV: proofing resolution result missing')
end
end
end

describe '#update' do
Expand Down