From ef57b9f267ef6dde06242e23a1456cf38ca3094b Mon Sep 17 00:00:00 2001 From: Bethany Seeger Date: Thu, 7 Mar 2024 09:52:10 -0500 Subject: [PATCH] Update personInfo page and update tests. --- .../java/org/mdbenefits/app/inputs/MdBenefitsFlow.java | 3 ++- .../app/preparers/ApplicantDetailsPreparer.java | 7 +++++-- src/main/resources/messages.properties | 8 ++++---- .../resources/templates/mdBenefitsFlow/personalInfo.html | 9 +++++---- .../app/journeys/MdBenefitsFlowJourneyTest.java | 5 +++-- .../app/preparers/ApplicantDetailsPreparerTest.java | 8 +++++++- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/mdbenefits/app/inputs/MdBenefitsFlow.java b/src/main/java/org/mdbenefits/app/inputs/MdBenefitsFlow.java index d2a7a54b..dd7bfb82 100644 --- a/src/main/java/org/mdbenefits/app/inputs/MdBenefitsFlow.java +++ b/src/main/java/org/mdbenefits/app/inputs/MdBenefitsFlow.java @@ -38,10 +38,11 @@ public class MdBenefitsFlow extends FlowInputs { @NotBlank(message = "{error.missing-firstname}") private String firstName; + private String middleName; + @NotBlank(message = "{error.missing-lastname}") private String lastName; - private String otherNames; private String birthDay; private String birthMonth; diff --git a/src/main/java/org/mdbenefits/app/preparers/ApplicantDetailsPreparer.java b/src/main/java/org/mdbenefits/app/preparers/ApplicantDetailsPreparer.java index f5ecd4f8..1a6e0d8f 100644 --- a/src/main/java/org/mdbenefits/app/preparers/ApplicantDetailsPreparer.java +++ b/src/main/java/org/mdbenefits/app/preparers/ApplicantDetailsPreparer.java @@ -8,7 +8,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import java.util.stream.Stream; import lombok.extern.slf4j.Slf4j; import org.mdbenefits.app.data.enums.CitizenshipStatus; @@ -28,6 +27,10 @@ public Map prepareSubmissionFields(Submission submissio Map inputData = submission.getInputData(); String fullName = String.format("%s, %s", inputData.get("lastName"), inputData.get("firstName")); + if (inputData.get("middleName") != null) { + fullName += ", " + inputData.get("middleName"); + } + results.put("applicantFullName", new SingleField("applicantFullName", (String) fullName, null)); var dob = Stream.of("birthMonth", "birthDay", "birthYear") @@ -48,7 +51,7 @@ public Map prepareSubmissionFields(Submission submissio results.put("applicantSex", new SingleField("applicantSex", "", null)); } - if (inputData.getOrDefault("isApplicantPregnant","No").toString().equalsIgnoreCase("Yes")) { + if (inputData.getOrDefault("isApplicantPregnant", "No").toString().equalsIgnoreCase("Yes")) { results.put("applicantIsPregnantName", new SingleField("applicantIsPregnantName", (String) fullName, null)); } diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index 06c50a28..679239c8 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -294,13 +294,13 @@ signpost.contact-info=Contact info # Personal info personal-info.title=Personal info -personal-info.header=Tell us about yourself +personal-info.header=Let's get to know you personal-info.firstname=What's your first name? personal-info.firstname-help=Legally as it appears on your ID +personal-info.middlename=What's your middle name? +personal-info.middlename-help=Legally as it appears on your ID personal-info.lastname=What's your last name? -personal-info.lastname-help=Legally as it appears on your ID. If you have 2 last names, type it exactly as it is written on your ID (ex: with hyphens, or 2 words). -personal-info.othernames=Other names you use now or have used in the past -personal-info.othernames-help=List maiden names, legal name changes, and gender preferred names. +personal-info.lastname-help=Legally as it appears on your ID. personal-info.birthdate=When were you born? personal-info.sex.title=Applicant Sex diff --git a/src/main/resources/templates/mdBenefitsFlow/personalInfo.html b/src/main/resources/templates/mdBenefitsFlow/personalInfo.html index 9a2e546a..21ab13de 100644 --- a/src/main/resources/templates/mdBenefitsFlow/personalInfo.html +++ b/src/main/resources/templates/mdBenefitsFlow/personalInfo.html @@ -20,15 +20,16 @@ label=#{personal-info.firstname}, helpText=#{personal-info.firstname-help})}"/> + + - result = preparer.prepareSubmissionFields(submission, null); + assertThat(result.get("applicantFullName")) + .isEqualTo(new SingleField("applicantFullName", "Doe, John, MiddleName", null)); + } }