From 8af4ac32f32ca07fd7c9ec3cc102125cf9cce5ed Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Thu, 28 Sep 2023 17:15:01 -0400 Subject: [PATCH 01/14] init page if user has a phone to take pictures for A/B testing --- app/controllers/idv/smart_phone_controller.rb | 37 ++++++ app/views/idv/smart_phone/show.html.erb | 31 +++++ config/locales/doc_auth/en.yml | 4 + config/routes.rb | 1 + .../idv/smart_phone_controller_spec.rb | 110 ++++++++++++++++++ 5 files changed, 183 insertions(+) create mode 100644 app/controllers/idv/smart_phone_controller.rb create mode 100644 app/views/idv/smart_phone/show.html.erb create mode 100644 spec/controllers/idv/smart_phone_controller_spec.rb diff --git a/app/controllers/idv/smart_phone_controller.rb b/app/controllers/idv/smart_phone_controller.rb new file mode 100644 index 00000000000..ccbc5620251 --- /dev/null +++ b/app/controllers/idv/smart_phone_controller.rb @@ -0,0 +1,37 @@ +module Idv + class SmartPhoneController < ApplicationController + include ActionView::Helpers::DateHelper + include IdvStepConcern + include StepIndicatorConcern + + before_action :confirm_verify_info_step_needed + before_action :confirm_agreement_step_complete + before_action :confirm_hybrid_handoff_needed, only: :show + + def show + # analytics.idv_doc_auth_smart_phone_visited(**analytics_arguments) + + @title = t('doc_auth.headings.smart_phone') + end + + def confirm_agreement_step_complete + return if idv_session.idv_consent_given + + redirect_to idv_agreement_url + end + + def confirm_hybrid_handoff_needed + if idv_session.skip_hybrid_handoff? + redirect_to idv_hybrid_handoff_url + end + + if !FeatureManagement.idv_allow_hybrid_flow? + redirect_to idv_hybrid_handoff_url + end + + if idv_session.flow_path.present? + redirect_to idv_hybrid_handoff_url + end + end + end +end diff --git a/app/views/idv/smart_phone/show.html.erb b/app/views/idv/smart_phone/show.html.erb new file mode 100644 index 00000000000..5655e02ac3d --- /dev/null +++ b/app/views/idv/smart_phone/show.html.erb @@ -0,0 +1,31 @@ +<% title @title %> + +<% content_for(:pre_flash_content) do %> + <%= render StepIndicatorComponent.new( + steps: Idv::StepIndicatorConcern::STEP_INDICATOR_STEPS, + current_step: :verify_id, + locale_scope: 'idv', + class: 'margin-x-neg-2 margin-top-neg-4 tablet:margin-x-neg-6 tablet:margin-top-neg-4', + ) %> +<% end %> + +<%= render PageHeadingComponent.new.with_content(@title) %> + +
+ <%= button_to( + '', + method: 'get', + class: 'usa-button usa-button--wide usa-button--big', + ) do %> + <%= t('doc_auth.buttons.have_phone') %> + <% end %> +
+ +

+ <%= link_to( + t('doc_auth.smart_phone.do_not_have'), + '', + ) %> +

+ +<%= render 'idv/doc_auth/cancel', step: 'smart_phone' %> diff --git a/config/locales/doc_auth/en.yml b/config/locales/doc_auth/en.yml index 3045f1eba57..429decb713b 100644 --- a/config/locales/doc_auth/en.yml +++ b/config/locales/doc_auth/en.yml @@ -8,6 +8,7 @@ en: buttons: add_new_photos: Add new photos continue: Continue + have_phone: Yes, I have a phone take_or_upload_picture_html: 'Take photo or Upload photo' take_picture: Take photo @@ -145,6 +146,7 @@ en: lets_go: How verifying your identity works review_issues: Check your images and try again secure_account: Secure your account + smart_phone: Do you have a phone you can use to take photos of your ID? ssn: Enter your Social Security number ssn_update: Update your Social Security number text_message: We sent a message to your phone @@ -230,6 +232,8 @@ en: - 'Verify by mail: We’ll mail a letter to your home address. This takes 5 to 10 days.' welcome: 'You will need your:' + smart_phone: + do_not_have: I don’t have a phone tips: document_capture_header_text: 'For best results:' document_capture_hint: Must be a JPG or PNG diff --git a/config/routes.rb b/config/routes.rb index c453446771f..86b30ffb861 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -350,6 +350,7 @@ put '/phone_confirmation' => 'otp_verification#update', as: :nil get '/review' => 'review#new' put '/review' => 'review#create' + get '/smart_phone' => 'smart_phone#show' get '/session/errors/warning' => 'session_errors#warning' get '/session/errors/state_id_warning' => 'session_errors#state_id_warning' get '/phone/errors/timeout' => 'phone_errors#timeout' diff --git a/spec/controllers/idv/smart_phone_controller_spec.rb b/spec/controllers/idv/smart_phone_controller_spec.rb new file mode 100644 index 00000000000..64c6a801607 --- /dev/null +++ b/spec/controllers/idv/smart_phone_controller_spec.rb @@ -0,0 +1,110 @@ +require 'rails_helper' + +RSpec.describe Idv::SmartPhoneController do + include IdvHelper + + let(:user) { create(:user) } + + before do + stub_sign_in(user) + stub_analytics + stub_attempts_tracker + subject.user_session['idv/doc_auth'] = {} + subject.idv_session.idv_consent_given = true + end + + describe 'before_actions' do + it 'includes authentication before_action' do + expect(subject).to have_actions( + :before, + :confirm_two_factor_authenticated, + ) + end + + it 'includes outage before_action' do + expect(subject).to have_actions( + :before, + :check_for_mail_only_outage, + ) + end + + it 'checks that agreement step is complete' do + expect(subject).to have_actions( + :before, + :confirm_agreement_step_complete, + ) + end + + it 'checks that hybrid_handoff is needed' do + expect(subject).to have_actions( + :before, + :confirm_hybrid_handoff_needed, + ) + end + end + + describe '#show' do + let(:analytics_name) { 'IdV: doc auth smart phone visited' } + let(:analytics_args) do + { + step: 'smart_phone', + analytics_id: 'Doc Auth', + skip_hybrid_handoff: nil, + irs_reproofing: false, + }.merge(ab_test_args) + end + + it 'renders the show template' do + get :show + + expect(response).to render_template :show + end + + xit 'sends analytics_visited event' do + get :show + + expect(@analytics).to have_logged_event(analytics_name, analytics_args) + end + + context 'agreement step is not complete' do + before do + subject.idv_session.idv_consent_given = nil + end + + it 'redirects to idv_agreement_url' do + get :show + + expect(response).to redirect_to(idv_agreement_url) + end + end + + context 'hybrid_handoff already visited' do + it 'redirects to document_capture in standard flow' do + subject.idv_session.flow_path = 'standard' + + get :show + + expect(response).to redirect_to(idv_hybrid_handoff_url) + end + + it 'redirects to link_sent in hybrid flow' do + subject.idv_session.flow_path = 'hybrid' + + get :show + + expect(response).to redirect_to(idv_hybrid_handoff_url) + end + end + + context 'hybrid flow is not available' do + before do + allow(FeatureManagement).to receive(:idv_allow_hybrid_flow?).and_return(false) + end + + it 'redirects the user straight to document capture' do + get :show + expect(response).to redirect_to(idv_hybrid_handoff_url) + end + end + end +end From 059ef7b8545a233a22646833272b74372c1a85c0 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Thu, 28 Sep 2023 17:15:32 -0400 Subject: [PATCH 02/14] changelog: Upcoming Features, Document Authentication, IdV page to ask user if they have a phone that can take photos From d80c4b3e9eccf7672627ca07936c10f2916d3ece Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Fri, 29 Sep 2023 12:07:25 -0400 Subject: [PATCH 03/14] add french and spanish translations --- config/locales/doc_auth/en.yml | 4 ++-- config/locales/doc_auth/es.yml | 4 ++++ config/locales/doc_auth/fr.yml | 4 ++++ config/routes.rb | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config/locales/doc_auth/en.yml b/config/locales/doc_auth/en.yml index 429decb713b..b5f01497c83 100644 --- a/config/locales/doc_auth/en.yml +++ b/config/locales/doc_auth/en.yml @@ -144,9 +144,9 @@ en: hybrid_handoff: How would you like to add your ID? interstitial: We are processing your images lets_go: How verifying your identity works + phone_question: Do you have a phone you can use to take photos of your ID? review_issues: Check your images and try again secure_account: Secure your account - smart_phone: Do you have a phone you can use to take photos of your ID? ssn: Enter your Social Security number ssn_update: Update your Social Security number text_message: We sent a message to your phone @@ -232,7 +232,7 @@ en: - 'Verify by mail: We’ll mail a letter to your home address. This takes 5 to 10 days.' welcome: 'You will need your:' - smart_phone: + phone_question: do_not_have: I don’t have a phone tips: document_capture_header_text: 'For best results:' diff --git a/config/locales/doc_auth/es.yml b/config/locales/doc_auth/es.yml index 324beeb3615..b483a5ca35a 100644 --- a/config/locales/doc_auth/es.yml +++ b/config/locales/doc_auth/es.yml @@ -8,6 +8,7 @@ es: buttons: add_new_photos: Añadir nuevas fotos continue: Continuar + have_phone: Si, tengo un telefono take_or_upload_picture_html: 'Toma una foto o Sube una foto' take_picture: Toma una foto @@ -172,6 +173,7 @@ es: hybrid_handoff: '¿Cómo desea añadir su documento de identidad?' interstitial: Estamos procesando sus imágenes lets_go: Cómo funciona la verificación de su identidad + phone_question: ¿Tiene un teléfono que pueda usar para tomar fotografías de su identificación? review_issues: Revise sus imágenes e inténtelo de nuevo secure_account: Asegure su cuenta ssn: Ingrese su número de Seguro Social @@ -267,6 +269,8 @@ es: - 'Verificar por correo: Le enviaremos una carta a su domicilio. Esto tarda entre 5 y 10 días.' welcome: 'Necesitará su:' + phone_question: + do_not_have: No tengo telefono tips: document_capture_header_text: 'Para obtener los mejores resultados:' document_capture_hint: Debe ser un JPG o PNG diff --git a/config/locales/doc_auth/fr.yml b/config/locales/doc_auth/fr.yml index cfdf5e88925..501e6c8c467 100644 --- a/config/locales/doc_auth/fr.yml +++ b/config/locales/doc_auth/fr.yml @@ -8,6 +8,7 @@ fr: buttons: add_new_photos: Ajoutez de nouvelles photos continue: Continuer + have_phone: Oui, j'ai un téléphone take_or_upload_picture_html: 'Prendre une photo ou Télécharger une photo' take_picture: Prendre une photo @@ -178,6 +179,7 @@ fr: hybrid_handoff: Comment voulez-vous ajouter votre identifiant ? interstitial: Nous traitons vos images lets_go: Comment fonctionne la vérification de votre identité + phone_question: Avez-vous un téléphone que vous pouvez utiliser pour prendre des photos de votre pièce d'identité ? review_issues: Vérifiez vos images et essayez à nouveau secure_account: Sécuriser votre compte ssn: Saisissez votre numéro de sécurité sociale @@ -276,6 +278,8 @@ fr: lettre à votre adresse personnelle. Cela prend 5 à 10 jours.' welcome: 'Vous aurez besoin de votre:' + phone_question: + do_not_have: Je n'ai pas de téléphone tips: document_capture_header_text: 'Pour obtenir les meilleurs résultats:' document_capture_hint: Doit être un JPG ou PNG diff --git a/config/routes.rb b/config/routes.rb index 86b30ffb861..597c7019208 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -350,7 +350,7 @@ put '/phone_confirmation' => 'otp_verification#update', as: :nil get '/review' => 'review#new' put '/review' => 'review#create' - get '/smart_phone' => 'smart_phone#show' + get '/phone_question' => 'phone_question#show' get '/session/errors/warning' => 'session_errors#warning' get '/session/errors/state_id_warning' => 'session_errors#state_id_warning' get '/phone/errors/timeout' => 'phone_errors#timeout' From 43fa13bdab334c3e3ef958405882f18d390cacb7 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Fri, 29 Sep 2023 12:07:59 -0400 Subject: [PATCH 04/14] rename smart_phone to phone_question page --- ...mart_phone_controller.rb => phone_question_controller.rb} | 4 ++-- app/views/idv/{smart_phone => phone_question}/show.html.erb | 5 +++-- ..._controller_spec.rb => phone_question_controller_spec.rb} | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) rename app/controllers/idv/{smart_phone_controller.rb => phone_question_controller.rb} (88%) rename app/views/idv/{smart_phone => phone_question}/show.html.erb (86%) rename spec/controllers/idv/{smart_phone_controller_spec.rb => phone_question_controller_spec.rb} (98%) diff --git a/app/controllers/idv/smart_phone_controller.rb b/app/controllers/idv/phone_question_controller.rb similarity index 88% rename from app/controllers/idv/smart_phone_controller.rb rename to app/controllers/idv/phone_question_controller.rb index ccbc5620251..7edb3d3a2e9 100644 --- a/app/controllers/idv/smart_phone_controller.rb +++ b/app/controllers/idv/phone_question_controller.rb @@ -1,5 +1,5 @@ module Idv - class SmartPhoneController < ApplicationController + class PhoneQuestionController < ApplicationController include ActionView::Helpers::DateHelper include IdvStepConcern include StepIndicatorConcern @@ -11,7 +11,7 @@ class SmartPhoneController < ApplicationController def show # analytics.idv_doc_auth_smart_phone_visited(**analytics_arguments) - @title = t('doc_auth.headings.smart_phone') + @title = t('doc_auth.headings.phone_question') end def confirm_agreement_step_complete diff --git a/app/views/idv/smart_phone/show.html.erb b/app/views/idv/phone_question/show.html.erb similarity index 86% rename from app/views/idv/smart_phone/show.html.erb rename to app/views/idv/phone_question/show.html.erb index 5655e02ac3d..7faff61162b 100644 --- a/app/views/idv/smart_phone/show.html.erb +++ b/app/views/idv/phone_question/show.html.erb @@ -22,10 +22,11 @@

