Skip to content

Commit

Permalink
Add conviction-related sensitive questions
Browse files Browse the repository at this point in the history
  • Loading branch information
vrajmohan committed Feb 3, 2024
1 parent 170bc0c commit 46cf4dd
Show file tree
Hide file tree
Showing 11 changed files with 169 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/org/mdbenefits/app/inputs/MdBenefitsFlow.java
Original file line number Diff line number Diff line change
Expand Up @@ -403,4 +403,12 @@ public class MdBenefitsFlow extends FlowInputs {
@NotBlank(message = "{doc-type.select-a-type}")
@DynamicField
private String docType;

private String noOneHasDrugKingpinFelony;
private String noOneHasVolumeDrugDealerFelony;
private String noOneHasSexualOffenceConviction;
private String noOneIsViolatingParole;
private String noOneConvictedForLyingAboutBenefits;
private String noOneConvictedForTradingBenefits;
private String noOneIsReceivingBenefitsWithFakeID;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j;
import org.mdbenefits.app.submission.actions.SetDefaultSensitiveConvictionAnswers;
import org.mdbenefits.app.utils.SubmissionUtilities;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ApplicantDetailsPreparer implements SubmissionFieldPreparer {

@Override
Expand All @@ -36,6 +39,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 : SetDefaultSensitiveConvictionAnswers.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,32 @@
package org.mdbenefits.app.submission.actions;

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

/**
*
*/
@Component
@Slf4j
public class SetDefaultSensitiveConvictionAnswers implements Action {
public static final String[] SENSITIVE_CONVICTION_QUESTIONS = {
"HasDrugKingpinFelony",
"HasVolumeDrugDealerFelony",
"HasSexualOffenceConviction",
"IsViolatingParole",
"ConvictedForLyingAboutBenefits",
"ConvictedForTradingBenefits",
"IsReceivingBenefitsWithFakeID"
};

@Override
public void run(Submission submission) {
Arrays.stream(SENSITIVE_CONVICTION_QUESTIONS).forEach(s -> submission.getInputData().putIfAbsent("noOne" + s + "[]", "true"));
}
}
7 changes: 7 additions & 0 deletions src/main/resources/flows-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,13 @@ flow:
nextScreens:
- name: legalStuff
legalStuff:
nextScreens:
- name: sensitiveConvictionQuestionsIntro
sensitiveConvictionQuestionsIntro:
nextScreens:
- name: sensitiveConvictionQuestions
sensitiveConvictionQuestions:
beforeDisplayAction: SetDefaultSensitiveConvictionAnswers
nextScreens:
- name: rightsAndResponsibilities
rightsAndResponsibilities:
Expand Down
16 changes: 16 additions & 0 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,22 @@ legal-stuff.answer-legal-question=Answer legal questions
legal-stuff.review-legal-agreements=Review legal agreements
legal-stuff.sign-and-submit=Sign and submit

sensitive-conviction-questions.title=Sensitive Questions
sensitive-conviction-questions.header=Please check what is true for you and everyone in your household
sensitive-conviction-questions.subtext=If any statements are not true, you can talk to a case worker after submitting your application to see who is able to get benefits.

sensitive-conviction-question-HasDrugKingpinFelony=No one has been convicted of a felony that involved conspiring to supervise, organize, finance, or manage the making, transporting, or selling of controlled substances in the State on or after August 22, 1996.
sensitive-conviction-question-HasVolumeDrugDealerFelony=No one has been convicted of a felony that involved making, distributing, dispensing, or possessing controlled substances on or after August 22, 1996.
sensitive-conviction-question-HasSexualOffenceConviction=No one has been convicted abuse, assault, murder, or exploitation after February 7, 2014 and is not compliant with the terms of their sentence.
sensitive-conviction-question-IsViolatingParole=No one is violating parole, probation or fleeing from police or the courts.
sensitive-conviction-question-ConvictedForLyingAboutBenefits=Since August 22, 1996, no one has been convicted in courts of lying about where they lived or their identity in order to receive food benefits or cash assistance from multiple places in the same month.
sensitive-conviction-question-ConvictedForTradingBenefits=No one has been convicted in a court for trafficking $500 or more of food benefits.
sensitive-conviction-question-IsReceivingBenefitsWithFakeID=No one is getting food or cash benefits under a different identity or as a member of another household in another State.
sensitive-conviction-question-true=True

sensitive-conviction-questions-intro.title=Sensitive Questions Intro
sensitive-conviction-questions-intro.header=Sensitive questions
sensitive-conviction-questions-intro.subtext=Next, we will ask you questions that may be sensitive.<br/><br/>It's important to be honest so we can give you and your household the benefits you're entitled to get.

rights-and-responsibilities-title=Legal Stuff
rights-and-responsibilities-header1=The legal stuff
Expand Down
16 changes: 16 additions & 0 deletions src/main/resources/pdf-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ inputFields:
mailingAddress: mailingAddress
signature: signature
sex: applicantSex

someoneHasDrugKingpinFelony: someoneHasDrugKingpinFelony
noOneHasDrugKingpinFelony: noOneHasDrugKingpinFelony
someoneHasVolumeDrugDealerFelony: someoneHasVolumeDrugDealerFelony
noOneHasVolumeDrugDealerFelony: noOneHasVolumeDrugDealerFelony
someoneHasSexualOffenceConviction: someoneHasSexualOffenceConviction
noOneHasSexualOffenceConviction: noOneHasSexualOffenceConviction
someoneIsViolatingParole: someoneIsViolatingParole
noOneIsViolatingParole: noOneIsViolatingParole
someoneConvictedForLyingAboutBenefits: someoneConvictedForLyingAboutBenefits
noOneConvictedForLyingAboutBenefits: noOneConvictedForLyingAboutBenefits
someoneConvictedForTradingBenefits: someoneConvictedForTradingBenefits
noOneConvictedForTradingBenefits: noOneConvictedForTradingBenefits
someoneIsReceivingBenefitsWithFakeID: someoneIsReceivingBenefitsWithFakeID
noOneIsReceivingBenefitsWithFakeID: noOneIsReceivingBenefitsWithFakeID

# Vraj - Usable to here


Expand Down
Binary file modified src/main/resources/pdfs/9701.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}">
<head th:replace="~{fragments/head :: head(title=#{sensitive-conviction-questions.title})}"></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=#{sensitive-conviction-questions.header}, subtext=#{sensitive-conviction-questions.subtext})}"/>
<th:block
th:replace="~{fragments/form :: form(action=${formAction}, content=~{::sensitiveQuestionsContent})}">
<th:block th:ref="sensitiveQuestionsContent">
<div class="form-card__content"
th:each="question : ${T(org.mdbenefits.app.submission.actions.SetDefaultSensitiveConvictionAnswers).SENSITIVE_CONVICTION_QUESTIONS}">
<div th:with="inputName='noOne' + ${question}, label='sensitive-conviction-question-' + ${question}">
<th:block th:replace="~{fragments/inputs/checkboxFieldset ::
checkboxFieldset(inputName=${inputName},
label=#{${label}},
content=~{::checkboxInSetContent})}">
<th:block th:ref="checkboxInSetContent">
<th:block
th:replace="~{fragments/inputs/checkboxInSet :: checkboxInSet(inputName=${inputName}, value='true', label=#{sensitive-conviction-question-true})}"/>
</th:block>
</div>
</div>
<div class="form-card__footer">
<th:block th:replace="~{fragments/inputs/submitButton :: submitButton(
text=#{general.inputs.continue})}"/>
</div>
</th:block>
</th:block>
</th:block>
</main>
</div>
</section>
</div>
<th:block th:replace="~{fragments/footer :: footer}" />
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}">
<head th:replace="~{fragments/head :: head(title=#{sensitive-conviction-questions-intro.title})}"></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=#{sensitive-conviction-questions-intro.header}, subtext=#{sensitive-conviction-questions-intro.subtext})}"/>
<div class="form-card__footer">
<th:block th:replace="~{fragments/continueButton :: continue}" />
</div>
</main>
</div>
</section>
</div>
<th:block th:replace="~{fragments/footer :: footer}" />
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,12 @@ void completeFlow() {
assertThat(testPage.getTitle()).isEqualTo(message("legal-stuff.title"));
testPage.clickContinue();

assertThat(testPage.getTitle()).isEqualTo(message("sensitive-conviction-questions-intro.title"));
testPage.clickContinue();

assertThat(testPage.getTitle()).isEqualTo(message("sensitive-conviction-questions.title"));
testPage.clickContinue();

assertThat(testPage.getTitle()).isEqualTo(message("rights-and-responsibilities-title"));
testPage.clickElementById("rightsAndResponsibilitiesAgree-true");
testPage.clickElementById("noIncorrectInformationAgree-true");
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/org/mdbenefits/app/pdf/PdfServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import formflow.library.pdf.PdfService;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
import org.mdbenefits.app.data.SubmissionTestBuilder;
Expand Down Expand Up @@ -37,6 +38,8 @@ void generate() throws IOException {
.with("homeAddressZipCode", "94103")
.with("phoneNumber", "(510) 555-1212")
.with("signature", "John Hancock")
.with("noOneIsReceivingBenefitsWithFakeID[]", List.of("true"))
.with("noOneHasDrugKingpinFelony[]", List.of())
.build();
submission.setFlow("mdBenefitsFlow");

Expand Down

0 comments on commit 46cf4dd

Please sign in to comment.