Skip to content

Commit

Permalink
Added condition to pag
Browse files Browse the repository at this point in the history
  • Loading branch information
enyia21 committed Dec 24, 2024
1 parent 7b2ed75 commit 4d2b176
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 7 deletions.
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);
}
}
2 changes: 1 addition & 1 deletion src/main/resources/flows-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ flow:
registration-home-provider-dob:
crossFieldValidationAction: ValidateHomeProviderDateOfBirth
onPostAction: CreateProviderIdentityCheckDOB
condition: EnableProviderRegistration
condition: ProviderDOBRequired
nextScreens:
- name: registration-tax-id
registration-tax-id:
Expand Down
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"));
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

0 comments on commit 4d2b176

Please sign in to comment.