FINERACT-2433: Fix interest and accrual calculation in case of last installment payment
This commit is contained in:
+2
-1
@@ -131,7 +131,8 @@ public class LoanTransactionProcessingServiceImpl implements LoanTransactionProc
|
||||
|
||||
@Override
|
||||
public LoanScheduleDTO getRecalculatedSchedule(final ScheduleGeneratorDTO generatorDTO, Loan loan) {
|
||||
if (!loan.isInterestBearingAndInterestRecalculationEnabled() || loan.isNpa() || loan.isChargedOff()) {
|
||||
if (!loan.isInterestBearingAndInterestRecalculationEnabled() || loan.isNpa()
|
||||
|| (loan.isChargedOff() && loan.isCumulativeSchedule())) {
|
||||
return null;
|
||||
}
|
||||
final InterestMethod interestMethod = loan.getLoanRepaymentScheduleDetail().getInterestMethod();
|
||||
|
||||
+5
-7
@@ -2742,24 +2742,22 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(data));
|
||||
});
|
||||
|
||||
final LoanTransaction chargeOffTransaction = LoanTransaction.chargeOff(loan, transactionDate, txnExternalId);
|
||||
final LoanTransaction chargeOffTransaction;
|
||||
|
||||
if (loan.isInterestBearingAndInterestRecalculationEnabled()) {
|
||||
if (loan.isCumulativeSchedule()) {
|
||||
final ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, null, null);
|
||||
loanScheduleService.regenerateRepaymentScheduleWithInterestRecalculation(loan, scheduleGeneratorDTO);
|
||||
}
|
||||
final ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, null, null);
|
||||
loanScheduleService.regenerateRepaymentScheduleWithInterestRecalculation(loan, scheduleGeneratorDTO);
|
||||
chargeOffTransaction = LoanTransaction.chargeOff(loan, transactionDate, txnExternalId);
|
||||
reprocessLoanTransactionsService.reprocessTransactions(loan, List.of(chargeOffTransaction));
|
||||
loan.addLoanTransaction(chargeOffTransaction);
|
||||
} else {
|
||||
chargeOffTransaction = LoanTransaction.chargeOff(loan, transactionDate, txnExternalId);
|
||||
reprocessLoanTransactionsService.processLatestTransaction(chargeOffTransaction, loan);
|
||||
loan.addLoanTransaction(chargeOffTransaction);
|
||||
}
|
||||
loanTransactionRepository.saveAndFlush(chargeOffTransaction);
|
||||
journalEntryPoster.postJournalEntriesForLoanTransaction(chargeOffTransaction, false, false);
|
||||
|
||||
saveAndFlushLoanWithDataIntegrityViolationChecks(loan);
|
||||
|
||||
String noteText = command.stringValueOfParameterNamed(LoanApiConstants.noteParameterName);
|
||||
if (StringUtils.isNotBlank(noteText)) {
|
||||
changes.put(LoanApiConstants.noteParameterName, noteText);
|
||||
|
||||
Reference in New Issue
Block a user