Skip to content

LG-6896: Send 'fraud suspected' in-person proofing failed email#7013

Merged
svalexander merged 23 commits intomainfrom
shannon/lg-6896-email-failed-fraud
Sep 26, 2022
Merged

LG-6896: Send 'fraud suspected' in-person proofing failed email#7013
svalexander merged 23 commits intomainfrom
shannon/lg-6896-email-failed-fraud

Conversation

@svalexander
Copy link
Contributor

@svalexander svalexander commented Sep 22, 2022

Ticket

What: This pr sends a delayed failure email to a user who has completed in person proofing and fraudSuspected was true.

How: Added a new email template for this failure version as well as updated the usps job. Because there are now two versions of the failure email we need to check the value of status within handle_failed_status().
Note: fraudSuspected is a string according to the api documentation. There are some mock files (perhaps others) where it is a boolean, we should address this in another ticket.

Testing the email
To preview the email visit http://localhost:3000/rails/mailers/user_mailer/in_person_failed_fraud.html?locale=en
Or to trigger an email sent to mailcatcher update response on lines 86-88 to
response = JSON.parse(UspsInPersonProofing::Mock::Fixtures.request_failed_suspected_fraud_proofing_results_response)

En version Screen Shot 2022-09-22 at 11 15 14 AM
Es version Screen Shot 2022-09-22 at 11 15 39 AM
Fr version Screen Shot 2022-09-22 at 11 15 54 AM

@svalexander svalexander changed the title Shannon/lg 6896 email failed fraud LG-6896: Send 'fraud suspected' in-person proofing failed email Sep 22, 2022
Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple minor comments, but LGTM overall 👍


enrollment.update(status: :failed)
send_failed_email(enrollment.user, enrollment)
if response['fraudSuspected'] == true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the value is already a boolean, I think we could leave out the "equals" comparison.

Suggested change
if response['fraudSuspected'] == true
if response['fraudSuspected']

Comment on lines +2 to +16
"status": "In-person failed",
"proofingPostOffice": "WILKES BARRE",
"proofingCity": "WILKES BARRE",
"proofingState": "PA",
"enrollmentCode": "2090002197604352",
"primaryIdType": "Uniformed Services identification card",
"transactionStartDateTime": "12/17/2020 033855",
"transactionEndDateTime": "12/17/2020 034055",
"secondaryIdType": "Deed of Trust",
"failureReason": "Clerk indicates that ID name or address does not match source data.",
"fraudSuspected": true,
"proofingConfirmationNumber": "350040248346707",
"ippAssuranceLevel": "1.5"
}

No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor whitespace suggestions:

Suggested change
"status": "In-person failed",
"proofingPostOffice": "WILKES BARRE",
"proofingCity": "WILKES BARRE",
"proofingState": "PA",
"enrollmentCode": "2090002197604352",
"primaryIdType": "Uniformed Services identification card",
"transactionStartDateTime": "12/17/2020 033855",
"transactionEndDateTime": "12/17/2020 034055",
"secondaryIdType": "Deed of Trust",
"failureReason": "Clerk indicates that ID name or address does not match source data.",
"fraudSuspected": true,
"proofingConfirmationNumber": "350040248346707",
"ippAssuranceLevel": "1.5"
}
"status": "In-person failed",
"proofingPostOffice": "WILKES BARRE",
"proofingCity": "WILKES BARRE",
"proofingState": "PA",
"enrollmentCode": "2090002197604352",
"primaryIdType": "Uniformed Services identification card",
"transactionStartDateTime": "12/17/2020 033855",
"transactionEndDateTime": "12/17/2020 034055",
"secondaryIdType": "Deed of Trust",
"failureReason": "Clerk indicates that ID name or address does not match source data.",
"fraudSuspected": true,
"proofingConfirmationNumber": "350040248346707",
"ippAssuranceLevel": "1.5"
}

Copy link
Contributor

@tomas-nava tomas-nava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some suggestions to fix failing tests!

)
mail(
to: email_address.email,
subject: t('user_mailer.in_person_failed_suspected_fraud.subject', app_name: APP_NAME),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
subject: t('user_mailer.in_person_failed_suspected_fraud.subject', app_name: APP_NAME),
subject: t('user_mailer.in_person_failed_suspected_fraud.subject'),

There's no app_name variable in this translation.

Comment on lines +3 to +7
<%= t(
'user_mailer.in_person_failed_suspected_fraud.body.intro',
location: @presenter.location_name,
date: @presenter.formatted_verified_date,
) %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<%= t(
'user_mailer.in_person_failed_suspected_fraud.body.intro',
location: @presenter.location_name,
date: @presenter.formatted_verified_date,
) %>
<%= t(
'user_mailer.in_person_failed_suspected_fraud.body.intro',
app_name: APP_NAME,
location: @presenter.location_name,
date: @presenter.formatted_verified_date,
) %>

We should pass app_name here and use it instead of Login.gov in the translations

href="%{help_center_url}">visit our Help Center</a> or reach out to
the agency you are trying to access.
intro: We understand that you were attempting to verify your identity through
Login.gov, however your identity could not be verified at the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Login.gov, however your identity could not be verified at the
%{app_name}, however your identity could not be verified at the

We should always use app_name instead of hardcoding Login.gov

href="%{help_center_url}">visitar nuestro Centro de Ayuda</a> o
ponerse en contacto con la agencia a la que intenta acceder.
intro: Entendemos que estaba intentando verificar su identidad a través de
Login.gov, sin embargo, su identidad no pudo ser verificada en la
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Login.gov, sin embargo, su identidad no pudo ser verificada en la
%{app_name}, sin embargo, su identidad no pudo ser verificada en la

We should always use app_name instead of hardcoding Login.gov

href="%{help_center_url}">consulter notre centre d’aide</a> ou
contacter l’agence à laquelle vous essayez d’accéder.
intro: Nous comprenons que vous avez tenté de vérifier votre identité par le
biais de Login.gov, mais votre identité n’a pas pu être vérifiée au
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
biais de Login.gov, mais votre identité n’a pas pu être vérifiée au
biais de %{app_name}, mais votre identité n’a pas pu être vérifiée au

We should always use app_name instead of hardcoding Login.gov

@svalexander svalexander merged commit 688a0d1 into main Sep 26, 2022
@svalexander svalexander deleted the shannon/lg-6896-email-failed-fraud branch September 26, 2022 20:23
@solipet solipet mentioned this pull request Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants