Skip to content
Closed
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
15 changes: 15 additions & 0 deletions app/controllers/idv/by_mail/enter_code_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def create
result = @gpo_verify_form.submit(resolved_authn_context_result.enhanced_ipp?)
analytics.idv_verify_by_mail_enter_code_submitted(**result)

send_please_call_email_if_necessary(result:)

if !result.success?
if rate_limiter.limited?
redirect_to idv_enter_code_rate_limited_url
Expand Down Expand Up @@ -120,6 +122,19 @@ def rate_limiter
)
end

# @param [FormResponse] result GpoVerifyForm result
def send_please_call_email_if_necessary(result:)
return if !result.success?

return if result.extra[:pending_in_person_enrollment]

return if !result.extra[:fraud_check_failed]

return if !FeatureManagement.proofing_device_profiling_decisioning_enabled?

current_user.send_email_to_all_addresses(:idv_please_call)
end

def build_gpo_verify_form
GpoVerifyForm.new(
user: current_user,
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/idv/enter_password_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ def init_profile
log_letter_enqueued_analytics(resend: false)
end

if profile.fraud_review_pending? && !profile.in_person_verification_pending?
current_user.send_email_to_all_addresses(:idv_please_call)
end

if profile.active?
create_user_event(:account_verified)
UserAlerts::AlertUserAboutAccountVerified.call(
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/get_usps_proofing_results_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ def send_failed_fraud_email(enrollment:, visited_location_name:)
def send_please_call_email(enrollment:, visited_location_name:)
enrollment.user.confirmed_email_addresses.each do |email_address|
# rubocop:disable IdentityIdp/MailLaterLinter
UserMailer.with(user: enrollment.user, email_address: email_address).in_person_please_call(
UserMailer.with(user: enrollment.user, email_address: email_address).idv_please_call(
enrollment: enrollment,
visited_location_name: visited_location_name,
).deliver_later(**notification_delivery_params(enrollment))
Expand Down
30 changes: 15 additions & 15 deletions app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ def account_verified(profile:)
end
end

def idv_please_call(**)
attachments.inline['phone_icon.png'] =
Rails.root.join('app/assets/images/email/phone_icon.png').read

with_user_locale(user) do
@hide_title = true

mail(
to: email_address.email,
subject: t('user_mailer.idv_please_call.subject', app_name: APP_NAME),
template_name: 'idv_please_call',
)
end
end

def in_person_completion_survey
with_user_locale(user) do
@header = t('user_mailer.in_person_completion_survey.header')
Expand Down Expand Up @@ -373,21 +388,6 @@ def in_person_failed_fraud(enrollment:, visited_location_name: nil)
end
end

def in_person_please_call(enrollment:, visited_location_name: nil)
with_user_locale(user) do
@presenter = Idv::InPerson::VerificationResultsEmailPresenter.new(
enrollment: enrollment,
url_options: url_options,
visited_location_name: visited_location_name,
)
@hide_title = true
mail(
to: email_address.email,
subject: t('user_mailer.in_person_please_call.subject', app_name: APP_NAME),
)
end
end

def account_rejected
with_user_locale(user) do
mail(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<%= image_tag(
asset_url('email/phone_icon.png'),
attachments['phone_icon.png'].url,
alt: t('image_description.phone_icon'),
width: 88,
height: 88,
) %>
<h1><%= t('user_mailer.in_person_please_call.header') %></h1>
<h1><%= t('user_mailer.idv_please_call.header') %></h1>
<p>
<%= t(
'user_mailer.in_person_please_call.body.intro_html',
'user_mailer.idv_please_call.body.intro_html',
date: I18n.l(14.days.from_now, format: I18n.t('time.formats.full_date')),
) %>
</p>
<p>
<%= t(
'user_mailer.in_person_please_call.body.contact_message_html',
'user_mailer.idv_please_call.body.contact_message_html',
contact_number: IdentityConfig.store.idv_contact_phone_number,
support_code: IdentityConfig.store.lexisnexis_threatmetrix_support_code,
) %>
Expand Down
8 changes: 4 additions & 4 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1875,6 +1875,10 @@ user_mailer.email_deleted.header: An email address was deleted from your %{app_n
user_mailer.email_deleted.help_html: If you did not want to delete this email address, please visit the %{app_name_html} %{help_link_html} or %{contact_link_html}.
user_mailer.email_deleted.subject: Email address deleted
user_mailer.help_link_text: Help Center
user_mailer.idv_please_call.body.contact_message_html: Call <strong>%{contact_number}</strong> and provide them with the error code <strong>%{support_code}</strong>.
user_mailer.idv_please_call.body.intro_html: Call our contact center by <strong>%{date}</strong> to continue verifying your identity.
user_mailer.idv_please_call.header: Please give us a call
user_mailer.idv_please_call.subject: Call %{app_name} to continue with your identity verification
user_mailer.in_person_completion_survey.body.cta.callout: Click the button below to get started.
user_mailer.in_person_completion_survey.body.cta.label: Take our survey
user_mailer.in_person_completion_survey.body.greeting: Hello,
Expand All @@ -1900,10 +1904,6 @@ user_mailer.in_person_failed.intro: Your identity could not be verified at the %
user_mailer.in_person_failed.subject: Your identity could not be verified in person
user_mailer.in_person_failed.verifying_identity: 'When verifying your identity:'
user_mailer.in_person_failed.verifying_step_not_expired: Your state‑issued ID or driver’s license must not be expired. We do not currently accept any other forms of identification, such as passports and military IDs.
user_mailer.in_person_please_call.body.contact_message_html: Call <strong>%{contact_number}</strong> and provide them with the error code <strong>%{support_code}</strong>.
user_mailer.in_person_please_call.body.intro_html: Call our contact center by <strong>%{date}</strong> to continue verifying your identity.
user_mailer.in_person_please_call.header: Please give us a call
user_mailer.in_person_please_call.subject: Call %{app_name} to continue with your identity verification
user_mailer.in_person_ready_to_verify_reminder.greeting: Hello,
user_mailer.in_person_ready_to_verify_reminder.heading.one: You have %{count} day left to verify your identity in person
user_mailer.in_person_ready_to_verify_reminder.heading.other: You have %{count} days left to verify your identity in person
Expand Down
8 changes: 4 additions & 4 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,10 @@ user_mailer.email_deleted.header: Se eliminó una dirección de correo electrón
user_mailer.email_deleted.help_html: Si no deseaba eliminar esta dirección de correo electrónico, visite %{help_link_html} de %{app_name_html} o %{contact_link_html}.
user_mailer.email_deleted.subject: Dirección de correo electrónico eliminada
user_mailer.help_link_text: Centro de ayuda
user_mailer.idv_please_call.body.contact_message_html: Llame al <strong>%{contact_number}</strong> y proporcione el código de error <strong>%{support_code}</strong>.
user_mailer.idv_please_call.body.intro_html: Llame a nuestro centro de contacto antes del <strong>%{date}</strong> para seguir verificando su identidad.
user_mailer.idv_please_call.header: Llámenos
user_mailer.idv_please_call.subject: Llame a %{app_name} para continuar con la verificación de identidad
user_mailer.in_person_completion_survey.body.cta.callout: Haga clic en el botón siguiente para empezar.
user_mailer.in_person_completion_survey.body.cta.label: Responda a nuestra encuesta
user_mailer.in_person_completion_survey.body.greeting: 'Hola:'
Expand All @@ -1912,10 +1916,6 @@ user_mailer.in_person_failed.intro: No se pudo verificar su identidad en la ofic
user_mailer.in_person_failed.subject: No se pudo verificar su identidad en persona
user_mailer.in_person_failed.verifying_identity: 'Cuando verifique su identidad:'
user_mailer.in_person_failed.verifying_step_not_expired: Su licencia de conducir o identificación emitida por el estado debe estar vigente. Actualmente no aceptamos otras formas de identificación, como pasaportes o identificaciones militares.
user_mailer.in_person_please_call.body.contact_message_html: Llame al <strong>%{contact_number}</strong> y proporcione el código de error <strong>%{support_code}</strong>.
user_mailer.in_person_please_call.body.intro_html: Llame a nuestro centro de contacto antes del <strong>%{date}</strong> para seguir verificando su identidad.
user_mailer.in_person_please_call.header: Llámenos
user_mailer.in_person_please_call.subject: Llame a %{app_name} para continuar con la verificación de identidad
user_mailer.in_person_ready_to_verify_reminder.greeting: 'Hola:'
user_mailer.in_person_ready_to_verify_reminder.heading.one: Le queda %{count} día para verificar su identidad en persona
user_mailer.in_person_ready_to_verify_reminder.heading.other: Le quedan %{count} días para verificar su identidad en persona
Expand Down
8 changes: 4 additions & 4 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1875,6 +1875,10 @@ user_mailer.email_deleted.header: Une adresse e-mail a été supprimée de votre
user_mailer.email_deleted.help_html: Si vous ne souhaitez pas supprimer cette adresse e-mail, veuillez visiter le %{help_link_html} de %{app_name_html} ou %{contact_link_html}.
user_mailer.email_deleted.subject: Adresse e-mail supprimée
user_mailer.help_link_text: Centre d’aide
user_mailer.idv_please_call.body.contact_message_html: Appelez le <strong>%{contact_number}</strong> et indiquez le code d’erreur <strong>%{support_code}</strong>.
user_mailer.idv_please_call.body.intro_html: Appelez notre centre de contact avant le <strong>%{date}</strong> pour continuer à vérifier votre identité.
user_mailer.idv_please_call.header: S’il vous plaît, appelez-nous
user_mailer.idv_please_call.subject: Appeler %{app_name} afin de poursuivre la vérification de votre identité
user_mailer.in_person_completion_survey.body.cta.callout: Cliquez sur le bouton ci-dessous pour commencer.
user_mailer.in_person_completion_survey.body.cta.label: Répondez à notre enquête
user_mailer.in_person_completion_survey.body.greeting: Bonjour,
Expand All @@ -1900,10 +1904,6 @@ user_mailer.in_person_failed.intro: Votre identité n’a pas pu être vérifié
user_mailer.in_person_failed.subject: Votre identité n’a pas pu être vérifiée en personne
user_mailer.in_person_failed.verifying_identity: 'Lors de la vérification de votre identité :'
user_mailer.in_person_failed.verifying_step_not_expired: Votre carte d’identité délivrée par l’État ou votre permis de conduire ne doit pas être périmé. Nous n’acceptons actuellement aucune autre pièce d’identité, comme les passeports et les cartes d’identité militaires.
user_mailer.in_person_please_call.body.contact_message_html: Appelez le <strong>%{contact_number}</strong> et indiquez le code d’erreur <strong>%{support_code}</strong>.
user_mailer.in_person_please_call.body.intro_html: Appelez notre centre de contact avant le <strong>%{date}</strong> pour continuer à vérifier votre identité.
user_mailer.in_person_please_call.header: S’il vous plaît, appelez-nous
user_mailer.in_person_please_call.subject: Appeler %{app_name} afin de poursuivre la vérification de votre identité
user_mailer.in_person_ready_to_verify_reminder.greeting: Bonjour,
user_mailer.in_person_ready_to_verify_reminder.heading.one: Il vous reste %{count} jour pour vérifier votre identité en personne
user_mailer.in_person_ready_to_verify_reminder.heading.other: Il vous reste %{count} jours pour vérifier votre identité en personne
Expand Down
8 changes: 4 additions & 4 deletions config/locales/zh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1888,6 +1888,10 @@ user_mailer.email_deleted.header: 一个电邮地址被从你的 %{app_name} 用
user_mailer.email_deleted.help_html: 如果你没有想删除这一电邮地址,请访问 %{app_name_html} %{help_link_html} 或者 %{contact_link_html}。
user_mailer.email_deleted.subject: 电邮地址已删除
user_mailer.help_link_text: 帮助中心
user_mailer.idv_please_call.body.contact_message_html: 打电话给 <strong>%{contact_number}</strong> 并向他们提供错误 代码 <strong>%{support_code}</strong>。
user_mailer.idv_please_call.body.intro_html: 请在 <strong>%{date}</strong> 之前给我们的联系中心打电话,以继续验证你的身份。
user_mailer.idv_please_call.header: 请给我们打个电话
user_mailer.idv_please_call.subject: 致电 %{app_name} 继续进行身份验证
user_mailer.in_person_completion_survey.body.cta.callout: 点击下面的按钮来开始
user_mailer.in_person_completion_survey.body.cta.label: 填写我们的意见调查
user_mailer.in_person_completion_survey.body.greeting: 你好,
Expand All @@ -1913,10 +1917,6 @@ user_mailer.in_person_failed.intro: 你的身份于 %{date}在 %{location} 邮
user_mailer.in_person_failed.subject: 你的身份未能亲身被验证。
user_mailer.in_person_failed.verifying_identity: '验证你的身份时:'
user_mailer.in_person_failed.verifying_step_not_expired: 你的州政府颁发的身份证件或驾照绝对没有过期。我们目前不接受任何其他形式的身份证件,比如护照和军队身份证件。
user_mailer.in_person_please_call.body.contact_message_html: 打电话给 <strong>%{contact_number}</strong> 并向他们提供错误 代码 <strong>%{support_code}</strong>。
user_mailer.in_person_please_call.body.intro_html: 请在 <strong>%{date}</strong> 之前给我们的联系中心打电话,以继续验证你的身份。
user_mailer.in_person_please_call.header: 请给我们打个电话
user_mailer.in_person_please_call.subject: 致电 %{app_name} 继续进行身份验证
user_mailer.in_person_ready_to_verify_reminder.greeting: 你好,
user_mailer.in_person_ready_to_verify_reminder.heading.one: 你距离亲身验证身份截止日期还有 %{count} 天
user_mailer.in_person_ready_to_verify_reminder.heading.other: 你距离亲身验证身份截止日期还有 %{count} 天
Expand Down
16 changes: 16 additions & 0 deletions spec/controllers/idv/by_mail/enter_code_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@
expect(event_count).to eq 1
expect(response).to redirect_to(idv_personal_key_url)
end

it 'does not send the "Please Call" email' do
action
expect_email_not_delivered(
to: user.confirmed_email_addresses.first.email,
subject: t('user_mailer.idv_please_call.subject', app_name: APP_NAME),
)
end
end
end

Expand Down Expand Up @@ -323,6 +331,14 @@

expect(UserAlerts::AlertUserAboutAccountVerified).not_to have_received(:call)
end

it 'sends the "Please Call" email' do
action
expect_delivered_email(
to: user.confirmed_email_addresses.first.email,
subject: t('user_mailer.idv_please_call.subject', app_name: APP_NAME),
)
end
end

context 'with threatmetrix status of "review"' do
Expand Down
73 changes: 73 additions & 0 deletions spec/controllers/idv/enter_password_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
end
let(:applicant) { Idp::Constants::MOCK_IDV_APPLICANT_WITH_PHONE }
let(:use_gpo) { false }
let(:threatmetrix_enabled) { true }
let(:threatmetrix_result) { 'pass' }
let(:idv_session) do
subject.idv_session
end
Expand All @@ -28,6 +30,7 @@
subject.idv_session.pii_from_doc = Pii::StateId.new(**Idp::Constants::MOCK_IDV_APPLICANT)
subject.idv_session.ssn = Idp::Constants::MOCK_IDV_APPLICANT_WITH_PHONE[:ssn]
subject.idv_session.threatmetrix_session_id = 'random-session-id'
subject.idv_session.threatmetrix_review_status = threatmetrix_result
subject.idv_session.resolution_successful = true
subject.idv_session.applicant = Idp::Constants::MOCK_IDV_APPLICANT_WITH_PHONE
subject.idv_session.resolution_successful = true
Expand All @@ -43,6 +46,9 @@
end

subject.idv_session.applicant = applicant.with_indifferent_access

allow(IdentityConfig.store).to receive(:proofing_device_profiling)
.and_return(threatmetrix_enabled ? :enabled : :disabled)
end

describe '#step_info' do
Expand Down Expand Up @@ -404,6 +410,41 @@ def show
expect(events_count).to eq 1
end

context 'user was flagged by ThreatMetrix' do
let(:threatmetrix_result) { 'reject' }

it 'sends the idv_please_call email' do
put :create, params: { user: { password: ControllerHelper::VALID_PASSWORD } }
expect_delivered_email(
to: user.confirmed_email_addresses.first.email,
subject: t('user_mailer.idv_please_call.subject', app_name: APP_NAME),
)
end

it 'does not send the account_verified email' do
put :create, params: { user: { password: ControllerHelper::VALID_PASSWORD } }
expect_email_not_delivered(
subject: t('user_mailer.account_verified.subject', app_name: APP_NAME),
)
end

context 'but ThreatMetrix disabled' do
let(:threatmetrix_enabled) { false }
it 'does not send the idv_please_call email' do
put :create, params: { user: { password: ControllerHelper::VALID_PASSWORD } }
expect_email_not_delivered(
subject: t('user_mailer.idv_please_call.subject'),
)
end
it 'sends the account_verified email' do
put :create, params: { user: { password: ControllerHelper::VALID_PASSWORD } }
expect_delivered_email(
subject: t('user_mailer.account_verified.subject', app_name: APP_NAME),
)
end
end
end

context 'with in person profile' do
let!(:enrollment) do
create(:in_person_enrollment, :establishing, user: user, profile: nil)
Expand Down Expand Up @@ -472,6 +513,17 @@ def show
)
end

context 'user was flagged by ThreatMetrix' do
let(:threatmetrix_result) { 'reject' }

it 'does not send the idv_please_call email' do
put :create, params: { user: { password: ControllerHelper::VALID_PASSWORD } }
expect_email_not_delivered(
subject: t('user_mailer.idv_please_call.subject'),
)
end
end

context 'when there is a 4xx error' do
before do
stub_request_enroll_bad_request_response
Expand Down Expand Up @@ -965,6 +1017,27 @@ def show
expect(user.reload.gpo_verification_pending_profile).to be_nil
end
end

context 'user was flagged by ThreatMetrix' do
let(:threatmetrix_review_status) { 'reject' }

it 'does not send the idv_please_call email' do
put :create, params: { user: { password: ControllerHelper::VALID_PASSWORD } }
expect_email_not_delivered(
subject: t('user_mailer.idv_please_call.subject'),
)
end

context 'but ThreatMetrix disabled' do
let(:threatmetrix_enabled) { false }
it 'does not send the idv_please_call email' do
put :create, params: { user: { password: ControllerHelper::VALID_PASSWORD } }
expect_email_not_delivered(
subject: t('user_mailer.idv_please_call.subject'),
)
end
end
end
end

context 'user is going through enhanced ipp' do
Expand Down
4 changes: 2 additions & 2 deletions spec/jobs/get_usps_proofing_results_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@
allow(analytics).to receive(
:idv_in_person_usps_proofing_results_job_please_call_email_initiated,
)
allow(user_mailer).to receive(:in_person_please_call).and_return(mail_deliverer)
allow(user_mailer).to receive(:idv_please_call).and_return(mail_deliverer)
subject.perform(current_time)
end

Expand Down Expand Up @@ -1545,7 +1545,7 @@
end

it 'sends the please call email' do
expect(user_mailer).to have_received(:in_person_please_call).with(
expect(user_mailer).to have_received(:idv_please_call).with(
enrollment: enrollment,
visited_location_name: visited_location_name,
)
Expand Down
Loading