diff --git a/app/controllers/idv/confirm_start_over_controller.rb b/app/controllers/idv/confirm_start_over_controller.rb
index b148ed62580..99075494f49 100644
--- a/app/controllers/idv/confirm_start_over_controller.rb
+++ b/app/controllers/idv/confirm_start_over_controller.rb
@@ -8,7 +8,30 @@ class ConfirmStartOverController < ApplicationController
before_action :confirm_idv_needed
def index
- analytics.idv_gpo_confirm_start_over_visited
+ @step_indicator_step = requested_letter_before? ? :get_a_letter : :verify_phone_or_address
+
+ # Temporarily check referer until request letter view is updated to link to
+ # the before_letter route
+ if request.referer == idv_request_letter_url
+ analytics.idv_gpo_confirm_start_over_before_letter_visited
+ render 'idv/confirm_start_over/before_letter'
+ else
+ analytics.idv_gpo_confirm_start_over_visited
+ render :index
+ end
+ end
+
+ def before_letter
+ @step_indicator_step = requested_letter_before? ? :get_a_letter : :verify_phone_or_address
+ analytics.idv_gpo_confirm_start_over_before_letter_visited
+
+ render 'idv/confirm_start_over/before_letter'
+ end
+
+ private
+
+ def requested_letter_before?
+ current_user&.gpo_verification_pending_profile?
end
end
end
diff --git a/app/services/analytics_events.rb b/app/services/analytics_events.rb
index 86de4f82dda..782d96bb60a 100644
--- a/app/services/analytics_events.rb
+++ b/app/services/analytics_events.rb
@@ -1105,9 +1105,14 @@ def idv_gpo_address_letter_requested(
)
end
+ # The user visited the gpo confirm cancellation screen from RequestLetter
+ def idv_gpo_confirm_start_over_before_letter_visited(**extra)
+ track_event(:idv_gpo_confirm_start_over_before_letter_visited, **extra)
+ end
+
# The user visited the gpo confirm cancellation screen
- def idv_gpo_confirm_start_over_visited
- track_event('IdV: gpo confirm start over visited') # rubocop:disable IdentityIdp/AnalyticsEventNameLinter
+ def idv_gpo_confirm_start_over_visited(**extra)
+ track_event('IdV: gpo confirm start over visited', **extra) # rubocop:disable IdentityIdp/AnalyticsEventNameLinter
end
# A GPO reminder email was sent to the user
diff --git a/app/views/idv/confirm_start_over/before_letter.html.erb b/app/views/idv/confirm_start_over/before_letter.html.erb
new file mode 100644
index 00000000000..c48f8462b08
--- /dev/null
+++ b/app/views/idv/confirm_start_over/before_letter.html.erb
@@ -0,0 +1,25 @@
+<%= render(
+ 'idv/shared/error',
+ type: :warning,
+ heading: t('idv.cancel.headings.prompt.start_over'),
+ current_step: @step_indicator_step,
+ ) do %>
+
+ <%= t('idv.cancel.description.gpo.start_over_new_address') %>
+
+
+ <%= t('idv.cancel.description.gpo.continue') %>
+
+
+
+ <%= render ButtonComponent.new(
+ action: ->(**tag_options, &block) do
+ button_to(idv_session_path(step: :gpo_verify), **tag_options, &block)
+ end,
+ method: :delete,
+ big: true,
+ wide: true,
+ ).with_content(t('idv.buttons.continue_plain')) %>
+
+<% end %>
+<%= render('idv/shared/back', step: 'gpo_verify', fallback_path: idv_verify_by_mail_enter_code_path) %>
diff --git a/app/views/idv/confirm_start_over/index.html.erb b/app/views/idv/confirm_start_over/index.html.erb
index 41724090fd0..5ea412f297c 100644
--- a/app/views/idv/confirm_start_over/index.html.erb
+++ b/app/views/idv/confirm_start_over/index.html.erb
@@ -2,7 +2,7 @@
'idv/shared/error',
type: :warning,
heading: t('idv.cancel.headings.prompt.standard'),
- current_step: :get_a_letter,
+ current_step: @step_indicator_step,
) do %>
<%= t('idv.cancel.description.gpo.start_over') %>
@@ -14,6 +14,7 @@
<% end %>
+
<%= render ButtonComponent.new(
action: ->(**tag_options, &block) do
diff --git a/config/locales/idv/en.yml b/config/locales/idv/en.yml
index d42d783daba..15a33364261 100644
--- a/config/locales/idv/en.yml
+++ b/config/locales/idv/en.yml
@@ -31,7 +31,10 @@ en:
- You will still have a %{app_name} account. You can manage or
delete your account on your %{account_page_text}.
gpo:
+ continue: Continue to start over and verify your identity from the beginning.
start_over: 'If you clear your information and start over:'
+ start_over_new_address: To mail your letter to another address, you’ll need to
+ start over and verify your identity with the new address.
warnings:
- The verification code in your letter will no longer work
- You will start over verifying your identity from the beginning
@@ -48,6 +51,7 @@ en:
hybrid: Are you sure you want to cancel uploading photos of your ID on this
phone?
standard: Cancel verifying your identity?
+ start_over: Start over verifying your identity?
start_over: Start over verifying your identity
errors:
incorrect_password: The password you entered is not correct.
diff --git a/config/locales/idv/es.yml b/config/locales/idv/es.yml
index d1362c482a5..c57b772ffff 100644
--- a/config/locales/idv/es.yml
+++ b/config/locales/idv/es.yml
@@ -32,7 +32,11 @@ es:
- No obstante, continuará teniendo una cuenta en %{app_name}. Puede
administrar o eliminar su cuenta desde %{account_page_text}.
gpo:
+ continue: Continúe empezando de nuevo y verifique su identidad desde el
+ principio.
start_over: Si borras tu información y empiezas de nuevo
+ start_over_new_address: Para enviar su carta a otra dirección, tendrá que
+ empezar de nuevo y verificar su identidad con la nueva dirección.
warnings:
- El código de verificación de tu carta ya no funcionará
- Tendrás que volver a verificar tu identidad otra vez
@@ -49,6 +53,7 @@ es:
hybrid: '¿Seguro que desea cancelar la carga de fotos de su identificación en
este teléfono?'
standard: '¿Cancelar la verificación de su identidad?'
+ start_over: ¿Empezar de nuevo a verificar su identidad?
start_over: Empezar de nuevo a verificar su identidad
errors:
incorrect_password: La contraseña que ingresó no es correcta.
diff --git a/config/locales/idv/fr.yml b/config/locales/idv/fr.yml
index b9e1483000f..f44b8ba03f0 100644
--- a/config/locales/idv/fr.yml
+++ b/config/locales/idv/fr.yml
@@ -32,7 +32,10 @@ fr:
- Vous aurez toujours un compte %{app_name}. Vous pouvez gérer ou
supprimer votre compte sur %{account_page_text}.
gpo:
+ continue: Recommencez et vérifiez votre identité depuis le début.
start_over: Si vous supprimez vos informations et recommencez
+ start_over_new_address: Pour envoyer votre lettre à une autre adresse, vous
+ devrez recommencer et vérifier votre identité à la nouvelle adresse.
warnings:
- Le code de vérification dans votre lettre ne fonctionnera plus
- Vous recommencerez la vérification de votre identité depuis le
@@ -52,6 +55,7 @@ fr:
hybrid: Êtes-vous sûr de vouloir annuler le téléchargement de vos photos
d’identité sur ce téléphone?
standard: Annuler la vérification de votre identité?
+ start_over: Recommencez la vérification de votre identité?
start_over: Recommencez la vérification de votre identité
errors:
incorrect_password: Le mot de passe que vous avez inscrit est incorrect.
diff --git a/config/routes.rb b/config/routes.rb
index 7430fdda8cd..8ca032ca35c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -401,6 +401,8 @@
post '/by_mail/enter_code' => 'by_mail/enter_code#create'
get '/by_mail/confirm_start_over' => 'confirm_start_over#index',
as: :confirm_start_over
+ get '/by_mail/confirm_start_over/before_letter' => 'confirm_start_over#before_letter',
+ as: :confirm_start_over_before_letter
if FeatureManagement.gpo_verification_enabled?
get '/by_mail/request_letter' => 'by_mail/request_letter#index', as: :request_letter
diff --git a/spec/features/idv/confirm_start_over_spec.rb b/spec/features/idv/confirm_start_over_spec.rb
index eebffe5e028..383f708f66a 100644
--- a/spec/features/idv/confirm_start_over_spec.rb
+++ b/spec/features/idv/confirm_start_over_spec.rb
@@ -26,27 +26,67 @@
before do
allow_any_instance_of(ApplicationController).to receive(:analytics).and_return(fake_analytics)
- sign_in_live_with_2fa(user)
end
- it 'can cancel from confirmation screen' do
- expect(current_path).to eq idv_verify_by_mail_enter_code_path
+ context 'user decides to start over from request letter page' do
+ it 'allows user to start over' do
+ start_idv_from_sp
+ complete_idv_steps_before_gpo_step
+ click_on t('idv.messages.gpo.start_over_link_text')
- click_on t('idv.messages.clear_and_start_over')
+ expect(current_path).to eq idv_confirm_start_over_path
+ expect(page).to have_content(t('idv.cancel.description.gpo.start_over_new_address'))
+ expect_step_indicator_current_step(t('step_indicator.flows.idv.verify_phone_or_address'))
+ expect(fake_analytics).to have_logged_event(:idv_gpo_confirm_start_over_before_letter_visited)
+ click_idv_continue
- expect(current_path).to eq idv_confirm_start_over_path
- expect(fake_analytics).to have_logged_event('IdV: gpo confirm start over visited')
+ expect(current_path).to eq idv_welcome_path
+ end
+ end
+
+ context 'user decides to start over from request letter page with new route' do
+ it 'allows user to start over' do
+ start_idv_from_sp
+ complete_idv_steps_before_gpo_step
+ click_on t('idv.messages.gpo.start_over_link_text')
+ visit idv_confirm_start_over_before_letter_path
- click_idv_continue
+ expect(current_path).to eq idv_confirm_start_over_before_letter_path
+ expect(page).to have_content(t('idv.cancel.description.gpo.start_over_new_address'))
+ expect_step_indicator_current_step(t('step_indicator.flows.idv.verify_phone_or_address'))
+ expect(fake_analytics).to have_logged_event(:idv_gpo_confirm_start_over_before_letter_visited)
+ click_idv_continue
- expect(current_path).to eq idv_welcome_path
+ expect(current_path).to eq idv_welcome_path
+ end
end
- it 'can return back to verify screen from confirm screen' do
- click_on t('idv.messages.clear_and_start_over')
- click_on t('forms.buttons.back')
+ context 'user decides to start over after requesting a letter' do
+ before do
+ sign_in_live_with_2fa(user)
+ end
+
+ it 'can cancel from confirmation screen' do
+ expect(current_path).to eq idv_verify_by_mail_enter_code_path
+
+ click_on t('idv.messages.clear_and_start_over')
+
+ expect(current_path).to eq idv_confirm_start_over_path
+ expect(page).to have_content(t('idv.cancel.description.gpo.start_over'))
+ expect_step_indicator_current_step(t('step_indicator.flows.idv.get_a_letter'))
+ expect(fake_analytics).to have_logged_event('IdV: gpo confirm start over visited')
+
+ click_idv_continue
+
+ expect(current_path).to eq idv_welcome_path
+ end
+
+ it 'can return back to verify screen from confirm screen' do
+ click_on t('idv.messages.clear_and_start_over')
+ click_on t('forms.buttons.back')
- expect(fake_analytics).to have_logged_event('IdV: gpo confirm start over visited')
- expect(current_path).to eq idv_verify_by_mail_enter_code_path
+ expect(fake_analytics).to have_logged_event('IdV: gpo confirm start over visited')
+ expect(current_path).to eq idv_verify_by_mail_enter_code_path
+ end
end
end