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
38 changes: 22 additions & 16 deletions app/views/idv/phone_errors/failure.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
heading: t('idv.failure.phone.rate_limited.heading'),
current_step: :verify_phone_or_address,
options: [
decorated_session.sp_name && {
url: return_to_sp_failure_to_proof_path(step: 'phone', location: request.params[:action]),
text: t('idv.troubleshooting.options.get_help_at_sp', sp_name: decorated_session.sp_name),
new_tab: true,
},
{
url: MarketingSite.contact_url,
text: t('idv.troubleshooting.options.contact_support', app_name: APP_NAME),
Expand All @@ -17,19 +12,26 @@
].select(&:present?),
) do %>
<p>
<%= t(
'idv.failure.phone.rate_limited.body',
time_left: distance_of_time_in_words(
Time.zone.now,
[@expires_at, Time.zone.now].compact.max,
except: :seconds,
),
) %>
<%= t('idv.failure.phone.rate_limited.body') %>
</p>
<%= t('idv.failure.phone.rate_limited.options_header') %>
<ul>
<% if @gpo_letter_available %>
<li><%= t('idv.failure.phone.rate_limited.option_verify_by_mail_html') %></li>
<% end %>
<li>
<%= t(
'idv.failure.phone.rate_limited.option_try_again_later_html',
time_left: distance_of_time_in_words(
Time.zone.now,
[@expires_at, Time.zone.now].compact.max,
except: :seconds,
),
) %>
</li>
</ul>
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.

bullet to insert here: Cancel and start over again after x hours

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.

Added.