+ <%= link_to( - t('doc_auth.smart_phone.do_not_have'), + t('doc_auth.phone_question.do_not_have'), '', ) %>

-<%= render 'idv/doc_auth/cancel', step: 'smart_phone' %> +<%= render 'idv/doc_auth/cancel', step: 'phone_question' %> diff --git a/spec/controllers/idv/smart_phone_controller_spec.rb b/spec/controllers/idv/phone_question_controller_spec.rb similarity index 98% rename from spec/controllers/idv/smart_phone_controller_spec.rb rename to spec/controllers/idv/phone_question_controller_spec.rb index 64c6a801607..ac834b3e5c0 100644 --- a/spec/controllers/idv/smart_phone_controller_spec.rb +++ b/spec/controllers/idv/phone_question_controller_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe Idv::SmartPhoneController do +RSpec.describe Idv::PhoneQuestionController do include IdvHelper let(:user) { create(:user) } From 306364ac90cfd2547385db25cb753e9ca452eb24 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Fri, 29 Sep 2023 12:32:14 -0400 Subject: [PATCH 05/14] add feature tests for phone question page --- .../idv/phone_question_controller.rb | 2 -- .../idv/doc_auth/phone_question_spec.rb | 29 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 spec/features/idv/doc_auth/phone_question_spec.rb diff --git a/app/controllers/idv/phone_question_controller.rb b/app/controllers/idv/phone_question_controller.rb index 7edb3d3a2e9..4f4d2f5244f 100644 --- a/app/controllers/idv/phone_question_controller.rb +++ b/app/controllers/idv/phone_question_controller.rb @@ -9,8 +9,6 @@ class PhoneQuestionController < ApplicationController before_action :confirm_hybrid_handoff_needed, only: :show def show - # analytics.idv_doc_auth_smart_phone_visited(**analytics_arguments) - @title = t('doc_auth.headings.phone_question') end diff --git a/spec/features/idv/doc_auth/phone_question_spec.rb b/spec/features/idv/doc_auth/phone_question_spec.rb new file mode 100644 index 00000000000..413be8c5589 --- /dev/null +++ b/spec/features/idv/doc_auth/phone_question_spec.rb @@ -0,0 +1,29 @@ +require 'rails_helper' + +RSpec.feature 'phone question step' do + include IdvStepHelper + include DocAuthHelper + + before do + sign_in_and_2fa_user + end + + context 'on a desktop device send link' do + before do + complete_doc_auth_steps_before_hybrid_handoff_step + visit(idv_phone_question_url) + end + + it 'contains phone question header' do + expect(page).to have_content(t('doc_auth.headings.phone_question')) + end + + it 'contains option to confirm having phone' do + expect(page).to have_content(t('doc_auth.buttons.have_phone')) + end + + it 'contains option to confirm not having phone' do + expect(page).to have_content(t('doc_auth.phone_question.do_not_have')) + end + end +end From 41908b5a850951aa4e037560cc9b30f47266a1f9 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Fri, 29 Sep 2023 13:02:57 -0400 Subject: [PATCH 06/14] happy linting --- config/locales/doc_auth/es.yml | 3 ++- config/locales/doc_auth/fr.yml | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/locales/doc_auth/es.yml b/config/locales/doc_auth/es.yml index b483a5ca35a..c23ed093f36 100644 --- a/config/locales/doc_auth/es.yml +++ b/config/locales/doc_auth/es.yml @@ -173,7 +173,8 @@ es: hybrid_handoff: '¿Cómo desea añadir su documento de identidad?' interstitial: Estamos procesando sus imágenes lets_go: Cómo funciona la verificación de su identidad - phone_question: ¿Tiene un teléfono que pueda usar para tomar fotografías de su identificación? + phone_question: ¿Tiene un teléfono que pueda usar para tomar fotografías de su + identificación? review_issues: Revise sus imágenes e inténtelo de nuevo secure_account: Asegure su cuenta ssn: Ingrese su número de Seguro Social diff --git a/config/locales/doc_auth/fr.yml b/config/locales/doc_auth/fr.yml index 501e6c8c467..a054256846d 100644 --- a/config/locales/doc_auth/fr.yml +++ b/config/locales/doc_auth/fr.yml @@ -8,7 +8,7 @@ fr: buttons: add_new_photos: Ajoutez de nouvelles photos continue: Continuer - have_phone: Oui, j'ai un téléphone + have_phone: Oui, j’ai un téléphone take_or_upload_picture_html: 'Prendre une photo ou Télécharger une photo' take_picture: Prendre une photo @@ -179,7 +179,8 @@ fr: hybrid_handoff: Comment voulez-vous ajouter votre identifiant ? interstitial: Nous traitons vos images lets_go: Comment fonctionne la vérification de votre identité - phone_question: Avez-vous un téléphone que vous pouvez utiliser pour prendre des photos de votre pièce d'identité ? + phone_question: Avez-vous un téléphone que vous pouvez utiliser pour prendre des + photos de votre pièce d’identité ? review_issues: Vérifiez vos images et essayez à nouveau secure_account: Sécuriser votre compte ssn: Saisissez votre numéro de sécurité sociale @@ -279,7 +280,7 @@ fr: jours.' welcome: 'Vous aurez besoin de votre:' phone_question: - do_not_have: Je n'ai pas de téléphone + do_not_have: Je n’ai pas de téléphone tips: document_capture_header_text: 'Pour obtenir les meilleurs résultats:' document_capture_hint: Doit être un JPG ou PNG From 4d3a50fffa3145435ba0e70da3f0546dd2955c10 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Fri, 29 Sep 2023 15:40:51 -0400 Subject: [PATCH 07/14] remove future test stubbing --- .../idv/phone_question_controller_spec.rb | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/spec/controllers/idv/phone_question_controller_spec.rb b/spec/controllers/idv/phone_question_controller_spec.rb index ac834b3e5c0..740e31a537c 100644 --- a/spec/controllers/idv/phone_question_controller_spec.rb +++ b/spec/controllers/idv/phone_question_controller_spec.rb @@ -44,28 +44,12 @@ end describe '#show' do - let(:analytics_name) { 'IdV: doc auth smart phone visited' } - let(:analytics_args) do - { - step: 'smart_phone', - analytics_id: 'Doc Auth', - skip_hybrid_handoff: nil, - irs_reproofing: false, - }.merge(ab_test_args) - end - it 'renders the show template' do get :show expect(response).to render_template :show end - xit 'sends analytics_visited event' do - get :show - - expect(@analytics).to have_logged_event(analytics_name, analytics_args) - end - context 'agreement step is not complete' do before do subject.idv_session.idv_consent_given = nil From b6332179dbf3494f58dc277c6b10c05ca812fe27 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Fri, 29 Sep 2023 15:44:15 -0400 Subject: [PATCH 08/14] add skip phone_question step if on mobile --- spec/controllers/idv/phone_question_controller_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/controllers/idv/phone_question_controller_spec.rb b/spec/controllers/idv/phone_question_controller_spec.rb index 740e31a537c..f35e11dc242 100644 --- a/spec/controllers/idv/phone_question_controller_spec.rb +++ b/spec/controllers/idv/phone_question_controller_spec.rb @@ -80,6 +80,16 @@ end end + context 'on mobile device' do + it 'redirects to hybrid_handoff controller' do + subject.idv_session.skip_hybrid_handoff = true + + get :show + + expect(response).to redirect_to(idv_hybrid_handoff_url) + end + end + context 'hybrid flow is not available' do before do allow(FeatureManagement).to receive(:idv_allow_hybrid_flow?).and_return(false) From 186bf1eb10f6997f90ce5fa75df010cc1f96c6d0 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Fri, 29 Sep 2023 16:01:24 -0400 Subject: [PATCH 09/14] updated phone_question page translations as per LG-11079 and LG-11078 --- config/locales/doc_auth/es.yml | 7 +++---- config/locales/doc_auth/fr.yml | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/config/locales/doc_auth/es.yml b/config/locales/doc_auth/es.yml index c23ed093f36..ad64998f200 100644 --- a/config/locales/doc_auth/es.yml +++ b/config/locales/doc_auth/es.yml @@ -8,7 +8,7 @@ es: buttons: add_new_photos: Añadir nuevas fotos continue: Continuar - have_phone: Si, tengo un telefono + have_phone: Sí tengo teléfono take_or_upload_picture_html: 'Toma una foto o Sube una foto' take_picture: Toma una foto @@ -173,8 +173,7 @@ es: hybrid_handoff: '¿Cómo desea añadir su documento de identidad?' interstitial: Estamos procesando sus imágenes lets_go: Cómo funciona la verificación de su identidad - phone_question: ¿Tiene un teléfono que pueda usar para tomar fotografías de su - identificación? + phone_question: ¿Tiene un teléfono con el que pueda tomar fotos de su documento de identidad? review_issues: Revise sus imágenes e inténtelo de nuevo secure_account: Asegure su cuenta ssn: Ingrese su número de Seguro Social @@ -271,7 +270,7 @@ es: domicilio. Esto tarda entre 5 y 10 días.' welcome: 'Necesitará su:' phone_question: - do_not_have: No tengo telefono + do_not_have: No tengo teléfono tips: document_capture_header_text: 'Para obtener los mejores resultados:' document_capture_hint: Debe ser un JPG o PNG diff --git a/config/locales/doc_auth/fr.yml b/config/locales/doc_auth/fr.yml index a054256846d..ae0b522cad6 100644 --- a/config/locales/doc_auth/fr.yml +++ b/config/locales/doc_auth/fr.yml @@ -8,7 +8,7 @@ fr: buttons: add_new_photos: Ajoutez de nouvelles photos continue: Continuer - have_phone: Oui, j’ai un téléphone + have_phone: Oui j’ai un téléphone take_or_upload_picture_html: 'Prendre une photo ou Télécharger une photo' take_picture: Prendre une photo @@ -179,8 +179,7 @@ fr: hybrid_handoff: Comment voulez-vous ajouter votre identifiant ? interstitial: Nous traitons vos images lets_go: Comment fonctionne la vérification de votre identité - phone_question: Avez-vous un téléphone que vous pouvez utiliser pour prendre des - photos de votre pièce d’identité ? + phone_question: Avez-vous un téléphone que vous pouvez utiliser pour prendre des photos de votre identifiant? review_issues: Vérifiez vos images et essayez à nouveau secure_account: Sécuriser votre compte ssn: Saisissez votre numéro de sécurité sociale From 1b84af2d4520a68c426a38a4e19022cee516db2e Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Fri, 29 Sep 2023 16:19:27 -0400 Subject: [PATCH 10/14] happy linting --- config/locales/doc_auth/es.yml | 3 ++- config/locales/doc_auth/fr.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config/locales/doc_auth/es.yml b/config/locales/doc_auth/es.yml index ad64998f200..96d3c2dad44 100644 --- a/config/locales/doc_auth/es.yml +++ b/config/locales/doc_auth/es.yml @@ -173,7 +173,8 @@ es: hybrid_handoff: '¿Cómo desea añadir su documento de identidad?' interstitial: Estamos procesando sus imágenes lets_go: Cómo funciona la verificación de su identidad - phone_question: ¿Tiene un teléfono con el que pueda tomar fotos de su documento de identidad? + phone_question: ¿Tiene un teléfono con el que pueda tomar fotos de su documento + de identidad? review_issues: Revise sus imágenes e inténtelo de nuevo secure_account: Asegure su cuenta ssn: Ingrese su número de Seguro Social diff --git a/config/locales/doc_auth/fr.yml b/config/locales/doc_auth/fr.yml index ae0b522cad6..3ec6678a271 100644 --- a/config/locales/doc_auth/fr.yml +++ b/config/locales/doc_auth/fr.yml @@ -179,7 +179,8 @@ fr: hybrid_handoff: Comment voulez-vous ajouter votre identifiant ? interstitial: Nous traitons vos images lets_go: Comment fonctionne la vérification de votre identité - phone_question: Avez-vous un téléphone que vous pouvez utiliser pour prendre des photos de votre identifiant? + phone_question: Avez-vous un téléphone que vous pouvez utiliser pour prendre des + photos de votre identifiant? review_issues: Vérifiez vos images et essayez à nouveau secure_account: Sécuriser votre compte ssn: Saisissez votre numéro de sécurité sociale From 501b5719bc430508f8934fdf7fc4eb86f32a4f30 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Mon, 2 Oct 2023 12:35:41 -0400 Subject: [PATCH 11/14] move confirm_hybrid_handoff_needed into idv step concern --- app/controllers/concerns/idv_step_concern.rb | 34 +++++++++++++++++++ .../idv/hybrid_handoff_controller.rb | 34 ------------------- .../idv/phone_question_controller.rb | 14 -------- 3 files changed, 34 insertions(+), 48 deletions(-) diff --git a/app/controllers/concerns/idv_step_concern.rb b/app/controllers/concerns/idv_step_concern.rb index a2a9f9695e0..b643c810ff4 100644 --- a/app/controllers/concerns/idv_step_concern.rb +++ b/app/controllers/concerns/idv_step_concern.rb @@ -45,6 +45,28 @@ def flow_path idv_session.flow_path end + def confirm_hybrid_handoff_needed + setup_for_redo if params[:redo] + + if idv_session.skip_hybrid_handoff? + # We previously skipped hybrid handoff. Keep doing that. + idv_session.flow_path = 'standard' + end + + if !FeatureManagement.idv_allow_hybrid_flow? + # When hybrid flow is unavailable, skip it. + # But don't store that we skipped it in idv_session, in case it is back to + # available when the user tries to redo document capture. + idv_session.flow_path = 'standard' + end + + if idv_session.flow_path == 'standard' + redirect_to idv_document_capture_url + elsif idv_session.flow_path == 'hybrid' + redirect_to idv_link_sent_url + end + end + private def confirm_ssn_step_complete @@ -96,4 +118,16 @@ def extra_analytics_properties end extra end + + def setup_for_redo + idv_session.redo_document_capture = true + + # If we previously skipped hybrid handoff for the user (because they're on a mobile + # device with a camera), skip it _again_ here. + if idv_session.skip_hybrid_handoff? + idv_session.flow_path = 'standard' + else + idv_session.flow_path = nil + end + end end diff --git a/app/controllers/idv/hybrid_handoff_controller.rb b/app/controllers/idv/hybrid_handoff_controller.rb index 0c26a3972d9..d060691386b 100644 --- a/app/controllers/idv/hybrid_handoff_controller.rb +++ b/app/controllers/idv/hybrid_handoff_controller.rb @@ -192,40 +192,6 @@ def confirm_agreement_step_complete redirect_to idv_agreement_url end - def confirm_hybrid_handoff_needed - setup_for_redo if params[:redo] - - if idv_session.skip_hybrid_handoff? - # We previously skipped hybrid handoff. Keep doing that. - idv_session.flow_path = 'standard' - end - - if !FeatureManagement.idv_allow_hybrid_flow? - # When hybrid flow is unavailable, skip it. - # But don't store that we skipped it in idv_session, in case it is back to - # available when the user tries to redo document capture. - idv_session.flow_path = 'standard' - end - - if idv_session.flow_path == 'standard' - redirect_to idv_document_capture_url - elsif idv_session.flow_path == 'hybrid' - redirect_to idv_link_sent_url - end - end - - def setup_for_redo - idv_session.redo_document_capture = true - - # If we previously skipped hybrid handoff for the user (because they're on a mobile - # device with a camera), skip it _again_ here. - if idv_session.skip_hybrid_handoff? - idv_session.flow_path = 'standard' - else - idv_session.flow_path = nil - end - end - def formatted_destination_phone raw_phone = params.require(:doc_auth).permit(:phone) PhoneFormatter.format(raw_phone, country_code: 'US') diff --git a/app/controllers/idv/phone_question_controller.rb b/app/controllers/idv/phone_question_controller.rb index 4f4d2f5244f..2705fc12170 100644 --- a/app/controllers/idv/phone_question_controller.rb +++ b/app/controllers/idv/phone_question_controller.rb @@ -17,19 +17,5 @@ def confirm_agreement_step_complete redirect_to idv_agreement_url end - - def confirm_hybrid_handoff_needed - if idv_session.skip_hybrid_handoff? - redirect_to idv_hybrid_handoff_url - end - - if !FeatureManagement.idv_allow_hybrid_flow? - redirect_to idv_hybrid_handoff_url - end - - if idv_session.flow_path.present? - redirect_to idv_hybrid_handoff_url - end - end end end From ffa15ef609d5b32f2f24efc71b07583176510f40 Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Mon, 2 Oct 2023 12:36:00 -0400 Subject: [PATCH 12/14] add spec for cancel button on phone_question page --- .../idv/doc_auth/phone_question_spec.rb | 46 +++++++++++++------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/spec/features/idv/doc_auth/phone_question_spec.rb b/spec/features/idv/doc_auth/phone_question_spec.rb index 413be8c5589..79d1faf6bd5 100644 --- a/spec/features/idv/doc_auth/phone_question_spec.rb +++ b/spec/features/idv/doc_auth/phone_question_spec.rb @@ -1,29 +1,45 @@ require 'rails_helper' -RSpec.feature 'phone question step' do +RSpec.feature 'phone question step', :js do include IdvStepHelper include DocAuthHelper + let(:fake_analytics) { FakeAnalytics.new } + before do + allow_any_instance_of(ApplicationController).to receive(:analytics).and_return(fake_analytics) sign_in_and_2fa_user + complete_doc_auth_steps_before_hybrid_handoff_step + visit(idv_phone_question_url) + end + + it 'contains phone question header' do + expect(page).to have_content(t('doc_auth.headings.phone_question')) + end + + it 'contains option to confirm having phone' do + expect(page).to have_content(t('doc_auth.buttons.have_phone')) + end + + it 'contains option to confirm not having phone' do + expect(page).to have_content(t('doc_auth.phone_question.do_not_have')) end - context 'on a desktop device send link' do - before do - complete_doc_auth_steps_before_hybrid_handoff_step - visit(idv_phone_question_url) - end + it 'allows user to cancel identify verification' do + click_link t('links.cancel') + expect(page).to have_current_path(idv_cancel_path(step: 'phone_question')) - it 'contains phone question header' do - expect(page).to have_content(t('doc_auth.headings.phone_question')) - end + expect(fake_analytics).to have_logged_event( + 'IdV: cancellation visited', + hash_including(step: 'phone_question'), + ) - it 'contains option to confirm having phone' do - expect(page).to have_content(t('doc_auth.buttons.have_phone')) - end + click_spinner_button_and_wait t('idv.cancel.actions.account_page') - it 'contains option to confirm not having phone' do - expect(page).to have_content(t('doc_auth.phone_question.do_not_have')) - end + expect(current_path).to eq(account_path) + expect(fake_analytics).to have_logged_event( + 'IdV: cancellation confirmed', + hash_including(step: 'phone_question'), + ) end end From 2716a44eee9f7a685526aac7dd4f761fe0eab80c Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Mon, 2 Oct 2023 12:58:33 -0400 Subject: [PATCH 13/14] trigger CI From 81e7db62b31be94987fedca5fb83eea8b1f0f44d Mon Sep 17 00:00:00 2001 From: Amir Reavis-Bey Date: Mon, 2 Oct 2023 13:20:03 -0400 Subject: [PATCH 14/14] fix controller specs post hybrid_handoff_cofirm_needed move to idv step concern --- spec/controllers/idv/phone_question_controller_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/controllers/idv/phone_question_controller_spec.rb b/spec/controllers/idv/phone_question_controller_spec.rb index f35e11dc242..d07a2da4d95 100644 --- a/spec/controllers/idv/phone_question_controller_spec.rb +++ b/spec/controllers/idv/phone_question_controller_spec.rb @@ -68,7 +68,7 @@ get :show - expect(response).to redirect_to(idv_hybrid_handoff_url) + expect(response).to redirect_to(idv_document_capture_url) end it 'redirects to link_sent in hybrid flow' do @@ -76,7 +76,7 @@ get :show - expect(response).to redirect_to(idv_hybrid_handoff_url) + expect(response).to redirect_to(idv_link_sent_url) end end @@ -86,7 +86,7 @@ get :show - expect(response).to redirect_to(idv_hybrid_handoff_url) + expect(response).to redirect_to(idv_document_capture_url) end end @@ -97,7 +97,7 @@ it 'redirects the user straight to document capture' do get :show - expect(response).to redirect_to(idv_hybrid_handoff_url) + expect(response).to redirect_to(idv_document_capture_url) end end end