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/agreement_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def show
end

def update
skip_to_capture if params[:skip_upload]
skip_to_capture if params[:skip_hybrid_handoff] || params[:skip_upload]
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.

What do you think of changing the new parameter name to is_mobile or mobile_device_detected or something like that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I want to keep it as skip_hybrid_handoff. At this moment it makes slighly more sense to me to think of it as the client saying "I don't need to see the hybrid handoff screen" rather than the server saying "you're probably a mobile device with a camera, so I won't show you the hybrid handoff screen".


result = Idv::ConsentForm.new.submit(consent_form_params)

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/getting_started_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def show

def update
flow_session[:skip_upload_step] = true unless FeatureManagement.idv_allow_hybrid_flow?
skip_to_capture if params[:skip_upload]
skip_to_capture if params[:skip_hybrid_handoff] || params[:skip_upload]

result = Idv::ConsentForm.new.submit(consent_form_params)

Expand Down
11 changes: 10 additions & 1 deletion app/javascript/packs/document-capture-welcome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ import { isCameraCapableMobile } from '@18f/identity-device';

if (isCameraCapableMobile()) {
const form = document.querySelector<HTMLFormElement>('.js-consent-continue-form')!;

// Tell the backend that we're on a device that can take its own pictures, so we don't need
// to show the user the hybrid handoff screen.
const input = document.createElement('input');
input.type = 'hidden';
input.name = 'skip_upload';
input.name = 'skip_hybrid_handoff';
form.appendChild(input);

// TEMP: Send skip_upload as well to account for 50/50 state during deploy
const compatibilityInput = document.createElement('input');
compatibilityInput.type = 'hidden';
compatibilityInput.name = 'skip_upload';
form.appendChild(compatibilityInput);
}
77 changes: 76 additions & 1 deletion spec/controllers/idv/agreement_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,85 @@
}.merge(ab_test_args)
end

let(:skip_upload) { nil }

let(:skip_hybrid_handoff) { nil }

let(:params) do
{
doc_auth: {
ial2_consent_given: 1,
},
skip_hybrid_handoff: skip_hybrid_handoff,
skip_upload: skip_upload,
}.compact
end

it 'sends analytics_submitted event with consent given' do
put :update, params: { doc_auth: { ial2_consent_given: 1 } }
put :update, params: params

expect(@analytics).to have_logged_event(analytics_name, analytics_args)
end

it 'does not set flow_path' do
expect do
put :update, params: params
end.not_to change {
subject.idv_session.flow_path
}.from(nil)
end

it 'redirects to hybrid handoff' do
put :update, params: params
expect(response).to redirect_to(idv_hybrid_handoff_url)
end

context 'skip_upload present in params' do
let(:skip_upload) { '' }
it 'sets flow_path to standard' do
expect do
put :update, params: params
end.to change {
subject.idv_session.flow_path
}.from(nil).to('standard')
end

it 'sets flow_session[:skip_upload_step] to true' do
expect do
put :update, params: params
end.to change {
subject.flow_session[:skip_upload_step]
}.from(nil).to(true)
end

it 'redirects to hybrid handoff' do
put :update, params: params
expect(response).to redirect_to(idv_hybrid_handoff_url)
end
end

context 'skip_hybrid_handoff present in params' do
let(:skip_hybrid_handoff) { '' }
it 'sets flow_path to standard' do
expect do
put :update, params: params
end.to change {
subject.idv_session.flow_path
}.from(nil).to('standard')
end

it 'sets flow_session[:skip_upload_step] to true' do
expect do
put :update, params: params
end.to change {
subject.flow_session[:skip_upload_step]
}.from(nil).to(true)
end

it 'redirects to hybrid handoff' do
put :update, params: params
expect(response).to redirect_to(idv_hybrid_handoff_url)
end
end
end
end
81 changes: 78 additions & 3 deletions spec/controllers/idv/getting_started_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,28 @@
}.merge(ab_test_args)
end

let(:skip_upload) { nil }

let(:skip_hybrid_handoff) { nil }

let(:params) do
{
doc_auth: {
ial2_consent_given: 1,
},
skip_hybrid_handoff: skip_hybrid_handoff,
skip_upload: skip_upload,
}.compact
end

it 'sends analytics_submitted event with consent given' do
put :update, params: { doc_auth: { ial2_consent_given: 1 } }
put :update, params: params

expect(@analytics).to have_logged_event(analytics_name, analytics_args)
end

it 'creates a document capture session' do
expect { put :update, params: { doc_auth: { ial2_consent_given: 1 } } }.
expect { put :update, params: params }.
to change { subject.user_session['idv/doc_auth'][:document_capture_session_uuid] }.from(nil)
end

Expand All @@ -123,11 +137,72 @@
end

it 'cancels all previous establishing enrollments' do
put :update, params: { doc_auth: { ial2_consent_given: 1 } }
put :update, params: params

expect(enrollment.reload.status).to eq('cancelled')
expect(user.establishing_in_person_enrollment).to be_blank
end
end

it 'does not set flow_path' do
expect do
put :update, params: params
end.not_to change {
subject.idv_session.flow_path
}.from(nil)
end

it 'redirects to hybrid handoff' do
put :update, params: params
expect(response).to redirect_to(idv_hybrid_handoff_url)
end

context 'skip_upload present in params' do
let(:skip_upload) { '' }
it 'sets flow_path to standard' do
expect do
put :update, params: params
end.to change {
subject.idv_session.flow_path
}.from(nil).to('standard')
end

it 'sets flow_session[:skip_upload_step] to true' do
expect do
put :update, params: params
end.to change {
subject.flow_session[:skip_upload_step]
}.from(nil).to(true)
end

it 'redirects to hybrid handoff' do
put :update, params: params
expect(response).to redirect_to(idv_hybrid_handoff_url)
end
end

context 'skip_hybrid_handoff present in params' do
let(:skip_hybrid_handoff) { '' }
it 'sets flow_path to standard' do
expect do
put :update, params: params
end.to change {
subject.idv_session.flow_path
}.from(nil).to('standard')
end

it 'sets flow_session[:skip_upload_step] to true' do
expect do
put :update, params: params
end.to change {
subject.flow_session[:skip_upload_step]
}.from(nil).to(true)
end

it 'redirects to hybrid handoff' do
put :update, params: params
expect(response).to redirect_to(idv_hybrid_handoff_url)
end
end
end
end