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-539 #1441

Merged
merged 13 commits into from
Dec 27, 2024
Merged

SU-539 #1441

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 @@ -23,6 +23,7 @@
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
Expand Down Expand Up @@ -746,7 +747,7 @@ public void applyOverdueChargesForLoan(final Long loanId, Collection<OverdueLoan
Loan loan = this.loanAssembler.assembleFrom(loanId);
// add check duplication instalment number or invalid data
Boolean duplicateNumberInstalment = loan
.getRepaymentScheduleInstallments().stream().collect(Collectors
.getRepaymentScheduleInstallments().stream().filter(e -> e.getInstallmentNumber() > 0).collect(Collectors
.groupingBy(schedule -> schedule.getLoan().getId() + "-" + schedule.getInstallmentNumber(), Collectors.counting()))
.values().stream().anyMatch(count -> count > 1);

Expand Down Expand Up @@ -1050,6 +1051,17 @@ private boolean addCharge(final Loan loan, final Charge chargeDefinition, LoanCh
// the loan product uses Upfront Accruals
if (loan.getStatus().isActive() && loan.isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct()) {
final LoanTransaction applyLoanChargeTransaction = loan.handleChargeAppliedTransaction(loanCharge, null);
if (DateUtils.isBeforeBusinessDate(loanCharge.getDueLocalDate())) {
Long minimumDaysInArrearsToSuspendLoanAccount = this.configurationDomainService
.retriveMinimumDaysInArrearsToSuspendLoanAccount();
if (minimumDaysInArrearsToSuspendLoanAccount == null) {
minimumDaysInArrearsToSuspendLoanAccount = 90L;
}
long days = loan.getDisburseDonDate().until(applyLoanChargeTransaction.getTransactionDate(), ChronoUnit.DAYS);
if (days >= minimumDaysInArrearsToSuspendLoanAccount) {
applyLoanChargeTransaction.markAsOccurredOnSuspendedAccount();
}
}
this.loanTransactionRepository.saveAndFlush(applyLoanChargeTransaction);
}
return DateUtils.isBeforeBusinessDate(loanCharge.getDueLocalDate());
Expand Down
Loading