Skip to content

Commit

Permalink
fix: update rental rules for guarantor to 1 month receipt
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien committed Mar 11, 2024
1 parent 0648cac commit c945023
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,21 @@ private List<List<YearMonth>> getExpectedMonthsLists() {
List.of(yearMonth.minusMonths(2), yearMonth.minusMonths(3), yearMonth.minusMonths(4)));
}

private List<List<YearMonth>> getGuarantorExpectedMonthsLists() {
LocalDate localDate = LocalDate.now();
YearMonth yearMonth = YearMonth.now();
return (localDate.getDayOfMonth() <= 15) ?
List.of(
List.of(yearMonth.minusMonths(1)),
List.of(yearMonth.minusMonths(2)),
List.of(yearMonth.minusMonths(3))) :
List.of(
List.of(yearMonth.minusMonths(1)),
List.of(yearMonth.minusMonths(2)));
}

private boolean checkMonthsValidityRule(Document document) {
List<List<YearMonth>> expectedMonthsList = getExpectedMonthsLists();
List<List<YearMonth>> expectedMonthsList = (document.getTenant() != null) ? getExpectedMonthsLists() : getGuarantorExpectedMonthsLists();

List<YearMonth> presentMonths = document.getFiles().stream()
.map(file -> ((RentalReceiptFile) file.getParsedFileAnalysis().getParsedFile()).getPeriod())
Expand Down

0 comments on commit c945023

Please sign in to comment.