-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action for clearing money amount if less then 100.
Also changes an equal to equalsIgnoreCase. If a user enters a money on hand amount, but then goes back and decides they have less than 100 on hand, we will clear out the amount they entered so it doesn't affect calculations.
- Loading branch information
Showing
4 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/org/mdbenefits/app/submission/actions/MaybeClearMoneyOnHandAmount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.mdbenefits.app.submission.actions; | ||
|
||
import formflow.library.config.submission.Action; | ||
import formflow.library.data.FormSubmission; | ||
import formflow.library.data.Submission; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@Slf4j | ||
public class MaybeClearMoneyOnHandAmount implements Action { | ||
|
||
/** | ||
* This action will clear out the expeditedMoneyOnHandAmount field, if the householdMoneyOnHandLessThan100 is equal to "true"; | ||
* This is useful in the case that the user goes forward and enters an amount and then goes back and indicates that they have | ||
* less than the money on hand threshold. | ||
* | ||
* @param formSubmission the data being submitted. | ||
* @param submission submission object the action is associated with, not null | ||
*/ | ||
@Override | ||
public void run(FormSubmission formSubmission, Submission submission) { | ||
boolean isMoneyOnHandLessThan100 = ((String) formSubmission.getFormData() | ||
.get("householdMoneyOnHandLessThan100")).equalsIgnoreCase("true"); | ||
|
||
if (isMoneyOnHandLessThan100) { | ||
formSubmission.getFormData().put("expeditedMoneyOnHandAmount", "0"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters