Skip to content

Commit

Permalink
[CCAP-684] - Adds new logic for provider and family confirmation emai…
Browse files Browse the repository at this point in the history
…ls (#1189)
  • Loading branch information
analoo authored Feb 24, 2025
1 parent 532e586 commit 5da002b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void run(FormSubmission formSubmission, Submission providerSubmission) {
String familySubmissionConfirmationId = familySubmission.getShortCode();

Locale locale =
providerSubmission.getInputData().getOrDefault("languageRead", "English").equals("Spanish") ? Locale.forLanguageTag(
familySubmission.getInputData().getOrDefault("languageRead", "English").equals("Spanish") ? Locale.forLanguageTag(
"es") : Locale.ENGLISH;

String senderName = messageSource.getMessage("email.general.sender-name", null, locale);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.ilgcc.app.utils.ProviderSubmissionUtilities;
import org.ilgcc.jobs.SendEmailJob;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;

@Slf4j
Expand All @@ -26,6 +27,8 @@ public class SendProviderConfirmationEmail implements Action {
protected static String EMAIL_SENT_STATUS_INPUT_NAME = "providerConfirmationEmailSent";
protected static String RECIPIENT_EMAIL_INPUT_NAME = "providerResponseContactEmail";

protected static Locale locale;

protected static MessageSource messageSource;

protected final SubmissionRepositoryService submissionRepositoryService;
Expand All @@ -42,15 +45,14 @@ public SendProviderConfirmationEmail(SendEmailJob sendEmailJob, MessageSource me
@Override
public void run(Submission submission) {
if (!skipEmailSend(submission)) {
Locale locale =
submission.getInputData().getOrDefault("languageRead", "English").equals("Spanish") ? Locale.forLanguageTag(
"es") : Locale.ENGLISH;
Optional<Map<String, Object>> emailData = getEmailData(submission);

if (emailData.isEmpty()) {
return;
}

locale = LocaleContextHolder.getLocale();

ILGCCEmail email = ILGCCEmail.createProviderConfirmationEmail(getSenderName(locale), getRecipientEmail(submission),
setSubject(emailData.get(), locale), new Content("text/html", setBodyCopy(emailData.get(), locale)),
submission.getId());
Expand Down

0 comments on commit 5da002b

Please sign in to comment.