Revert "[#FINERACT-2422] standardize use of aging vs. ageing (#5289)"

This reverts commit 61034e6041.
This commit is contained in:
Víctor Romero
2026-01-09 16:12:22 +01:00
committed by Adam Saghy
parent f0692a8cf1
commit ed32c133cc
70 changed files with 320 additions and 320 deletions
@@ -113,8 +113,8 @@ public class LoanDelinquencyDomainServiceImpl implements LoanDelinquencyDomainSe
}
Integer graceDays = 0;
if (loan.getLoanProductRelatedDetail().getGraceOnArrearsAging() != null) {
graceDays = loan.getLoanProductRelatedDetail().getGraceOnArrearsAging();
if (loan.getLoanProductRelatedDetail().getGraceOnArrearsAgeing() != null) {
graceDays = loan.getLoanProductRelatedDetail().getGraceOnArrearsAgeing();
}
log.debug("Loan id {} with overdue since date {} and outstanding amount {}", loan.getId(), overdueSinceDate, outstandingAmount);
@@ -192,8 +192,8 @@ public class LoanDelinquencyDomainServiceImpl implements LoanDelinquencyDomainSe
}
Integer graceDays = 0;
if (loan.getLoanProductRelatedDetail().getGraceOnArrearsAging() != null) {
graceDays = loan.getLoanProductRelatedDetail().getGraceOnArrearsAging();
if (loan.getLoanProductRelatedDetail().getGraceOnArrearsAgeing() != null) {
graceDays = loan.getLoanProductRelatedDetail().getGraceOnArrearsAgeing();
}
log.debug("Loan id {} with overdue since date {} and outstanding amount {}", loan.getId(), overdueSinceDate, outstandingAmount);
@@ -128,7 +128,7 @@ public class LoanAccountData {
private Integer recurringMoratoriumOnPrincipalPeriods;
private Integer graceOnInterestPayment;
private Integer graceOnInterestCharged;
private Integer graceOnArrearsAging;
private Integer graceOnArrearsAgeing;
private LocalDate interestChargedFromDate;
private LocalDate expectedFirstRepaymentOnDate;
private Boolean syncDisbursementWithMeeting;
@@ -431,7 +431,7 @@ public class LoanAccountData {
.setGraceOnInterestCharged(product.getGraceOnInterestCharged()).setCharges(charges)
.setMultiDisburseLoan(product.getMultiDisburseLoan()).setCanDefineInstallmentAmount(product.isCanDefineInstallmentAmount())
.setMaxOutstandingLoanBalance(product.getOutstandingLoanBalance()).setProduct(product)
.setGraceOnArrearsAging(product.getGraceOnArrearsAging()).setOverdueCharges(product.overdueFeeCharges())
.setGraceOnArrearsAgeing(product.getGraceOnArrearsAgeing()).setOverdueCharges(product.overdueFeeCharges())
.setDaysInMonthType(product.getDaysInMonthType()).setDaysInYearType(product.getDaysInYearType())
.setInterestRecalculationEnabled(product.isInterestRecalculationEnabled())
.setInterestRecalculationData(product.toLoanInterestRecalculationData())
@@ -470,7 +470,7 @@ public class LoanAccountData {
final BigDecimal feeChargesDueAtDisbursementCharged, final Boolean syncDisbursementWithMeeting, final Integer loanCounter,
final Integer loanProductCounter, final Boolean multiDisburseLoan, Boolean canDefineInstallmentAmount,
final BigDecimal fixedEmiAmont, final BigDecimal outstandingLoanBalance, final Boolean inArrears,
final Integer graceOnArrearsAging, final Boolean isNPA, final EnumOptionData daysInMonthType,
final Integer graceOnArrearsAgeing, final Boolean isNPA, final EnumOptionData daysInMonthType,
final EnumOptionData daysInYearType, final boolean isInterestRecalculationEnabled,
final LoanInterestRecalculationData interestRecalculationData, final Boolean createStandingInstructionAtDisbursement,
final Boolean isVariableInstallmentsAllowed, Integer minimumGap, Integer maximumGap, final EnumOptionData subStatus,
@@ -517,7 +517,7 @@ public class LoanAccountData {
.setSyncDisbursementWithMeeting(syncDisbursementWithMeeting).setLoanCounter(loanCounter)
.setLoanProductCounter(loanProductCounter).setMultiDisburseLoan(multiDisburseLoan)
.setCanDefineInstallmentAmount(canDefineInstallmentAmount).setFixedEmiAmount(fixedEmiAmont)
.setMaxOutstandingLoanBalance(outstandingLoanBalance).setInArrears(inArrears).setGraceOnArrearsAging(graceOnArrearsAging)
.setMaxOutstandingLoanBalance(outstandingLoanBalance).setInArrears(inArrears).setGraceOnArrearsAgeing(graceOnArrearsAgeing)
.setIsNPA(isNPA).setDaysInMonthType(daysInMonthType).setDaysInYearType(daysInYearType)
.setInterestRecalculationEnabled(isInterestRecalculationEnabled).setInterestRecalculationData(interestRecalculationData)
.setCreateStandingInstructionAtDisbursement(createStandingInstructionAtDisbursement)
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsaging;
package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsageing;
import java.math.BigDecimal;
import java.sql.ResultSet;
@@ -44,7 +44,7 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component
@RequiredArgsConstructor
public class LoanArrearsAgingUpdateHandler {
public class LoanArrearsAgeingUpdateHandler {
private final JdbcTemplate jdbcTemplate;
private final DatabaseSpecificSQLGenerator sqlGenerator;
@@ -61,10 +61,10 @@ public class LoanArrearsAgingUpdateHandler {
}
}
public void updateLoanArrearsAgingDetailsForAllLoans() {
public void updateLoanArrearsAgeingDetailsForAllLoans() {
truncateLoanArrearsAgingDetails();
String insertSQLStatement = buildQueryForInsertAgingDetails(Boolean.TRUE);
List<String> insertStatements = updateLoanArrearsAgingDetailsWithOriginalScheduleForAllLoans();
String insertSQLStatement = buildQueryForInsertAgeingDetails(Boolean.TRUE);
List<String> insertStatements = updateLoanArrearsAgeingDetailsWithOriginalScheduleForAllLoans();
insertStatements.add(0, insertSQLStatement);
final int[] records = this.jdbcTemplate.batchUpdate(insertStatements.toArray(new String[0]));
if (log.isDebugEnabled()) {
@@ -72,14 +72,14 @@ public class LoanArrearsAgingUpdateHandler {
for (int record : records) {
result += record;
}
log.debug("Records affected by updateLoanArrearsAgingDetails: {}", result);
log.debug("Records affected by updateLoanArrearsAgeingDetails: {}", result);
}
}
public void updateLoanArrearsAgingDetails(List<Long> loanIdsForUpdate) {
public void updateLoanArrearsAgeingDetails(List<Long> loanIdsForUpdate) {
deleteLoanArrearsAgingDetails(loanIdsForUpdate);
String insertSQLStatement = buildQueryForInsertAgingDetails(Boolean.FALSE);
String insertSQLStatement = buildQueryForInsertAgeingDetails(Boolean.FALSE);
List<Object[]> batch = new ArrayList<Object[]>();
if (!loanIdsForUpdate.isEmpty()) {
for (Long loanId : loanIdsForUpdate) {
@@ -89,7 +89,7 @@ public class LoanArrearsAgingUpdateHandler {
}
final int[] recordsUpdatedWithoutOriginalSchedule = this.jdbcTemplate.batchUpdate(insertSQLStatement, batch);
int[] recordsUpdatedWithOriginalSchedule = new int[0];
List<String> insertStatements = updateLoanArrearsAgingDetailsWithOriginalSchedule(loanIdsForUpdate);
List<String> insertStatements = updateLoanArrearsAgeingDetailsWithOriginalSchedule(loanIdsForUpdate);
if (!insertStatements.isEmpty()) {
recordsUpdatedWithOriginalSchedule = this.jdbcTemplate.batchUpdate(insertStatements.toArray(new String[0]));
@@ -104,12 +104,12 @@ public class LoanArrearsAgingUpdateHandler {
result += recordWithOriginalSchedule;
}
}
log.debug("Records affected by updateLoanArrearsAgingDetails: {}", result);
log.debug("Records affected by updateLoanArrearsAgeingDetails: {}", result);
}
}
private String buildQueryForInsertAgingDetails(boolean isForAllLoans) {
private String buildQueryForInsertAgeingDetails(boolean isForAllLoans) {
final StringBuilder insertSqlStatementBuilder = new StringBuilder(900);
final String principalOverdueCalculationSql = "SUM(COALESCE(mr.principal_amount, 0) - coalesce(mr.principal_completed_derived, 0) - coalesce(mr.principal_writtenoff_derived, 0))";
final String interestOverdueCalculationSql = "SUM(COALESCE(mr.interest_amount, 0) - coalesce(mr.interest_writtenoff_derived, 0) - coalesce(mr.interest_waived_derived, 0) - "
@@ -139,7 +139,7 @@ public class LoanArrearsAgingUpdateHandler {
}
insertSqlStatementBuilder.append(" and mr.completed_derived is false ");
insertSqlStatementBuilder.append(" and mr.duedate < ")
.append(sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_aging, 0)", "day"))
.append(sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_ageing, 0)", "day"))
.append(" ");
insertSqlStatementBuilder
.append(" and (prd.arrears_based_on_original_schedule = false or prd.arrears_based_on_original_schedule is null) ");
@@ -147,7 +147,7 @@ public class LoanArrearsAgingUpdateHandler {
return insertSqlStatementBuilder.toString();
}
private List<String> updateLoanArrearsAgingDetailsWithOriginalSchedule(List<Long> loanIdsForUpdate) {
private List<String> updateLoanArrearsAgeingDetailsWithOriginalSchedule(List<Long> loanIdsForUpdate) {
List<String> insertStatement = new ArrayList<>();
String sqlForLoanIdentifiers = buildQueryForLoanIdentifiersWithOriginalSchedule(Boolean.FALSE);
List<Object> loanIdsForQuery = new ArrayList<>();
@@ -166,7 +166,7 @@ public class LoanArrearsAgingUpdateHandler {
return insertStatement;
}
private List<String> updateLoanArrearsAgingDetailsWithOriginalScheduleForAllLoans() {
private List<String> updateLoanArrearsAgeingDetailsWithOriginalScheduleForAllLoans() {
List<String> insertStatement = new ArrayList<>();
String sqlForLoanIdentifiers = buildQueryForLoanIdentifiersWithOriginalSchedule(Boolean.TRUE);
List<Long> loanIds = this.jdbcTemplate.queryForList(sqlForLoanIdentifiers, Long.class);
@@ -191,7 +191,7 @@ public class LoanArrearsAgingUpdateHandler {
loanIdentifier.append(" and ml.id IN (?)");
}
loanIdentifier.append(" and mr.completed_derived is false and mr.duedate < ")
.append(sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_aging, 0)", "day"))
.append(sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_ageing, 0)", "day"))
.append(" group by ml.id");
return loanIdentifier.toString();
}
@@ -233,7 +233,7 @@ public class LoanArrearsAgingUpdateHandler {
"mr.interest_amount as interestAmount, mr.fee_charges_amount as feeAmount, mr.penalty_charges_amount as penaltyAmount ");
scheduleDetail.append("from m_loan ml INNER JOIN m_loan_repayment_schedule_history mr on mr.loan_id = ml.id ");
scheduleDetail.append("where mr.duedate < "
+ sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_aging, 0)", "day") + " and ");
+ sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_ageing, 0)", "day") + " and ");
scheduleDetail.append("ml.id IN(:loanIds)").append(" and mr.version = (");
scheduleDetail.append("select max(lrs.version) from m_loan_repayment_schedule_history lrs where mr.loan_id = lrs.loan_id");
scheduleDetail.append(") order by ml.id,mr.duedate");
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsaging;
package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsageing;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.jobs.service.JobName;
@@ -32,27 +32,27 @@ import org.springframework.transaction.PlatformTransactionManager;
@Configuration
@RequiredArgsConstructor
public class UpdateLoanArrearsAgingConfig {
public class UpdateLoanArrearsAgeingConfig {
private final JobRepository jobRepository;
private final PlatformTransactionManager transactionManager;
private final LoanArrearsAgingUpdateHandler updateLoanArrearsAgingService;
private final LoanArrearsAgeingUpdateHandler updateLoanArrearsAgingService;
@Bean
protected Step updateLoanArrearsAgingStep() {
return new StepBuilder(JobName.UPDATE_LOAN_ARREARS_AGING.name(), jobRepository)
.tasklet(updateLoanArrearsAgingTasklet(), transactionManager).build();
protected Step updateLoanArrearsAgeingStep() {
return new StepBuilder(JobName.UPDATE_LOAN_ARREARS_AGEING.name(), jobRepository)
.tasklet(updateLoanArrearsAgeingTasklet(), transactionManager).build();
}
@Bean
public Job updateLoanArrearsAgingJob() {
return new JobBuilder(JobName.UPDATE_LOAN_ARREARS_AGING.name(), jobRepository).start(updateLoanArrearsAgingStep())
public Job updateLoanArrearsAgeingJob() {
return new JobBuilder(JobName.UPDATE_LOAN_ARREARS_AGEING.name(), jobRepository).start(updateLoanArrearsAgeingStep())
.incrementer(new RunIdIncrementer()).build();
}
@Bean
public UpdateLoanArrearsAgingTasklet updateLoanArrearsAgingTasklet() {
return new UpdateLoanArrearsAgingTasklet(updateLoanArrearsAgingService);
public UpdateLoanArrearsAgeingTasklet updateLoanArrearsAgeingTasklet() {
return new UpdateLoanArrearsAgeingTasklet(updateLoanArrearsAgingService);
}
}
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsaging;
package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsageing;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -27,13 +27,13 @@ import org.springframework.batch.repeat.RepeatStatus;
@Slf4j
@RequiredArgsConstructor
public class UpdateLoanArrearsAgingTasklet implements Tasklet {
public class UpdateLoanArrearsAgeingTasklet implements Tasklet {
private final LoanArrearsAgingUpdateHandler loanArrearsAgingUpdateHandler;
private final LoanArrearsAgeingUpdateHandler loanArrearsAgeingUpdateHandler;
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
loanArrearsAgingUpdateHandler.updateLoanArrearsAgingDetailsForAllLoans();
loanArrearsAgeingUpdateHandler.updateLoanArrearsAgeingDetailsForAllLoans();
return RepeatStatus.FINISHED;
}
@@ -134,7 +134,7 @@ public final class LoanApplicationTerms {
private LocalDate interestChargedFromDate;
private Money inArrearsTolerance;
private Integer graceOnArrearsAging;
private Integer graceOnArrearsAgeing;
// added
private LocalDate loanEndDate;
@@ -556,7 +556,7 @@ public final class LoanApplicationTerms {
final Integer recurringMoratoriumOnPrincipalPeriods, final Integer graceOnInterestPayment, final Integer graceOnInterestCharged,
final LocalDate interestChargedFromDate, final Money inArrearsTolerance, final boolean multiDisburseLoan,
final BigDecimal emiAmount, final List<DisbursementData> disbursementDatas, final BigDecimal maxOutstandingBalance,
final Integer graceOnArrearsAging, final DaysInMonthType daysInMonthType, final DaysInYearType daysInYearType,
final Integer graceOnArrearsAgeing, final DaysInMonthType daysInMonthType, final DaysInYearType daysInYearType,
final boolean isInterestRecalculationEnabled, final RecalculationFrequencyType recalculationFrequencyType,
final CalendarInstance restCalendarInstance,
final InterestRecalculationCompoundingMethod interestRecalculationCompoundingMethod,
@@ -589,7 +589,7 @@ public final class LoanApplicationTerms {
allowPartialPeriodInterestCalculation, principalMoney, expectedDisbursementDate, repaymentsStartingFromDate,
calculatedRepaymentsStartingFromDate, graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods,
graceOnInterestPayment, graceOnInterestCharged, interestChargedFromDate, inArrearsTolerance, multiDisburseLoan, emiAmount,
disbursementDatas, maxOutstandingBalance, graceOnArrearsAging, daysInMonthType, daysInYearType,
disbursementDatas, maxOutstandingBalance, graceOnArrearsAgeing, daysInMonthType, daysInYearType,
isInterestRecalculationEnabled, rescheduleStrategyMethod, interestRecalculationCompoundingMethod, restCalendarInstance,
recalculationFrequencyType, compoundingCalendarInstance, compoundingFrequencyType, principalThresholdForLastInstalment,
installmentAmountInMultiplesOf, preClosureInterestCalculationStrategy, loanCalendar, approvedAmount, loanTermVariations,
@@ -664,7 +664,7 @@ public final class LoanApplicationTerms {
allowPartialPeriodInterestCalculation, principalMoney, expectedDisbursementDate, repaymentsStartingFromDate,
calculatedRepaymentsStartingFromDate, graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods,
graceOnInterestPayment, graceOnInterestCharged, interestChargedFromDate, inArrearsTolerance, multiDisburseLoan, emiAmount,
disbursementDatas, maxOutstandingBalance, loanProductRelatedDetail.getGraceOnArrearsAging(), daysInMonthType,
disbursementDatas, maxOutstandingBalance, loanProductRelatedDetail.getGraceOnArrearsAgeing(), daysInMonthType,
daysInYearType, isInterestRecalculationEnabled, rescheduleStrategyMethod, compoundingMethod, restCalendarInstance,
recalculationFrequencyType, compoundingCalendarInstance, compoundingFrequencyType, principalThresholdForLastInstalment,
installmentAmountInMultiplesOf, loanPreClosureInterestCalculationStrategy, loanCalendar, approvedAmount, loanTermVariations,
@@ -694,7 +694,7 @@ public final class LoanApplicationTerms {
final Integer recurringMoratoriumOnPrincipalPeriods, final Integer interestPaymentGrace, final Integer interestChargingGrace,
final LocalDate interestChargedFromDate, final Money inArrearsTolerance, final boolean multiDisburseLoan,
final BigDecimal emiAmount, final List<DisbursementData> disbursementDatas, final BigDecimal maxOutstandingBalance,
final Integer graceOnArrearsAging, final DaysInMonthType daysInMonthType, final DaysInYearType daysInYearType,
final Integer graceOnArrearsAgeing, final DaysInMonthType daysInMonthType, final DaysInYearType daysInYearType,
final boolean isInterestRecalculationEnabled, final LoanRescheduleStrategyMethod rescheduleStrategyMethod,
final InterestRecalculationCompoundingMethod interestRecalculationCompoundingMethod,
final CalendarInstance restCalendarInstance, final RecalculationFrequencyType recalculationFrequencyType,
@@ -753,7 +753,7 @@ public final class LoanApplicationTerms {
this.actualFixedEmiAmount = emiAmount;
this.disbursementDatas = disbursementDatas;
this.maxOutstandingBalance = maxOutstandingBalance;
this.graceOnArrearsAging = graceOnArrearsAging;
this.graceOnArrearsAgeing = graceOnArrearsAgeing;
this.daysInMonthType = daysInMonthType;
this.daysInYearType = daysInYearType;
this.interestRecalculationEnabled = isInterestRecalculationEnabled;
@@ -1684,7 +1684,7 @@ public final class LoanApplicationTerms {
this.interestCalculationPeriodMethod, this.allowPartialPeriodInterestCalculation, this.repaymentEvery,
this.repaymentPeriodFrequencyType, this.numberOfRepayments, this.principalGrace, this.recurringMoratoriumOnPrincipalPeriods,
this.interestPaymentGrace, this.interestChargingGrace, this.amortizationMethod, this.inArrearsTolerance.getAmount(),
this.graceOnArrearsAging, this.daysInMonthType.getValue(), this.daysInYearType.getValue(),
this.graceOnArrearsAgeing, this.daysInMonthType.getValue(), this.daysInYearType.getValue(),
this.interestRecalculationEnabled, this.isEqualAmortization, this.isDownPaymentEnabled,
this.disbursedAmountPercentageForDownPayment, this.isAutoRepaymentForDownPaymentEnabled, this.loanScheduleType,
this.loanScheduleProcessingType, this.fixedLength, this.enableAccrualActivityPosting, this.supportedInterestRefundTypes,
@@ -26,11 +26,11 @@ import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanScheduleP
public interface LoanArrearsAgingService {
void updateLoanArrearsAgingDetailsWithOriginalSchedule(Loan loan);
void updateLoanArrearsAgeingDetailsWithOriginalSchedule(Loan loan);
Map<Long, List<LoanSchedulePeriodData>> getScheduleDate(String loanId);
void updateLoanArrearsAgingDetails(Loan loan);
void updateLoanArrearsAgeingDetails(Loan loan);
void createInsertStatements(List<String> insertStatement, Map<Long, List<LoanSchedulePeriodData>> scheduleDate,
boolean isInsertStatement);
@@ -98,7 +98,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService {
}
@Override
public void updateLoanArrearsAgingDetailsWithOriginalSchedule(final Loan loan) {
public void updateLoanArrearsAgeingDetailsWithOriginalSchedule(final Loan loan) {
int count = this.jdbcTemplate.queryForObject("select count(mla.loan_id) from m_loan_arrears_aging mla where mla.loan_id =?",
Integer.class, loan.getId());
List<String> updateStatement = new ArrayList<>();
@@ -125,7 +125,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService {
}
@Override
public void updateLoanArrearsAgingDetails(final Loan loan) {
public void updateLoanArrearsAgeingDetails(final Loan loan) {
if (loan != null) {
int count = this.jdbcTemplate.queryForObject("select count(mla.loan_id) from m_loan_arrears_aging mla where mla.loan_id =?",
Integer.class, loan.getId());
@@ -373,7 +373,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService {
"mr.interest_amount as interestAmount, mr.fee_charges_amount as feeAmount, mr.penalty_charges_amount as penaltyAmount ");
scheduleDetail.append("from m_loan ml INNER JOIN m_loan_repayment_schedule_history mr on mr.loan_id = ml.id ");
scheduleDetail.append("where mr.duedate < "
+ sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_aging, 0)", "day") + " and ");
+ sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_ageing, 0)", "day") + " and ");
scheduleDetail.append("ml.id IN(").append(loanIdsAsString).append(") and mr.version = (");
scheduleDetail.append("select max(lrs.version) from m_loan_repayment_schedule_history lrs where mr.loan_id = lrs.loan_id");
scheduleDetail.append(") order by ml.id,mr.duedate");
@@ -413,9 +413,9 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService {
private void handleArrearsForLoan(Loan loan) {
if (loan != null && loan.isOpen() && loan.isInterestBearingAndInterestRecalculationEnabled()
&& loan.loanProduct().isArrearsBasedOnOriginalSchedule()) {
updateLoanArrearsAgingDetailsWithOriginalSchedule(loan);
updateLoanArrearsAgeingDetailsWithOriginalSchedule(loan);
} else {
updateLoanArrearsAgingDetails(loan);
updateLoanArrearsAgeingDetails(loan);
}
}
@@ -528,7 +528,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService {
@Override
public void onBusinessEvent(LoanDisbursalBusinessEvent event) {
Loan loan = event.get();
updateLoanArrearsAgingDetails(loan);
updateLoanArrearsAgeingDetails(loan);
}
}
@@ -74,7 +74,7 @@ public interface LoanProductConstants {
String OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME = "outstandingLoanBalance";
String ALLOW_FULL_TERM_FOR_TRANCHE_PARAM_NAME = "allowFullTermForTranche";
String GRACE_ON_ARREARS_AGING_PARAMETER_NAME = "graceOnArrearsAging";
String GRACE_ON_ARREARS_AGEING_PARAMETER_NAME = "graceOnArrearsAgeing";
String OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME = "overdueDaysForNPA";
String MINIMUM_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT = "minimumDaysBetweenDisbursalAndFirstRepayment";
String ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME = "accountMovesOutOfNPAOnlyOnArrearsCompletion";
@@ -169,7 +169,7 @@ public final class LoanProductsApiResourceSwagger {
@Schema(example = "90")
public Integer inArrearsTolerance;
@Schema(example = "3")
public Integer graceOnArrearsAging;
public Integer graceOnArrearsAgeing;
@Schema(example = "false")
public Boolean accountMovesOutOfNPAOnlyOnArrearsCompletion;
@Schema(example = "false")
@@ -352,7 +352,7 @@ public final class LoanProductsApiResourceSwagger {
@Schema(example = "true")
public boolean graceOnPrincipalAndInterestPayment;
@Schema(example = "true")
public boolean graceOnArrearsAging;
public boolean graceOnArrearsAgeing;
}
static final class RateData {
@@ -1672,7 +1672,7 @@ public final class LoanProductsApiResourceSwagger {
@Schema(example = "90")
public Integer inArrearsTolerance;
@Schema(example = "3")
public Integer graceOnArrearsAging;
public Integer graceOnArrearsAgeing;
@Schema(example = "false")
public Boolean accountMovesOutOfNPAOnlyOnArrearsCompletion;
@Schema(example = "false")
@@ -175,7 +175,7 @@ public class LoanConfigurationDetails implements ILoanConfigurationDetails {
}
@Override
public Integer getGraceOnArrearsAging() {
public Integer getGraceOnArrearsAgeing() {
return 0;
}
@@ -137,7 +137,7 @@ public class LoanProductData implements Serializable {
private final Integer recurringMoratoriumOnPrincipalPeriods;
private final Integer graceOnInterestPayment;
private final Integer graceOnInterestCharged;
private final Integer graceOnArrearsAging;
private final Integer graceOnArrearsAgeing;
private final Integer overdueDaysForNPA;
private final EnumOptionData daysInMonthType;
private final EnumOptionData daysInYearType;
@@ -314,7 +314,7 @@ public class LoanProductData implements Serializable {
final Integer recurringMoratoriumOnPrincipalPeriods = null;
final Integer graceOnInterestPayment = null;
final Integer graceOnInterestCharged = null;
final Integer graceOnArrearsAging = null;
final Integer graceOnArrearsAgeing = null;
final Integer overdueDaysForNPA = null;
final Collection<ChargeData> charges = null;
final Collection<LoanProductBorrowerCycleVariationData> principalVariations = new ArrayList<>(1);
@@ -394,7 +394,7 @@ public class LoanProductData implements Serializable {
includeInBorrowerCycle, useBorrowerCycle, startDate, closeDate, status, externalId, principalVariations,
interestRateVariations, numberOfRepaymentVariations, multiDisburseLoan, maxTrancheCount, outstandingLoanBalance,
disallowExpectedDisbursements, allowApprovedDisbursedAmountsOverApplied, overAppliedCalculationType, overAppliedNumber,
allowFullTermForTranche, graceOnArrearsAging, overdueDaysForNPA, daysInMonthType, daysInYearType,
allowFullTermForTranche, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType,
isInterestRecalculationEnabled, interestRecalculationData, minimumDaysBetweenDisbursalAndFirstRepayment, holdGuaranteeFunds,
productGuaranteeData, principalThresholdForLastInstallment, accountMovesOutOfNPAOnlyOnArrearsCompletion,
canDefineInstallmentAmount, installmentAmountInMultiplesOf, loanProductConfigurableAttributes,
@@ -453,7 +453,7 @@ public class LoanProductData implements Serializable {
final Integer recurringMoratoriumOnPrincipalPeriods = null;
final Integer graceOnInterestPayment = null;
final Integer graceOnInterestCharged = null;
final Integer graceOnArrearsAging = null;
final Integer graceOnArrearsAgeing = null;
final Integer overdueDaysForNPA = null;
final Collection<ChargeData> charges = null;
@@ -535,7 +535,7 @@ public class LoanProductData implements Serializable {
includeInBorrowerCycle, useBorrowerCycle, startDate, closeDate, status, externalId, principalVariations,
interestRateVariations, numberOfRepaymentVariations, multiDisburseLoan, maxTrancheCount, outstandingLoanBalance,
disallowExpectedDisbursements, allowApprovedDisbursedAmountsOverApplied, overAppliedCalculationType, overAppliedNumber,
allowFullTermForTranche, graceOnArrearsAging, overdueDaysForNPA, daysInMonthType, daysInYearType,
allowFullTermForTranche, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType,
isInterestRecalculationEnabled, interestRecalculationData, minimumDaysBetweenDisbursalAndFirstRepayment, holdGuaranteeFunds,
productGuaranteeData, principalThresholdForLastInstallment, accountMovesOutOfNPAOnlyOnArrearsCompletion,
canDefineInstallmentAmount, installmentAmountInMultiplesOf, loanProductConfigurableAttributes,
@@ -600,7 +600,7 @@ public class LoanProductData implements Serializable {
final Integer recurringMoratoriumOnPrincipalPeriods = null;
final Integer graceOnInterestPayment = null;
final Integer graceOnInterestCharged = null;
final Integer graceOnArrearsAging = null;
final Integer graceOnArrearsAgeing = null;
final Integer overdueDaysForNPA = null;
final Collection<ChargeData> charges = null;
@@ -683,7 +683,7 @@ public class LoanProductData implements Serializable {
includeInBorrowerCycle, useBorrowerCycle, startDate, closeDate, status, externalId, principalVariationsForBorrowerCycle,
interestRateVariationsForBorrowerCycle, numberOfRepaymentVariationsForBorrowerCycle, multiDisburseLoan, maxTrancheCount,
outstandingLoanBalance, disallowExpectedDisbursements, allowApprovedDisbursedAmountsOverApplied, overAppliedCalculationType,
overAppliedNumber, allowFullTermForTranche, graceOnArrearsAging, overdueDaysForNPA, daysInMonthType, daysInYearType,
overAppliedNumber, allowFullTermForTranche, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType,
isInterestRecalculationEnabled, interestRecalculationData, minimumDaysBetweenDisbursalAndFirstRepayment, holdGuaranteeFunds,
productGuaranteeData, principalThresholdForLastInstallment, accountMovesOutOfNPAOnlyOnArrearsCompletion,
canDefineInstallmentAmount, installmentAmountInMultiplesOf, loanProductConfigurableAttributes,
@@ -742,7 +742,7 @@ public class LoanProductData implements Serializable {
final Integer recurringMoratoriumOnPrincipalPeriods = null;
final Integer graceOnInterestPayment = null;
final Integer graceOnInterestCharged = null;
final Integer graceOnArrearsAging = null;
final Integer graceOnArrearsAgeing = null;
final Integer overdueDaysForNPA = null;
final Collection<ChargeData> charges = null;
@@ -825,7 +825,7 @@ public class LoanProductData implements Serializable {
includeInBorrowerCycle, useBorrowerCycle, startDate, closeDate, status, externalId, principalVariationsForBorrowerCycle,
interestRateVariationsForBorrowerCycle, numberOfRepaymentVariationsForBorrowerCycle, multiDisburseLoan, maxTrancheCount,
outstandingLoanBalance, disallowExpectedDisbursements, allowApprovedDisbursedAmountsOverApplied, overAppliedCalculationType,
overAppliedNumber, allowFullTermForTranche, graceOnArrearsAging, overdueDaysForNPA, daysInMonthType, daysInYearType,
overAppliedNumber, allowFullTermForTranche, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType,
isInterestRecalculationEnabled, interestRecalculationData, minimumDaysBetweenDisbursalAndFirstRepayment, holdGuaranteeFunds,
productGuaranteeData, principalThresholdForLastInstallment, accountMovesOutOfNPAOnlyOnArrearsCompletion,
canDefineInstallmentAmount, installmentAmountInMultiplesOf, loanProductConfigurableAttributes,
@@ -878,7 +878,7 @@ public class LoanProductData implements Serializable {
Collection<LoanProductBorrowerCycleVariationData> numberOfRepaymentVariations, Boolean multiDisburseLoan,
Integer maxTrancheCount, BigDecimal outstandingLoanBalance, final Boolean disallowExpectedDisbursements,
final Boolean allowApprovedDisbursedAmountsOverApplied, final String overAppliedCalculationType,
final Integer overAppliedNumber, final Boolean allowFullTermForTranche, final Integer graceOnArrearsAging,
final Integer overAppliedNumber, final Boolean allowFullTermForTranche, final Integer graceOnArrearsAgeing,
final Integer overdueDaysForNPA, final EnumOptionData daysInMonthType, final EnumOptionData daysInYearType,
final boolean isInterestRecalculationEnabled, final LoanProductInterestRecalculationData interestRecalculationData,
final Integer minimumDaysBetweenDisbursalAndFirstRepayment, boolean holdGuaranteeFunds,
@@ -1007,7 +1007,7 @@ public class LoanProductData implements Serializable {
this.overAppliedNumber = overAppliedNumber;
this.allowFullTermForTranche = allowFullTermForTranche;
this.graceOnArrearsAging = graceOnArrearsAging;
this.graceOnArrearsAgeing = graceOnArrearsAgeing;
this.overdueDaysForNPA = overdueDaysForNPA;
this.daysInMonthType = daysInMonthType;
this.daysInYearType = daysInYearType;
@@ -1210,7 +1210,7 @@ public class LoanProductData implements Serializable {
this.accountingMappingOptions = accountingMappingOptions;
this.accountingRuleOptions = accountingRuleOptions;
this.valueConditionTypeOptions = valueConditionTypeOptions;
this.graceOnArrearsAging = productData.graceOnArrearsAging;
this.graceOnArrearsAgeing = productData.graceOnArrearsAgeing;
this.overdueDaysForNPA = productData.overdueDaysForNPA;
this.daysInMonthType = productData.daysInMonthType;
@@ -58,7 +58,7 @@ public interface ILoanConfigurationDetails {
AmortizationMethod getAmortizationMethod();
Integer getGraceOnArrearsAging();
Integer getGraceOnArrearsAgeing();
Integer getDaysInMonthType();
@@ -262,7 +262,7 @@ public class LoanProduct extends AbstractPersistableCustom<Long> {
final boolean includeInBorrowerCycle, final LocalDate startDate, final LocalDate closeDate, final ExternalId externalId,
final boolean useBorrowerCycle, final Set<LoanProductBorrowerCycleVariations> loanProductBorrowerCycleVariations,
final boolean multiDisburseLoan, final Integer maxTrancheCount, final BigDecimal outstandingLoanBalance,
final Integer graceOnArrearsAging, final Integer overdueDaysForNPA, final DaysInMonthType daysInMonthType,
final Integer graceOnArrearsAgeing, final Integer overdueDaysForNPA, final DaysInMonthType daysInMonthType,
final DaysInYearType daysInYearType, final boolean isInterestRecalculationEnabled,
final LoanProductInterestRecalculationDetails productInterestRecalculationDetails,
final Integer minimumDaysBetweenDisbursalAndFirstRepayment, final boolean holdGuarantorFunds,
@@ -335,7 +335,7 @@ public class LoanProduct extends AbstractPersistableCustom<Long> {
interestPeriodFrequencyType, defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod,
considerPartialPeriodInterest, repayEvery, repaymentFrequencyType, defaultNumberOfInstallments, graceOnPrincipalPayment,
recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment, graceOnInterestCharged, amortizationMethod,
inArrearsTolerance, graceOnArrearsAging, daysInMonthType.getValue(), daysInYearType.getValue(),
inArrearsTolerance, graceOnArrearsAgeing, daysInMonthType.getValue(), daysInYearType.getValue(),
isInterestRecalculationEnabled, isEqualAmortization, enableDownPayment, disbursedAmountPercentageForDownPayment,
enableAutoRepaymentForDownPayment, loanScheduleType, loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting,
supportedInterestRefundTypes, chargeOffBehaviour, isInterestRecognitionOnDisbursementDate, daysInYearCustomStrategy,
@@ -58,14 +58,14 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
@Column(name = "moratorium")
private Boolean graceOnPrincipalAndInterestPayment;
@Column(name = "grace_on_arrears_aging")
private Boolean graceOnArrearsAging;
@Column(name = "grace_on_arrears_ageing")
private Boolean graceOnArrearsAgeing;
private static final String[] supportedLoanConfigurableAttributes = { LoanProductConstants.amortizationTypeParamName,
LoanProductConstants.interestTypeParamName, LoanProductConstants.transactionProcessingStrategyCodeParamName,
LoanProductConstants.interestCalculationPeriodTypeParamName, LoanProductConstants.inArrearsToleranceParamName,
LoanProductConstants.repaymentEveryParamName, LoanProductConstants.graceOnPrincipalAndInterestPaymentParamName,
LoanProductConstants.GRACE_ON_ARREARS_AGING_PARAMETER_NAME };
LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME };
public static LoanProductConfigurableAttributes createFrom(JsonCommand command) {
@@ -92,7 +92,7 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
.getAsJsonPrimitive(LoanProductConstants.graceOnPrincipalAndInterestPaymentParamName).getAsBoolean();
final Boolean graceOnArrearsAging = command.parsedJson().getAsJsonObject()
.getAsJsonObject(LoanProductConstants.allowAttributeOverridesParamName)
.getAsJsonPrimitive(LoanProductConstants.GRACE_ON_ARREARS_AGING_PARAMETER_NAME).getAsBoolean();
.getAsJsonPrimitive(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME).getAsBoolean();
return new LoanProductConfigurableAttributes(amortization, interestMethod, transactionProcessingStrategy, interestCalcPeriod,
arrearsTolerance, repaymentEvery, graceOnPrincipalAndInterestPayment, graceOnArrearsAging);
@@ -122,7 +122,7 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
this.amortizationType = amortization;
this.interestType = interestMethod;
this.inArrearsTolerance = arrearsTolerance;
this.graceOnArrearsAging = graceOnArrearsAging;
this.graceOnArrearsAgeing = graceOnArrearsAging;
this.interestCalculationPeriodType = interestCalcPeriod;
this.graceOnPrincipalAndInterestPayment = graceOnPrincipalAndInterestPayment;
this.repaymentEvery = repaymentEvery;
@@ -170,7 +170,7 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
}
public Boolean getGraceOnArrearsAgingBoolean() {
return graceOnArrearsAging;
return graceOnArrearsAgeing;
}
public void setLoanProduct(LoanProduct loanProduct) {
@@ -205,8 +205,8 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
this.graceOnPrincipalAndInterestPayment = graceOnPrincipalAndInterestPayment;
}
public void setGraceOnArrearsAging(Boolean graceOnArrearsAging) {
this.graceOnArrearsAging = graceOnArrearsAging;
public void setGraceOnArrearsAgeing(Boolean graceOnArrearsAgeing) {
this.graceOnArrearsAgeing = graceOnArrearsAgeing;
}
@Override
@@ -227,12 +227,12 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
&& Objects.equals(interestCalculationPeriodType, that.interestCalculationPeriodType)
&& Objects.equals(inArrearsTolerance, that.inArrearsTolerance) && Objects.equals(repaymentEvery, that.repaymentEvery)
&& Objects.equals(graceOnPrincipalAndInterestPayment, that.graceOnPrincipalAndInterestPayment)
&& Objects.equals(graceOnArrearsAging, that.graceOnArrearsAging);
&& Objects.equals(graceOnArrearsAgeing, that.graceOnArrearsAgeing);
}
@Override
public int hashCode() {
return Objects.hash(loanProduct, amortizationType, interestType, transactionProcessingStrategyCode, interestCalculationPeriodType,
inArrearsTolerance, repaymentEvery, graceOnPrincipalAndInterestPayment, graceOnArrearsAging);
inArrearsTolerance, repaymentEvery, graceOnPrincipalAndInterestPayment, graceOnArrearsAgeing);
}
}
@@ -124,8 +124,8 @@ public class LoanProductRelatedDetail {
@Column(name = "arrearstolerance_amount", scale = 6, precision = 19)
private BigDecimal inArrearsTolerance;
@Column(name = "grace_on_arrears_aging")
private Integer graceOnArrearsAging;
@Column(name = "grace_on_arrears_ageing")
private Integer graceOnArrearsAgeing;
@Column(name = "days_in_month_enum", nullable = false)
private Integer daysInMonthType;
@@ -217,7 +217,7 @@ public class LoanProductRelatedDetail {
final Integer repaymentEvery, final PeriodFrequencyType repaymentPeriodFrequencyType, final Integer numberOfRepayments,
final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods,
final Integer graceOnInterestPayment, final Integer graceOnInterestCharged, final AmortizationMethod amortizationMethod,
final BigDecimal inArrearsTolerance, final Integer graceOnArrearsAging, final Integer daysInMonthType,
final BigDecimal inArrearsTolerance, final Integer graceOnArrearsAgeing, final Integer daysInMonthType,
final Integer daysInYearType, final boolean isInterestRecalculationEnabled, final boolean isEqualAmortization,
final boolean enableDownPayment, final BigDecimal disbursedAmountPercentageForDownPayment,
final boolean enableAutoRepaymentForDownPayment, final LoanScheduleType loanScheduleType,
@@ -236,7 +236,7 @@ public class LoanProductRelatedDetail {
nominalAnnualInterestRate, interestMethod, interestCalculationPeriodMethod, allowPartialPeriodInterestCalculation,
repaymentEvery, repaymentPeriodFrequencyType, numberOfRepayments, graceOnPrincipalPayment,
recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment, graceOnInterestCharged, amortizationMethod,
inArrearsTolerance, graceOnArrearsAging, daysInMonthType, daysInYearType, isInterestRecalculationEnabled,
inArrearsTolerance, graceOnArrearsAgeing, daysInMonthType, daysInYearType, isInterestRecalculationEnabled,
isEqualAmortization, enableDownPayment, disbursedAmountPercentageForDownPayment, enableAutoRepaymentForDownPayment,
loanScheduleType, loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting, supportedInterestRefundTypes,
chargeOffBehaviour, interestRecognitionOnDisbursementDate, daysInYearCustomStrategy, enableIncomeCapitalization,
@@ -255,7 +255,7 @@ public class LoanProductRelatedDetail {
final Integer repayEvery, final PeriodFrequencyType repaymentFrequencyType, final Integer defaultNumberOfRepayments,
final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods,
final Integer graceOnInterestPayment, final Integer graceOnInterestCharged, final AmortizationMethod amortizationMethod,
final BigDecimal inArrearsTolerance, final Integer graceOnArrearsAging, final Integer daysInMonthType,
final BigDecimal inArrearsTolerance, final Integer graceOnArrearsAgeing, final Integer daysInMonthType,
final Integer daysInYearType, final boolean isInterestRecalculationEnabled, final boolean isEqualAmortization,
final boolean enableDownPayment, final BigDecimal disbursedAmountPercentageForDownPayment,
final boolean enableAutoRepaymentForDownPayment, final LoanScheduleType loanScheduleType,
@@ -290,7 +290,7 @@ public class LoanProductRelatedDetail {
} else {
this.inArrearsTolerance = inArrearsTolerance;
}
this.graceOnArrearsAging = graceOnArrearsAging;
this.graceOnArrearsAgeing = graceOnArrearsAgeing;
this.daysInMonthType = daysInMonthType;
this.daysInYearType = daysInYearType;
this.isInterestRecalculationEnabled = isInterestRecalculationEnabled;