Skip to content

Commit

Permalink
FINERACT-2148: use MathContext
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksii-novikov-onix committed Dec 9, 2024
1 parent fba9420 commit 8608b23
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8608b23

Please sign in to comment.