adamsaghy commented on code in PR #4207:
URL: https://github.com/apache/fineract/pull/4207#discussion_r1875961726
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -3902,4 +3952,56 @@ public void closeAsMarkedForReschedule(final Loan loan,
final JsonCommand comman
loanTransactionValidator.validateLoanRescheduleDate(loan);
}
+
+ private void calculatePartialPeriodInterest(final Loan loan, final
LocalDate chargeOffDate) {
+ loan.getRepaymentScheduleInstallments().stream()
+ .filter(installment ->
!installment.getFromDate().isAfter(chargeOffDate) &&
installment.getDueDate().isAfter(chargeOffDate))
+ .forEach(installment -> {
+ final BigDecimal totalInterest =
installment.getInterestOutstanding(loan.getCurrency()).getAmount();
+ final long totalDaysInPeriod =
ChronoUnit.DAYS.between(installment.getFromDate(), installment.getDueDate());
+ final long daysTillChargeOff =
ChronoUnit.DAYS.between(installment.getFromDate(), chargeOffDate);
+
+ final BigDecimal interestTillChargeOff = totalInterest
+ .divide(BigDecimal.valueOf(totalDaysInPeriod), 10,
RoundingMode.HALF_UP)
Review Comment:
You might wanna use the Math context from Moneyhelper to be unified!
Hardcoding values are not recommended!
--
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]