FINERACT-2338: Allow backdated interest rate change on progressive loans
This commit is contained in:
+10
@@ -43,6 +43,7 @@ import org.apache.fineract.infrastructure.core.exception.ErrorHandler;
|
||||
import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanBalanceChangedBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanRescheduledDueAdjustScheduleBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
@@ -402,9 +403,15 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
||||
if (rescheduleFromDate == null) {
|
||||
rescheduleFromDate = loanRescheduleRequest.getRescheduleFromDate();
|
||||
}
|
||||
|
||||
boolean hasInterestRateChange = false;
|
||||
for (LoanRescheduleRequestToTermVariationMapping mapping : loanRescheduleRequest
|
||||
.getLoanRescheduleRequestToTermVariationMappings()) {
|
||||
mapping.getLoanTermVariations().updateIsActive(true);
|
||||
LoanTermVariationType termType = mapping.getLoanTermVariations().getTermType();
|
||||
if (termType.isInterestRateVariation() || termType.isInterestRateFromInstallment()) {
|
||||
hasInterestRateChange = true;
|
||||
}
|
||||
}
|
||||
BigDecimal annualNominalInterestRate = null;
|
||||
List<LoanTermVariationsData> loanTermVariations = new ArrayList<>();
|
||||
@@ -457,6 +464,9 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
if (hasInterestRateChange) {
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
}
|
||||
|
||||
return new CommandProcessingResultBuilder().withCommandId(jsonCommand.commandId()).withEntityId(loanRescheduleRequestId)
|
||||
.withLoanId(loanRescheduleRequest.getLoan().getId()).with(changes).withClientId(loan.getClientId())
|
||||
|
||||
Reference in New Issue
Block a user