Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SU-500 Do not generate interest accrual on installment due date #1351

Merged
merged 2 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2851,13 +2851,13 @@ public void applyDailyAccrualsAtDisbursement(LocalDate currentDate) {
final List<LoanRepaymentScheduleInstallment> loanRepaymentScheduleInstallments = getRepaymentScheduleInstallments();
for (LoanRepaymentScheduleInstallment repaymentScheduleInstallment : loanRepaymentScheduleInstallments) {
if (!currentDate.isBefore(repaymentScheduleInstallment.getFromDate())
&& !currentDate.isAfter(repaymentScheduleInstallment.getDueDate())) {
&& !currentDate.isAfter(repaymentScheduleInstallment.getDueDate().minusDays(1))) {
long daysInPeriod = Math.toIntExact(
ChronoUnit.DAYS.between(repaymentScheduleInstallment.getFromDate(), repaymentScheduleInstallment.getDueDate()));
Money interestForInstallment = repaymentScheduleInstallment.getInterestCharged(getCurrency());
BigDecimal dailyInterest;
// Adjust interest on the last day of the period to make up the difference
if (currentDate.equals(repaymentScheduleInstallment.getDueDate())) {
if (currentDate.equals(repaymentScheduleInstallment.getDueDate().minusDays(1))) {
// if the amount is whole number when divided across the days in the period, then do same for last
// day
if (interestForInstallment.getAmount().remainder(BigDecimal.valueOf(daysInPeriod)).compareTo(BigDecimal.ZERO) == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4447,14 +4447,14 @@ public void persistDailyAccrual(final LocalDate transactionDate) {
Money principalLoanBalanceOutstanding = loan.getPrincipal();
for (final LoanRepaymentScheduleInstallment loanRepaymentScheduleInstallment : repaymentScheduleInstallments) {
if (!transactionDate.isBefore(loanRepaymentScheduleInstallment.getFromDate())
&& !transactionDate.isAfter(loanRepaymentScheduleInstallment.getDueDate())) {
&& !transactionDate.isAfter(loanRepaymentScheduleInstallment.getDueDate().minusDays(1))) {
final BigDecimal totalAccruedInterestForInstallment = loan
.getAccruedInterestForInstallment(loanRepaymentScheduleInstallment.getInstallmentNumber());
long daysInPeriod = Math.toIntExact(ChronoUnit.DAYS.between(loanRepaymentScheduleInstallment.getFromDate(),
loanRepaymentScheduleInstallment.getDueDate()));
Money interestForInstallment = loanRepaymentScheduleInstallment.getInterestCharged(currency);
// Adjust interest on the last day of the period to make up the difference
if (transactionDate.equals(loanRepaymentScheduleInstallment.getDueDate())) {
if (transactionDate.equals(loanRepaymentScheduleInstallment.getDueDate().minusDays(1))) {
// if the amount is whole number when divided across the days in the period, then do same for
// last
// day
Expand Down
Loading