<% if @gpo_letter_available %>
<p>
<strong><%= t('idv.failure.phone.rate_limited.gpo.prompt') %></strong>
</p>
<div class="margin-y-5">
<%= render ButtonComponent.new(
action: ->(**tag_options, &block) { link_to idv_gpo_path, **tag_options, &block },
Expand All @@ -39,3 +41,7 @@
</div>
<% end %>
<% end %>
<%= render PageFooterComponent.new do %>
<%= link_to(t('links.cancel'), idv_cancel_path) %>
<% end %>

10 changes: 5 additions & 5 deletions config/locales/idv/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ en:
Please try again.
rate_limited:
body: For security reasons, we limit the number of times you can attempt to
verify your phone number online. You will need to wait %{time_left}
and start over before trying to verify by phone again.
verify your phone number online.
gpo:
button: Verify by mail
prompt: Continue now by verifying by mail, which typically takes 3 - 7 business
days.
heading: 'We couldn’t verify your identity by phone'
option_try_again_later_html: 'Cancel and start over again after <b>%{time_left}</b>'
option_verify_by_mail_html: 'Verify by mail, which typically takes <b>3-7 business days</b>'
options_header: 'You can:'
timeout: Our request to verify your information timed out. Please try again.
warning:
attempts:
Expand Down Expand Up @@ -276,7 +276,7 @@ en:
state_id:
cancel_button: Exit %{app_name}
explanation: |
Unfortunately, we’re experiencing technical difficulties
Unfortunately, we’re experiencing technical difficulties
with IDs from your state and are currently unable to verify your information.
heading: We are working to resolve an error
next_steps:
Expand Down
12 changes: 6 additions & 6 deletions config/locales/idv/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ es:
Vuelve a intentarlo.
rate_limited:
body: Por motivos de seguridad, se limita el número de veces que puede intentar
verificar su número de teléfono por Internet. Tendrás que esperar
%{time_left} y volver a empezar antes de volver a intentar la
verificación por teléfono.
verificar su número de teléfono por Internet.
gpo:
button: Verificar por correo
prompt: Continúa ahora con la verificación por correo, que suele tardar entre 3
y 7 días laborables.
heading: 'No hemos podido verificar su identidad por teléfono'
heading: No pudimos asociarlo a este número
option_try_again_later_html: 'Cancelar y empezar de nuevo transcurridas <b>%{time_left}</b>'
option_verify_by_mail_html: 'Verificar por correo, lo que suele demorar de <b>3
a 7 días hábiles</b>'
options_header: 'Puede:'
timeout: Nuestra solicitud para verificar tu información ha caducado. Vuelve a
intentarlo.
warning:
Expand Down
10 changes: 5 additions & 5 deletions config/locales/idv/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ fr:
pour le moment. Veuillez réessayer.
rate_limited:
body: Pour des raisons de sécurité, nous limitons le nombre de tentatives de
vérification de votre numéro de téléphone en ligne. Vous devrez
attendre %{time_left} et recommencer avant d’essayer à nouveau de
vérifier votre identité par téléphone.
vérification de votre numéro de téléphone en ligne.
gpo:
button: Vérifier par courrier
prompt: Continuez maintenant en vérifiant par courrier, ce qui prend
généralement de 3 à 7 jours ouvrables.
heading: Nous n’avons pas pu vérifier votre identité par téléphone
option_try_again_later_html: 'Annuler et recommencer après <b>%{time_left}</b>'
option_verify_by_mail_html: Vérifier par courrier, ce qui prend généralement de
<b>trois à sept jours ouvrables</b>.
options_header: 'Vous Pouvez :'
timeout: Notre demande de vérification de vos renseignements a expiré. Veuillez
réessayer.
warning:
Expand Down
8 changes: 7 additions & 1 deletion spec/features/idv/steps/phone_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@
click_idv_continue_for_step(:phone)
end

it 'takes them to the IdV cancel screen if they hit cancel', js: true do
click_on 'Cancel'
expect(current_path).to eq(idv_cancel_path)
end

it 'still lets them access the GPO flow and return to the error' do
click_on t('idv.failure.phone.rate_limited.gpo.button')
expect(page).to have_content(t('idv.titles.mail.verify'))
Expand All @@ -246,7 +251,8 @@
let(:gpo_enabled) { false }

it 'does not link out to GPO flow' do
expect(page).not_to have_content(t('idv.failure.phone.rate_limited.gpo.prompt'))
prompt_text = t('idv.failure.phone.rate_limited.option_verify_by_mail_html')
expect(page).not_to have_content(prompt_text)
expect(page).not_to have_content(t('idv.failure.phone.rate_limited.gpo.button'))
end
end
Expand Down
30 changes: 24 additions & 6 deletions spec/views/idv/phone_errors/failure.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,29 @@
end

it 'renders a list of troubleshooting options' do
expect(rendered).to have_link(
t('idv.troubleshooting.options.get_help_at_sp', sp_name: sp_name),
href: return_to_sp_failure_to_proof_path(step: 'phone', location: 'failure'),
)
expect(rendered).to have_link(
t('idv.troubleshooting.options.contact_support', app_name: APP_NAME),
href: MarketingSite.contact_url,
)
end

it 'tells them they can try again later' do
raw_expected_text = t(
'idv.failure.phone.rate_limited.option_try_again_later_html',
time_left: distance_of_time_in_words(Time.zone.now, @expires_at, except: :seconds),
)
expected_text = ActionView::Base.full_sanitizer.sanitize(raw_expected_text)

expect(rendered).to have_text(expected_text)
end

it 'renders a cancel link' do
expect(rendered).to have_link(
t('links.cancel'),
href: idv_cancel_path,
)
end

it 'includes a message instructing when they can try again' do
expect(rendered).to have_text(
strip_tags(
Expand All @@ -43,7 +56,9 @@
end

it 'describes GPO as an alternative' do
expect(rendered).to have_text(t('idv.failure.phone.rate_limited.gpo.prompt'))
raw_expected_text = t('idv.failure.phone.rate_limited.option_verify_by_mail_html')
expected_text = ActionView::Base.full_sanitizer.sanitize(raw_expected_text)
expect(rendered).to have_text(expected_text)
end

it 'includes a link to GPO flow' do
Expand All @@ -57,7 +72,10 @@
let(:gpo_letter_available) { false }

it 'does not describe GPO as an alternative' do
expect(rendered).not_to have_text(t('idv.failure.phone.rate_limited.gpo.prompt'))
raw_gpo_alternative = t('idv.failure.phone.rate_limited.option_verify_by_mail_html')
gpo_alternative = ActionView::Base.full_sanitizer.sanitize(raw_gpo_alternative)

expect(rendered).not_to have_text(gpo_alternative)
end

it 'does not include a link to GPO flow' do
Expand Down