Revert "FINERACT-1840: Fee income is not realised if the loan got fully repaid (#2902)"

This reverts commit f3d7c042a4.
This commit is contained in:
Arnold Gálovics
2023-01-25 13:48:42 +01:00
parent 5872e14086
commit a85845ba52
@@ -544,21 +544,13 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
@Override
public void recalculateAccruals(Loan loan, boolean isInterestCalculationHappened) {
LocalDate accruedTill = loan.getAccruedTill();
final LocalDate businessDate = DateUtils.getBusinessLocalDate();
if (loan.isPeriodicAccrualAccountingEnabledOnLoanProduct() // Loan Product with Accrual Accounting
&& isInterestCalculationHappened // Loan Product with Interest Recalculation enabled
// Loan Account accrued till is not equal to the Business Date
&& (accruedTill == null || !accruedTill.equals(businessDate)) && !loan.isNpa() // Loan Account is not
// NPA
) {
// Loan Account is Active OR is Recently Closed with Obligations Met
if (loan.getStatus().isActive() || (loan.getStatus().isClosedObligationsMet() && loan.getClosedOnDate().equals(businessDate))) {
if (accruedTill == null) {
accruedTill = businessDate;
if (!loan.isPeriodicAccrualAccountingEnabledOnLoanProduct() || !isInterestCalculationHappened || accruedTill == null || loan.isNpa()
|| !loan.getStatus().isActive()) {
return;
}
boolean isOrganisationDateEnabled = this.configurationDomainService.isOrganisationstartDateEnabled();
LocalDate organisationStartDate = businessDate;
LocalDate organisationStartDate = DateUtils.getBusinessLocalDate();
if (isOrganisationDateEnabled) {
organisationStartDate = this.configurationDomainService.retrieveOrganisationStartDate();
}
@@ -578,7 +570,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
for (LoanRepaymentScheduleInstallment installment : installments) {
if (installment.getDueDate().isAfter(loan.getMaturityDate())) {
accruedTill = businessDate;
accruedTill = DateUtils.getBusinessLocalDate();
}
if (!isOrganisationDateEnabled || organisationStartDate.isBefore(installment.getDueDate())) {
generateLoanScheduleAccrualData(accruedTill, loanScheduleAccrualList, loanId, officeId, accrualStartDate,
@@ -595,8 +587,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
throw new GeneralPlatformDomainRuleException(globalisationMessageCode, e.getMessage(), e);
}
}
}
}
}
private void generateLoanScheduleAccrualData(final LocalDate accruedTill,