From 8608b23b50a83624fd2a959076aa0c96a5c30fc7 Mon Sep 17 00:00:00 2001 From: Oleksii Novikov Date: Mon, 9 Dec 2024 16:46:14 +0200 Subject: [PATCH] FINERACT-2148: use MathContext --- .../service/LoanWritePlatformServiceJpaRepositoryImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java index 94be096f733..3a8a59c326f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -116,6 +116,7 @@ import org.apache.fineract.organisation.monetary.domain.ApplicationCurrencyRepositoryWrapper; import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency; import org.apache.fineract.organisation.monetary.domain.Money; +import org.apache.fineract.organisation.monetary.domain.MoneyHelper; import org.apache.fineract.organisation.office.domain.Office; import org.apache.fineract.organisation.staff.domain.Staff; import org.apache.fineract.organisation.teller.data.CashierTransactionDataValidator; @@ -3962,7 +3963,7 @@ private void calculatePartialPeriodInterest(final Loan loan, final LocalDate cha final long daysTillChargeOff = ChronoUnit.DAYS.between(installment.getFromDate(), chargeOffDate); final BigDecimal interestTillChargeOff = totalInterest - .divide(BigDecimal.valueOf(totalDaysInPeriod), 10, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(totalDaysInPeriod), MoneyHelper.getMathContext()) .multiply(BigDecimal.valueOf(daysTillChargeOff)); final BigDecimal interestRemoved = totalInterest.subtract(interestTillChargeOff);