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
Binary file added app/assets/images/email/user-signup-ial2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/stylesheets/email.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
line-height: 10px;
}

.s16 {
font-size: 16px;
line-height: 24px;
}

.s30 {
font-size: 30px;
line-height: 30px;
Expand Down
22 changes: 22 additions & 0 deletions app/jobs/get_usps_proofing_results_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def update_enrollment_status(enrollment, response)
enrollment.profile.activate
enrollment.update(status: :passed)
handle_successful_status_update(enrollment)
send_verified_email(enrollment.user, enrollment)
else
# Unsupported ID type
enrollment.update(status: :failed)
Expand All @@ -151,8 +152,29 @@ def update_enrollment_status(enrollment, response)
when IPP_STATUS_FAILED
enrollment.update(status: :failed)
handle_failed_status(enrollment, response)
send_failed_email(enrollment.user, enrollment)
else
handle_unsupported_status(enrollment, response['status'])
end
end

def send_verified_email(user, enrollment)
user.confirmed_email_addresses.each do |email_address|
UserMailer.in_person_verified(
user,
email_address,
enrollment: enrollment,
).deliver_now_or_later
end
end

def send_failed_email(user, enrollment)
user.confirmed_email_addresses.each do |email_address|
UserMailer.in_person_failed(
user,
email_address,
enrollment: enrollment,
).deliver_now_or_later
end
end
end
21 changes: 21 additions & 0 deletions app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,27 @@ def in_person_ready_to_verify(user, email_address, first_name:, enrollment:)
end
end

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

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

private

def email_should_receive_nonessential_notifications?(email)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module Idv
module InPerson
class VerificationResultsEmailPresenter
# update to user's time zone when out of pilot
USPS_SERVER_TIMEZONE = ActiveSupport::TimeZone['America/New_York']

def initialize(enrollment:)
@enrollment = enrollment
end

def location_name
@enrollment.selected_location_details['name']
end

def formatted_verified_date
@enrollment.status_updated_at.in_time_zone(USPS_SERVER_TIMEZONE).strftime(
I18n.t('time.formats.event_date'),
)
end
end
end
end
7 changes: 5 additions & 2 deletions app/views/layouts/user_mailer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@
</tr>
</tbody>
</table>
<h4><%= @header || message.subject %>
</h4><%= yield %>
<% unless @hide_title %>
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'm doing this so we can render the image above the title

<h4><%= @header || message.subject %>
</h4>
<% end %>
<%= yield %>
<table class="spacer">
<tbody>
<tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<div class="margin-top-5">
<table class="button expanded large radius">
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td style="text-align: center">
<%= link_to t('user_mailer.in_person_verified.sign_in'),
idv_url,
target: '_blank',
class: 'float-center',
rel: 'noopener' %>
</td>
</tr>
</tbody>
</table>
</td>
<td class="expander"></td>
</tr>
</tbody>
</table>
</div>

<p>
<%= link_to idv_url, idv_url, target: '_blank', rel: 'noopener' %>
</p>

<div class="s16">
<br />
<%= t(
'user_mailer.in_person_verified.warning_contact_us_html',
contact_us_url: MarketingSite.contact_url,
sign_in_url: idv_url,
)
%>
</div>
20 changes: 20 additions & 0 deletions app/views/user_mailer/in_person_failed.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="s16">
<%= t('user_mailer.in_person_verified.greeting') %><br>
<p class="s16">
<%= t(
'user_mailer.in_person_failed.intro',
location: @presenter.location_name,
date: @presenter.formatted_verified_date,
) %>
</p>
<p class="s16">
<%= t('user_mailer.in_person_failed.body', app_name: APP_NAME) %><br><br />
</p>
<strong><%= t('user_mailer.in_person_failed.verifying_identity') %></strong><br>
<ul class="usa-list">
<li><%= t('user_mailer.in_person_failed.verifying_step_not_expired') %></li>
<li><%= t('user_mailer.in_person_failed.verifying_step_proof_of_address') %></li>
</ul>
</div>

<%= render 'shared/in-person-verification-results-email-lower' %>
19 changes: 19 additions & 0 deletions app/views/user_mailer/in_person_verified.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<%= image_tag(
'email/user-signup-ial2.png',
width: 140,
height: 177,
alt: '',
class: 'float-center padding-bottom-4',
) %>
<h4><%= message.subject %></h4>
<p class="s16">
<%= t('user_mailer.in_person_verified.greeting') %><br>
<%= t(
'user_mailer.in_person_verified.intro',
location: @presenter.location_name,
date: @presenter.formatted_verified_date,
) %><br /><br />
<%= t('user_mailer.in_person_verified.next_sign_in', app_name: APP_NAME) %>
</p>

<%= render 'shared/in-person-verification-results-email-lower' %>
24 changes: 24 additions & 0 deletions config/locales/user_mailer/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,35 @@ en:
%{app_name} %{help_link} or %{contact_link}.
subject: Email address deleted
help_link_text: Help Center
in_person_failed:
body: Click the button or copy the link below to try verifying your identity
online again through %{app_name}. If you are still experiencing issues,
please contact the agency you are trying to access.
intro: Your identity could not be verified at the %{location} Post Office on
%{date}.
subject: Your identity could not be verified in person
verifying_identity: 'When verifying your identity:'
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.'
verifying_step_proof_of_address: 'If you try to verify your identity in person
again, you need to bring a valid proof of address if your current
address is different than the address on your ID.'
in_person_ready_to_verify:
greeting: Hi %{name},
intro: Here are the details to verify your identity in person at a United States
Post Office near you.
subject: You’re ready to verify your identity with %{app_name} in person
in_person_verified:
greeting: Hello,
Comment thread
tomas-nava marked this conversation as resolved.
intro: You successfully verified your identity at the %{location} Post Office on
%{date}.
next_sign_in: Next, click the button or copy the link below to sign in to %{app_name}.
sign_in: Sign in
subject: You successfully verified your identity with %{app_name}
warning_contact_us_html: If you did not attempt to verify your identity in
person, please <a href="%{contact_us_url}">contact us</a> and <a
href="%{sign_in_url}">sign in</a> to change your password.
letter_reminder:
info_html: The letter you are about to receive will contain a confirmation code
that helps us verify your address. You can complete the identity
Expand Down
27 changes: 27 additions & 0 deletions config/locales/user_mailer/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,38 @@ es:
%{app_name} %{help_link} o el %{contact_link}.
subject: Dirección de correo electrónico eliminada
help_link_text: Centro de Ayuda
in_person_failed:
body: Haga clic en el botón o copie el enlace siguiente para volver a intentar
verificar su identidad en línea con %{app_name}. Si sigue teniendo
problemas, póngase en contacto con la agencia a la que intenta acceder.
intro: El %{date}, no se pudo verificar su identidad en la oficina de correos de
%{location}.
subject: No se pudo verificar su identidad en persona
verifying_identity: 'Al verificar su identidad:'
verifying_step_not_expired: Su documento de identidad o permiso de conducir
emitido por el estado debe estar vigente. Por el momento, no aceptamos
otras formas de identificación, como pasaportes o cartillas militares.
verifying_step_proof_of_address: Si vuelve a intentar verificar su identidad en
persona, deberá llevar un comprobante de domicilio vigente si su
dirección actual es distinta de la que aparece en su documento de
identidad.
in_person_ready_to_verify:
greeting: 'Hola, %{name}:'
intro: Estos son los detalles para verificar su identidad en persona en una
oficina de correos de los Estados Unidos cercana a usted.
subject: Está listo para verificar su identidad con %{app_name} en persona
in_person_verified:
greeting: Hola,
intro: El %{date}, verificó correctamente su identidad en la oficina de correos
de %{location}.
next_sign_in: Luego, haga clic en el botón o copie el enlace que aparece a
continuación para iniciar sesión en %{app_name}.
sign_in: Iniciar sesión
subject: Verificó correctamente su identidad con %{app_name}
warning_contact_us_html: Si usted no intentó verificar su identidad en persona,
por favor, póngase en <a href="%{contact_us_url}">contacto con
nosotros</a> e <a href="%{sign_in_url}">inicie sesión</a> para cambiar
su contraseña.
letter_reminder:
info_html: La carta que está a punto de recibir contendrá un código de
confirmación que nos ayudará a verificar su dirección. Puede completar
Expand Down
29 changes: 29 additions & 0 deletions config/locales/user_mailer/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,40 @@ fr:
veuillez visiter le %{help_link} de %{app_name} ou %{contact_link}.
subject: Adresse email supprimée
help_link_text: Centre d’aide
in_person_failed:
body: Cliquez sur le bouton ou copiez le lien ci-dessous pour essayer de
vérifier à nouveau votre identité en ligne par le biais de %{app_name}.
Si vous rencontrez toujours des problèmes, veuillez contacter l’agence à
laquelle vous essayez d’accéder.
intro: Votre identité n’a pas pu être vérifiée au bureau de poste de %{location}
le %{date}.
subject: Votre identité n’a pas pu être vérifiée en personne
verifying_identity: 'Lors de la vérification de votre identité :'
verifying_step_not_expired: Votre carte d’identité ou votre permis de conduire
délivré par l’État ne doit pas être périmé. Nous n’acceptons
actuellement aucune autre forme d’identification, comme les passeports
et les cartes d’identité militaires.
verifying_step_proof_of_address: Si vous tentez à nouveau de vérifier votre
identité en personne, vous devez apporter un justificatif de domicile
valable si votre adresse actuelle est différente de celle figurant sur
votre pièce d’identité.
in_person_ready_to_verify:
greeting: Bonjour %{name},
intro: Voici les détails pour vérifier votre identité en personne dans un bureau
de poste des États-Unis près de chez vous.
subject: Vous êtes prêt à vérifier votre identité avec %{app_name} en personne
in_person_verified:
greeting: Bonjour,
intro: Vous avez vérifié avec succès votre identité au bureau de poste de
%{location} le %{date}.
next_sign_in: Ensuite, cliquez sur le bouton ou copiez le lien ci-dessous pour
vous connecter à %{app_name}.
sign_in: Se connecter
subject: Vous avez vérifié avec succès votre identité avec %{app_name}
warning_contact_us_html: Si vous n’avez pas essayé de vérifier votre identité en
personne, veuillez <a href="%{contact_us_url}">nous contacter</a> et
vous <a href="%{sign_in_url}">connecter</a> pour changer votre mot de
passe.
letter_reminder:
info_html: La lettre que vous êtes sur le point de recevoir contiendra un code
de confirmation nous permettant de vérifier votre adresse. Vous pouvez
Expand Down
Loading