alberto-art3ch commented on code in PR #6546:
URL: https://github.com/apache/fineract/pull/6546#discussion_r4388900981


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java:
##########
@@ -328,13 +346,17 @@ private LoanApplicationTerms 
assembleLoanApplicationTermsFrom(final JsonElement
          */
         if (calculatedRepaymentsStartingFromDate == null) {
             LocalDate tmpCalculatedRepaymentsStartingFromDate = 
deriveFirstRepaymentDate(loanType, repaymentEvery, expectedDisbursementDate,
-                    repaymentPeriodFrequencyType, 0, calendar, 
submittedOnDate, repaymentStartDateType, monthEndDueDateStrategy);
+                    repaymentPeriodFrequencyType, 0, calendar, 
submittedOnDate, repaymentStartDateType, semiMonthlyDueDays,
+                    monthEndDueDateStrategy);
             calculatedRepaymentsStartingFromDate = 
deriveFirstRepaymentDate(loanType, repaymentEvery, expectedDisbursementDate,
                     repaymentPeriodFrequencyType, 
loanProduct.getMinimumDaysBetweenDisbursalAndFirstRepayment(), calendar, 
submittedOnDate,
-                    repaymentStartDateType, monthEndDueDateStrategy);
+                    repaymentStartDateType, semiMonthlyDueDays, 
monthEndDueDateStrategy);
             if 
(!tmpCalculatedRepaymentsStartingFromDate.equals(calculatedRepaymentsStartingFromDate))
 {
                 repaymentsStartingFromDate = 
calculatedRepaymentsStartingFromDate;
             }
+        } else if (repaymentPeriodFrequencyType.isSemiMonthly() && calendar == 
null) {

Review Comment:
   Confirmed, the check only lived on the JSON path. Since modify regenerates 
the schedule from the entity, the rule is now also enforced on the entity: 
`validateForModify(loan)`, which runs after the request has been applied, 
checks that `expectedFirstRepaymentOnDate` (when pinned, the loan is 
semi-monthly and has no meeting calendar) is one of the due days the loan ends 
up with. Checking the final state covers both cases with a single rule: a new 
`repaymentsStartingFromDate` on a non-due day, and new days that leave the 
stored date off the schedule. It throws the same `LoanApplicationDateException` 
/ `first.repayment.date.not.a.semi.monthly.due.day` as creation, so the status 
is 403 in both paths and the transaction rolls back.
   
   ITs: `aModificationWithAFirstRepaymentDateOffTheDueDaysIsRejected` and 
`aModificationWithDaysThatOrphanTheFirstRepaymentDateIsRejected` (both 403).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to