Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCAP-466 #960

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 7 additions & 2 deletions src/main/java/org/ilgcc/app/inputs/Providerresponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public class Providerresponse extends FlowInputs {
private String providerLicenseExemptRelationship;

private String providerIdentityCheckSSN;

private String providerType;
}


private String providerIdentityCheckDateOfBirthDay;
private String providerIdentityCheckDateOfBirthMonth;
private String providerIdentityCheckDateOfBirthYear;
private String providerIdentityCheckDateOfBirthDate;}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ private Map<String, SubmissionField> prepareProviderResponse(Submission submissi
"providerResponseBusinessName",
"providerResponseContactPhoneNumber",
"providerResponseContactEmail",
"providerIdentityCheckSSN"
"providerIdentityCheckSSN",
"providerIdentityCheckDateOfBirthDate"
);

Submission providerSubmission = providerSubmissionFromId(submission).get();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.ilgcc.app.submission.actions;

import formflow.library.config.submission.Action;
import formflow.library.data.FormSubmission;
import formflow.library.data.Submission;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.ilgcc.app.utils.DateUtilities;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class CreateProviderIdentityCheckDOB implements Action {

@Override
public void run(FormSubmission formSubmission, Submission submission) {
log.info(String.format("Running %s", this.getClass().getName()));
String prefix = "providerIdentityCheckDateOfBirth";
Map<String, Object> inputData = formSubmission.getFormData();
DateTimeFormatter dtf = DateTimeFormat.forPattern("MM/dd/yyyy");
String parentDateString = String.format("%s/%s/%s",
inputData.get(prefix + "Month"),
inputData.get(prefix + "Day"),
inputData.get(prefix + "Year"));

if (DateUtilities.isDateInvalid(parentDateString)) {
return;
}

String formattedDate = dtf.print(dtf.parseDateTime(parentDateString));
formSubmission.formData.put(prefix + "Date", formattedDate);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.ilgcc.app.submission.actions;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ValidateHomeProviderDateOfBirth extends ValidateBirthdate {

public ValidateHomeProviderDateOfBirth(MessageSource messageSource) {
super(messageSource, "providerIdentityCheckDateOfBirth", "providerIdentityCheckDateOfBirthDate");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.ilgcc.app.submission.conditions;

import formflow.library.config.submission.Condition;
import formflow.library.data.Submission;
import java.util.List;
import org.ilgcc.app.utils.enums.ProviderType;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ProviderDOBRequired implements Condition {

final static List providerTypesRequired = List.of(
ProviderType.LICENSE_EXEMPT_RELATIVE_IN_PROVIDER_HOME.name(),
ProviderType.LICENSE_EXEMPT_NONRELATIVE_IN_PROVIDER_HOME.name(),
ProviderType.LICENSE_EXEMPT_RELATIVE_IN_CHILDS_HOME.name(),
ProviderType.LICENSE_EXEMPT_NONRELATIVE_IN_CHILDS_HOME.name()
);

@Value("${il-gcc.allow-provider-registration-flow}")
private boolean enableProviderRegistration;

@Override
public Boolean run(Submission submission) {
return enableProviderRegistration && displayScreen(submission);
}

private Boolean displayScreen(Submission submission) {
String providerType = (String) submission.getInputData().getOrDefault("providerType", "");
return providerTypesRequired.contains(providerType);
}
}
4 changes: 3 additions & 1 deletion src/main/resources/flows-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,9 @@ flow:
nextScreens:
- name: registration-home-provider-dob
registration-home-provider-dob:
condition: EnableProviderRegistration
crossFieldValidationAction: ValidateHomeProviderDateOfBirth
onPostAction: CreateProviderIdentityCheckDOB
condition: ProviderDOBRequired
nextScreens:
- name: registration-tax-id
registration-tax-id:
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,9 @@ registration-home-provider-ssn.secure-footer=Your information is secure and will
registration-home-provider-ssn.error=Make sure the ssn is valid and 9 digits

# registration-home-provider-dob
registration-home-provider-dob.title=Date of birth
registration-home-provider-dob.header=What is your date of birth?
registration-home-provider-dob.helper=This will help us verify your identity.


# registration-checks-trainings-intro
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/pdf-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ inputFields:
providerLicenseNumber: PROVIDER_LICENSE_NUMBER
providerType: PROVIDER_TYPE
providerIdentityCheckSSN: PROVIDER_SSN
providerIdentityCheckDateOfBirthDate: PROVIDER_DOB
providerSignature: PROVIDER_SIGNATURE
providerSignatureDate: PROVIDER_SIGNATURE_DATE
clientResponseConfirmationCode: APPLICATION_CONFIRMATION_CODE
Expand Down
19 changes: 19 additions & 0 deletions src/main/resources/templates/fragments/gcc-icons.html
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,25 @@ <h1>GCC Icons</h1>
</svg>
</td>
</tr>
<tr>
<td>calendar</td>
<td>
<svg th:fragment="calendar" aria-hidden="true" width="101" height="75" viewBox="0 0 101 75" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M78.0323 65.0161C71.9547 70.0396 63.7557 70.5292 55.973 71.8791C48.031 73.2566 39.9632 75.7579 32.3906 72.9325C24.3233 69.9224 17.2202 63.9052 13.6252 56.0783C10.1027 48.4091 11.6522 39.6751 13.3286 31.4309C14.9321 23.5451 17.0872 15.4229 22.9985 9.98227C28.7887 4.65303 36.9612 3.37867 44.7946 2.47002C52.341 1.59466 60.0031 1.70313 66.9234 4.88711C74.0542 8.16795 79.8467 13.6848 83.8504 20.4393C88.0582 27.5382 91.0384 35.6172 89.9737 43.7747C88.8944 52.0446 84.4478 59.7131 78.0323 65.0161Z" fill="#769BF3"/>
<path d="M86 14C86 13.1716 85.3284 12.5 84.5 12.5H16.5C15.6716 12.5 15 13.1716 15 14V64C15 64.8284 15.6716 65.5 16.5 65.5H84.5C85.3284 65.5 86 64.8284 86 64V14Z" fill="white" stroke="#121111" stroke-width="3" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
<rect x="16.5" y="13" width="68" height="10" fill="#769BF3" fill-opacity="0.35"/>
<rect x="16.5" y="29" width="68" height="7" fill="#769BF3" fill-opacity="0.35"/>
<rect x="16.5" y="41" width="68" height="7" fill="#769BF3" fill-opacity="0.35"/>
<rect x="16.5" y="53" width="68" height="7" fill="#769BF3" fill-opacity="0.35"/>
<line x1="16" y1="23.5" x2="84" y2="23.5" stroke="black" stroke-width="3" stroke-linecap="round"/>
<line x1="28" y1="24.5" x2="28" y2="65.5" stroke="black" stroke-width="3" stroke-linecap="round"/>
<line x1="43" y1="24.5" x2="43" y2="65.5" stroke="black" stroke-width="3" stroke-linecap="round"/>
<line x1="58" y1="24.5" x2="58" y2="65.5" stroke="black" stroke-width="3" stroke-linecap="round"/>
<line x1="73" y1="24.5" x2="73" y2="65.5" stroke="black" stroke-width="3" stroke-linecap="round"/>
</svg>

</td>
</tr>
</tbody>
</table>
<hr/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head :: head(title='TEMPLATE')}"></head>
<body>
<div class="page-wrapper">
<div th:replace="~{fragments/toolbar :: toolbar}"></div>
<section class="slab">
<div class="grid">
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35">
<th:block th:replace="~{fragments/cardHeader :: cardHeader(header=#{placeholder}, subtext=#{placeholder})}"/>
<th:block th:replace="~{fragments/form :: form(action=${formAction}, content=~{::formContent})}">
<th:block th:ref="formContent">
<div class="form-card__content">
<!-- Put inputs here -->
</div>
<div class="form-card__footer">
<th:block th:replace="~{fragments/inputs/submitButton :: submitButton(text=#{general.inputs.continue})}"/>
</div>
</th:block>
</th:block>
</main>
</div>
</section>
</div>
<th:block th:replace="~{fragments/footer :: footer}"/>
</body>
</html>
<th:block
th:replace="~{fragments/screens/screenWithOneInput ::
screenWithOneInput(
title=#{registration-home-provider-dob.title},
header=#{registration-home-provider-dob.header},
subtext=#{registration-home-provider-dob.helper},
buttonLabel=#{general.button.continue},
required='true',
formAction=${formAction},
iconFragment=~{fragments/gcc-icons :: calendar},
inputContent=~{::inputContent})}">
<th:block th:ref="inputContent">
<th:block th:replace="~{fragments/inputs/date ::
date(inputName='providerIdentityCheckDateOfBirth',
ariaLabel='header',
groupName='providerIdentityCheckDateOfBirthDate')}"/>
</th:block>
</th:block>
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ void LicenseExemptInProviderHomeFlow() {

testPage.clickContinue();
// registration-home-provider-dob
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("registration-home-provider-dob.title"));
Copy link
Contributor

Choose a reason for hiding this comment

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

This is great! It should skip in the other flows (Licensed home, Licensed group home, Licensed day care, licensed exempt day care)

testPage.enter("providerIdentityCheckDateOfBirthMonth", "12");
testPage.enter("providerIdentityCheckDateOfBirthDay", "25");
testPage.enter("providerIdentityCheckDateOfBirthYear", "1985");
testPage.clickContinue();


// registration-checks-trainings-intro
Expand Down Expand Up @@ -269,6 +274,11 @@ void LicenseExemptInChildHomeFlow() {

testPage.clickContinue();
// registration-home-provider-dob
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("registration-home-provider-dob.title"));
testPage.enter("providerIdentityCheckDateOfBirthMonth", "12");
testPage.enter("providerIdentityCheckDateOfBirthDay", "25");
testPage.enter("providerIdentityCheckDateOfBirthYear", "1985");
testPage.clickContinue();


// registration-checks-trainings-intro
Expand Down Expand Up @@ -516,8 +526,6 @@ void LicensedGroupChildCareCenterFlow() {
testPage.enter("providerIdentityCheckSSN", "123456789");

testPage.clickContinue();
// registration-home-provider-dob


// registration-checks-trainings-intro
testPage.navigateToFlowScreen("providerresponse/registration-checks-trainings-intro");
Expand Down
5 changes: 1 addition & 4 deletions src/test/java/org/ilgcc/app/pdf/ParentPreparerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

import formflow.library.data.Submission;
import formflow.library.data.Submission.SubmissionBuilder;
import formflow.library.pdf.SingleField;
import formflow.library.pdf.SubmissionField;
import java.util.List;
Expand Down Expand Up @@ -121,9 +120,7 @@ public void shouldPreparePrimaryEducationTypeCheckboxFieldWhenSelected(){
Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null);
assertThat(result.get("parentEducation")).isEqualTo(new SingleField("parentEducation", "APPLICANT_EDUCATION_TYPE_HIGH_SCHOOL", null));
}
//Paramaterized Test
//Add in a parent with a gender and write to the correct PDF field
//GenderTests

@Test
public void shouldSelectMaleCheckboxWhenApplicantIdentifiesAsMale(){
submission = new SubmissionTestBuilder()
Expand Down
Loading