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

Update Sign and Submit screens #32

Merged
merged 12 commits into from
Feb 7, 2024
23 changes: 14 additions & 9 deletions src/main/java/org/mdbenefits/app/inputs/MdBenefitsFlow.java
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,6 @@ public class MdBenefitsFlow extends FlowInputs {
@NotEmpty(message = "{error.missing-checkbox}")
private List<String> rightsAndResponsibilitiesAgree;

@NotEmpty(message = "{error.missing-checkbox}")
private List<String> noIncorrectInformationAgree;

@NotEmpty(message = "{error.missing-checkbox}")
private List<String> programsSharingDataAccessAgree;

@NotEmpty(message = "{error.missing-checkbox}")
private List<String> nonDiscriminationStatementAgree;

@NotBlank(message = "{error.missing-general}")
private String signature;

Expand Down Expand Up @@ -406,4 +397,18 @@ public class MdBenefitsFlow extends FlowInputs {
@NotBlank(message = "{doc-type.select-a-type}")
@DynamicField
private String docType;

private List<String> noOneHasDrugKingpinFelony;
private List<String> noOneHasVolumeDrugDealerFelony;
private List<String> noOneHasSexualOffenceConviction;
private List<String> noOneIsViolatingParole;
private List<String> noOneConvictedForLyingAboutBenefits;
private List<String> noOneConvictedForTradingBenefits;
private List<String> noOneIsReceivingBenefitsWithFakeID;

@NotEmpty(message = "{error.missing-checkbox}")
private List<String> tcaAcknowledgementAgree;

@NotEmpty(message = "{error.missing-checkbox}")
private List<String> ohepAcknowledgementAgree;
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package org.mdbenefits.app.preparers;

import formflow.library.data.Submission;
import formflow.library.pdf.CheckboxField;
import formflow.library.pdf.PdfMap;
import formflow.library.pdf.SingleField;
import formflow.library.pdf.SubmissionField;
import formflow.library.pdf.SubmissionFieldPreparer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j;
import org.mdbenefits.app.utils.SubmissionUtilities;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ApplicantDetailsPreparer implements SubmissionFieldPreparer {

@Override
Expand All @@ -25,7 +25,6 @@ public Map<String, SubmissionField> prepareSubmissionFields(Submission submissio

String fullName = String.format("%s, %s", inputData.get("lastName"), inputData.get("firstName"));
results.put("applicantFullName", new SingleField("applicantFullName", (String) fullName, null));
results.put("applicantFullName_1", new SingleField("applicantFullName", (String) fullName, 1));

var dob = Stream.of("birthMonth", "birthDay", "birthYear")
.map(inputData::get)
Expand All @@ -36,6 +35,20 @@ public Map<String, SubmissionField> prepareSubmissionFields(Submission submissio
results.put("applicantSSN", new SingleField("applicantSSN", SubmissionUtilities.formatSSN((String) inputData.get("encryptedSSN")), null));
results.put("speaksEnglish", new SingleField("speaksEnglish", (String) "Yes", null));

prepareAnswersToSensitiveQuestions(inputData, results);
return results;
}

private static void prepareAnswersToSensitiveQuestions(Map<String, Object> inputData, Map<String, SubmissionField> results) {
for (String question : SubmissionUtilities.SENSITIVE_CONVICTION_QUESTIONS) {
String yesField = "noOne" + question;
String noField = "someone" + question;
List<String> response = (List<String>) inputData.get(yesField + "[]");
if (response != null && response.contains("true")) {
results.put(yesField, new SingleField(yesField, "Yes", null));
} else {
results.put(noField, new SingleField(noField, "Yes", null));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.mdbenefits.app.submission.actions;

import formflow.library.config.submission.Action;
import formflow.library.data.Submission;
import java.util.Arrays;
import lombok.extern.slf4j.Slf4j;
import org.mdbenefits.app.utils.SubmissionUtilities;
import org.springframework.stereotype.Component;

/**
*
*/
@Component
@Slf4j
public class SetDefaultSensitiveConvictionAnswers implements Action {

@Override
public void run(Submission submission) {
Arrays.stream(SubmissionUtilities.SENSITIVE_CONVICTION_QUESTIONS).forEach(s -> submission.getInputData().putIfAbsent("noOne" + s + "[]", "true"));
}
bseeger marked this conversation as resolved.
Show resolved Hide resolved
}
bseeger marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
public class SubmissionUtilities {

public static final String ENCRYPTED_SSNS_INPUT_NAME = "householdMemberEncryptedSSN";
public static final String[] SENSITIVE_CONVICTION_QUESTIONS = {
"IsReceivingBenefitsWithFakeID",
"ConvictedForLyingAboutBenefits",
"IsViolatingParole",
"ConvictedForTradingBenefits",
"HasDrugKingpinFelony",
"HasVolumeDrugDealerFelony",
"HasSexualOffenceConviction"
};

public static Long expiryHours = 2L;

Expand Down
23 changes: 18 additions & 5 deletions src/main/resources/flows-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -404,19 +404,16 @@ flow:
nextScreens:
- name: ethnicitySelection
condition: ApplicantRaceEthnicityQuestionsAllowed
- name: legalStuff
- name: docUploadIntro
ethnicitySelection:
nextScreens:
- name: raceSelection
raceSelection:
nextScreens:
- name: legalStuff
legalStuff:
nextScreens:
- name: docUploadIntro
docUploadIntro:
nextScreens:
- name: signature
- name: legalStuff
condition: DoesNotWantToAddDocs
- name: docUploadInstructions
docUploadInstructions:
Expand All @@ -428,6 +425,22 @@ flow:
nextScreens:
- name: docUploadFinish
docUploadFinish:
nextScreens:
- name: legalStuff
legalStuff:
nextScreens:
- name: sensitiveConvictionQuestionsIntro
sensitiveConvictionQuestionsIntro:
nextScreens:
- name: sensitiveConvictionQuestions
sensitiveConvictionQuestions:
beforeDisplayAction: SetDefaultSensitiveConvictionAnswers
nextScreens:
- name: rightsAndResponsibilities
rightsAndResponsibilities:
nextScreens:
- name: tcaOhepAgreement
tcaOhepAgreement:
nextScreens:
- name: signature
signature:
Expand Down
Loading
Loading