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

This commit is contained in:
Kengne-yvana
2026-01-08 10:43:21 -06:00
committed by GitHub
parent 4c1016d239
commit 61034e6041
71 changed files with 321 additions and 321 deletions
@@ -113,8 +113,8 @@ public class LoanDelinquencyDomainServiceImpl implements LoanDelinquencyDomainSe
}
Integer graceDays = 0;
if (loan.getLoanProductRelatedDetail().getGraceOnArrearsAgeing() != null) {
graceDays = loan.getLoanProductRelatedDetail().getGraceOnArrearsAgeing();
if (loan.getLoanProductRelatedDetail().getGraceOnArrearsAging() != null) {
graceDays = loan.getLoanProductRelatedDetail().getGraceOnArrearsAging();
}
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().getGraceOnArrearsAgeing() != null) {
graceDays = loan.getLoanProductRelatedDetail().getGraceOnArrearsAgeing();
if (loan.getLoanProductRelatedDetail().getGraceOnArrearsAging() != null) {
graceDays = loan.getLoanProductRelatedDetail().getGraceOnArrearsAging();
}
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 graceOnArrearsAgeing;
private Integer graceOnArrearsAging;
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)
.setGraceOnArrearsAgeing(product.getGraceOnArrearsAgeing()).setOverdueCharges(product.overdueFeeCharges())
.setGraceOnArrearsAging(product.getGraceOnArrearsAging()).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 graceOnArrearsAgeing, final Boolean isNPA, final EnumOptionData daysInMonthType,
final Integer graceOnArrearsAging, 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).setGraceOnArrearsAgeing(graceOnArrearsAgeing)
.setMaxOutstandingLoanBalance(outstandingLoanBalance).setInArrears(inArrears).setGraceOnArrearsAging(graceOnArrearsAging)
.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.updateloanarrearsageing;
package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsaging;
import java.math.BigDecimal;
import java.sql.ResultSet;
@@ -44,7 +44,7 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component
@RequiredArgsConstructor
public class LoanArrearsAgeingUpdateHandler {
public class LoanArrearsAgingUpdateHandler {
private final JdbcTemplate jdbcTemplate;
private final DatabaseSpecificSQLGenerator sqlGenerator;
@@ -61,10 +61,10 @@ public class LoanArrearsAgeingUpdateHandler {
}
}
public void updateLoanArrearsAgeingDetailsForAllLoans() {
public void updateLoanArrearsAgingDetailsForAllLoans() {
truncateLoanArrearsAgingDetails();
String insertSQLStatement = buildQueryForInsertAgeingDetails(Boolean.TRUE);
List<String> insertStatements = updateLoanArrearsAgeingDetailsWithOriginalScheduleForAllLoans();
String insertSQLStatement = buildQueryForInsertAgingDetails(Boolean.TRUE);
List<String> insertStatements = updateLoanArrearsAgingDetailsWithOriginalScheduleForAllLoans();
insertStatements.add(0, insertSQLStatement);
final int[] records = this.jdbcTemplate.batchUpdate(insertStatements.toArray(new String[0]));
if (log.isDebugEnabled()) {
@@ -72,14 +72,14 @@ public class LoanArrearsAgeingUpdateHandler {
for (int record : records) {
result += record;
}
log.debug("Records affected by updateLoanArrearsAgeingDetails: {}", result);
log.debug("Records affected by updateLoanArrearsAgingDetails: {}", result);
}
}
public void updateLoanArrearsAgeingDetails(List<Long> loanIdsForUpdate) {
public void updateLoanArrearsAgingDetails(List<Long> loanIdsForUpdate) {
deleteLoanArrearsAgingDetails(loanIdsForUpdate);
String insertSQLStatement = buildQueryForInsertAgeingDetails(Boolean.FALSE);
String insertSQLStatement = buildQueryForInsertAgingDetails(Boolean.FALSE);
List<Object[]> batch = new ArrayList<Object[]>();
if (!loanIdsForUpdate.isEmpty()) {
for (Long loanId : loanIdsForUpdate) {
@@ -89,7 +89,7 @@ public class LoanArrearsAgeingUpdateHandler {
}
final int[] recordsUpdatedWithoutOriginalSchedule = this.jdbcTemplate.batchUpdate(insertSQLStatement, batch);
int[] recordsUpdatedWithOriginalSchedule = new int[0];
List<String> insertStatements = updateLoanArrearsAgeingDetailsWithOriginalSchedule(loanIdsForUpdate);
List<String> insertStatements = updateLoanArrearsAgingDetailsWithOriginalSchedule(loanIdsForUpdate);
if (!insertStatements.isEmpty()) {
recordsUpdatedWithOriginalSchedule = this.jdbcTemplate.batchUpdate(insertStatements.toArray(new String[0]));
@@ -104,12 +104,12 @@ public class LoanArrearsAgeingUpdateHandler {
result += recordWithOriginalSchedule;
}
}
log.debug("Records affected by updateLoanArrearsAgeingDetails: {}", result);
log.debug("Records affected by updateLoanArrearsAgingDetails: {}", result);
}
}
private String buildQueryForInsertAgeingDetails(boolean isForAllLoans) {
private String buildQueryForInsertAgingDetails(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 LoanArrearsAgeingUpdateHandler {
}
insertSqlStatementBuilder.append(" and mr.completed_derived is false ");
insertSqlStatementBuilder.append(" and mr.duedate < ")
.append(sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_ageing, 0)", "day"))
.append(sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_aging, 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 LoanArrearsAgeingUpdateHandler {
return insertSqlStatementBuilder.toString();
}
private List<String> updateLoanArrearsAgeingDetailsWithOriginalSchedule(List<Long> loanIdsForUpdate) {
private List<String> updateLoanArrearsAgingDetailsWithOriginalSchedule(List<Long> loanIdsForUpdate) {
List<String> insertStatement = new ArrayList<>();
String sqlForLoanIdentifiers = buildQueryForLoanIdentifiersWithOriginalSchedule(Boolean.FALSE);
List<Object> loanIdsForQuery = new ArrayList<>();
@@ -166,7 +166,7 @@ public class LoanArrearsAgeingUpdateHandler {
return insertStatement;
}
private List<String> updateLoanArrearsAgeingDetailsWithOriginalScheduleForAllLoans() {
private List<String> updateLoanArrearsAgingDetailsWithOriginalScheduleForAllLoans() {
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 LoanArrearsAgeingUpdateHandler {
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_ageing, 0)", "day"))
.append(sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_aging, 0)", "day"))
.append(" group by ml.id");
return loanIdentifier.toString();
}
@@ -233,7 +233,7 @@ public class LoanArrearsAgeingUpdateHandler {
"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_ageing, 0)", "day") + " and ");
+ sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_aging, 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.updateloanarrearsageing;
package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsaging;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.jobs.service.JobName;
@@ -32,27 +32,27 @@ import org.springframework.transaction.PlatformTransactionManager;
@Configuration
@RequiredArgsConstructor
public class UpdateLoanArrearsAgeingConfig {
public class UpdateLoanArrearsAgingConfig {
private final JobRepository jobRepository;
private final PlatformTransactionManager transactionManager;
private final LoanArrearsAgeingUpdateHandler updateLoanArrearsAgingService;
private final LoanArrearsAgingUpdateHandler updateLoanArrearsAgingService;
@Bean
protected Step updateLoanArrearsAgeingStep() {
return new StepBuilder(JobName.UPDATE_LOAN_ARREARS_AGEING.name(), jobRepository)
.tasklet(updateLoanArrearsAgeingTasklet(), transactionManager).build();
protected Step updateLoanArrearsAgingStep() {
return new StepBuilder(JobName.UPDATE_LOAN_ARREARS_AGING.name(), jobRepository)
.tasklet(updateLoanArrearsAgingTasklet(), transactionManager).build();
}
@Bean
public Job updateLoanArrearsAgeingJob() {
return new JobBuilder(JobName.UPDATE_LOAN_ARREARS_AGEING.name(), jobRepository).start(updateLoanArrearsAgeingStep())
public Job updateLoanArrearsAgingJob() {
return new JobBuilder(JobName.UPDATE_LOAN_ARREARS_AGING.name(), jobRepository).start(updateLoanArrearsAgingStep())
.incrementer(new RunIdIncrementer()).build();
}
@Bean
public UpdateLoanArrearsAgeingTasklet updateLoanArrearsAgeingTasklet() {
return new UpdateLoanArrearsAgeingTasklet(updateLoanArrearsAgingService);
public UpdateLoanArrearsAgingTasklet updateLoanArrearsAgingTasklet() {
return new UpdateLoanArrearsAgingTasklet(updateLoanArrearsAgingService);
}
}
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsageing;
package org.apache.fineract.portfolio.loanaccount.jobs.updateloanarrearsaging;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -27,13 +27,13 @@ import org.springframework.batch.repeat.RepeatStatus;
@Slf4j
@RequiredArgsConstructor
public class UpdateLoanArrearsAgeingTasklet implements Tasklet {
public class UpdateLoanArrearsAgingTasklet implements Tasklet {
private final LoanArrearsAgeingUpdateHandler loanArrearsAgeingUpdateHandler;
private final LoanArrearsAgingUpdateHandler loanArrearsAgingUpdateHandler;
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
loanArrearsAgeingUpdateHandler.updateLoanArrearsAgeingDetailsForAllLoans();
loanArrearsAgingUpdateHandler.updateLoanArrearsAgingDetailsForAllLoans();
return RepeatStatus.FINISHED;
}
@@ -134,7 +134,7 @@ public final class LoanApplicationTerms {
private LocalDate interestChargedFromDate;
private Money inArrearsTolerance;
private Integer graceOnArrearsAgeing;
private Integer graceOnArrearsAging;
// 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 graceOnArrearsAgeing, final DaysInMonthType daysInMonthType, final DaysInYearType daysInYearType,
final Integer graceOnArrearsAging, 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, graceOnArrearsAgeing, daysInMonthType, daysInYearType,
disbursementDatas, maxOutstandingBalance, graceOnArrearsAging, 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.getGraceOnArrearsAgeing(), daysInMonthType,
disbursementDatas, maxOutstandingBalance, loanProductRelatedDetail.getGraceOnArrearsAging(), 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 graceOnArrearsAgeing, final DaysInMonthType daysInMonthType, final DaysInYearType daysInYearType,
final Integer graceOnArrearsAging, 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.graceOnArrearsAgeing = graceOnArrearsAgeing;
this.graceOnArrearsAging = graceOnArrearsAging;
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.graceOnArrearsAgeing, this.daysInMonthType.getValue(), this.daysInYearType.getValue(),
this.graceOnArrearsAging, 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 updateLoanArrearsAgeingDetailsWithOriginalSchedule(Loan loan);
void updateLoanArrearsAgingDetailsWithOriginalSchedule(Loan loan);
Map<Long, List<LoanSchedulePeriodData>> getScheduleDate(String loanId);
void updateLoanArrearsAgeingDetails(Loan loan);
void updateLoanArrearsAgingDetails(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 updateLoanArrearsAgeingDetailsWithOriginalSchedule(final Loan loan) {
public void updateLoanArrearsAgingDetailsWithOriginalSchedule(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 updateLoanArrearsAgeingDetails(final Loan loan) {
public void updateLoanArrearsAgingDetails(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_ageing, 0)", "day") + " and ");
+ sqlGenerator.subDate(sqlGenerator.currentBusinessDate(), "COALESCE(ml.grace_on_arrears_aging, 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()) {
updateLoanArrearsAgeingDetailsWithOriginalSchedule(loan);
updateLoanArrearsAgingDetailsWithOriginalSchedule(loan);
} else {
updateLoanArrearsAgeingDetails(loan);
updateLoanArrearsAgingDetails(loan);
}
}
@@ -528,7 +528,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService {
@Override
public void onBusinessEvent(LoanDisbursalBusinessEvent event) {
Loan loan = event.get();
updateLoanArrearsAgeingDetails(loan);
updateLoanArrearsAgingDetails(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_AGEING_PARAMETER_NAME = "graceOnArrearsAgeing";
String GRACE_ON_ARREARS_AGING_PARAMETER_NAME = "graceOnArrearsAging";
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 graceOnArrearsAgeing;
public Integer graceOnArrearsAging;
@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 graceOnArrearsAgeing;
public boolean graceOnArrearsAging;
}
static final class RateData {
@@ -1672,7 +1672,7 @@ public final class LoanProductsApiResourceSwagger {
@Schema(example = "90")
public Integer inArrearsTolerance;
@Schema(example = "3")
public Integer graceOnArrearsAgeing;
public Integer graceOnArrearsAging;
@Schema(example = "false")
public Boolean accountMovesOutOfNPAOnlyOnArrearsCompletion;
@Schema(example = "false")
@@ -175,7 +175,7 @@ public class LoanConfigurationDetails implements ILoanConfigurationDetails {
}
@Override
public Integer getGraceOnArrearsAgeing() {
public Integer getGraceOnArrearsAging() {
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 graceOnArrearsAgeing;
private final Integer graceOnArrearsAging;
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 graceOnArrearsAgeing = null;
final Integer graceOnArrearsAging = 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, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType,
allowFullTermForTranche, graceOnArrearsAging, 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 graceOnArrearsAgeing = null;
final Integer graceOnArrearsAging = 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, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType,
allowFullTermForTranche, graceOnArrearsAging, 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 graceOnArrearsAgeing = null;
final Integer graceOnArrearsAging = 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, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType,
overAppliedNumber, allowFullTermForTranche, graceOnArrearsAging, 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 graceOnArrearsAgeing = null;
final Integer graceOnArrearsAging = 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, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType,
overAppliedNumber, allowFullTermForTranche, graceOnArrearsAging, 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 graceOnArrearsAgeing,
final Integer overAppliedNumber, final Boolean allowFullTermForTranche, final Integer graceOnArrearsAging,
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.graceOnArrearsAgeing = graceOnArrearsAgeing;
this.graceOnArrearsAging = graceOnArrearsAging;
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.graceOnArrearsAgeing = productData.graceOnArrearsAgeing;
this.graceOnArrearsAging = productData.graceOnArrearsAging;
this.overdueDaysForNPA = productData.overdueDaysForNPA;
this.daysInMonthType = productData.daysInMonthType;
@@ -58,7 +58,7 @@ public interface ILoanConfigurationDetails {
AmortizationMethod getAmortizationMethod();
Integer getGraceOnArrearsAgeing();
Integer getGraceOnArrearsAging();
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 graceOnArrearsAgeing, final Integer overdueDaysForNPA, final DaysInMonthType daysInMonthType,
final Integer graceOnArrearsAging, 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, graceOnArrearsAgeing, daysInMonthType.getValue(), daysInYearType.getValue(),
inArrearsTolerance, graceOnArrearsAging, 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_ageing")
private Boolean graceOnArrearsAgeing;
@Column(name = "grace_on_arrears_aging")
private Boolean graceOnArrearsAging;
private static final String[] supportedLoanConfigurableAttributes = { LoanProductConstants.amortizationTypeParamName,
LoanProductConstants.interestTypeParamName, LoanProductConstants.transactionProcessingStrategyCodeParamName,
LoanProductConstants.interestCalculationPeriodTypeParamName, LoanProductConstants.inArrearsToleranceParamName,
LoanProductConstants.repaymentEveryParamName, LoanProductConstants.graceOnPrincipalAndInterestPaymentParamName,
LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME };
LoanProductConstants.GRACE_ON_ARREARS_AGING_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_AGEING_PARAMETER_NAME).getAsBoolean();
.getAsJsonPrimitive(LoanProductConstants.GRACE_ON_ARREARS_AGING_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.graceOnArrearsAgeing = graceOnArrearsAging;
this.graceOnArrearsAging = graceOnArrearsAging;
this.interestCalculationPeriodType = interestCalcPeriod;
this.graceOnPrincipalAndInterestPayment = graceOnPrincipalAndInterestPayment;
this.repaymentEvery = repaymentEvery;
@@ -170,7 +170,7 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
}
public Boolean getGraceOnArrearsAgingBoolean() {
return graceOnArrearsAgeing;
return graceOnArrearsAging;
}
public void setLoanProduct(LoanProduct loanProduct) {
@@ -205,8 +205,8 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
this.graceOnPrincipalAndInterestPayment = graceOnPrincipalAndInterestPayment;
}
public void setGraceOnArrearsAgeing(Boolean graceOnArrearsAgeing) {
this.graceOnArrearsAgeing = graceOnArrearsAgeing;
public void setGraceOnArrearsAging(Boolean graceOnArrearsAging) {
this.graceOnArrearsAging = graceOnArrearsAging;
}
@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(graceOnArrearsAgeing, that.graceOnArrearsAgeing);
&& Objects.equals(graceOnArrearsAging, that.graceOnArrearsAging);
}
@Override
public int hashCode() {
return Objects.hash(loanProduct, amortizationType, interestType, transactionProcessingStrategyCode, interestCalculationPeriodType,
inArrearsTolerance, repaymentEvery, graceOnPrincipalAndInterestPayment, graceOnArrearsAgeing);
inArrearsTolerance, repaymentEvery, graceOnPrincipalAndInterestPayment, graceOnArrearsAging);
}
}
@@ -124,8 +124,8 @@ public class LoanProductRelatedDetail {
@Column(name = "arrearstolerance_amount", scale = 6, precision = 19)
private BigDecimal inArrearsTolerance;
@Column(name = "grace_on_arrears_ageing")
private Integer graceOnArrearsAgeing;
@Column(name = "grace_on_arrears_aging")
private Integer graceOnArrearsAging;
@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 graceOnArrearsAgeing, final Integer daysInMonthType,
final BigDecimal inArrearsTolerance, final Integer graceOnArrearsAging, 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, graceOnArrearsAgeing, daysInMonthType, daysInYearType, isInterestRecalculationEnabled,
inArrearsTolerance, graceOnArrearsAging, 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 graceOnArrearsAgeing, final Integer daysInMonthType,
final BigDecimal inArrearsTolerance, final Integer graceOnArrearsAging, 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.graceOnArrearsAgeing = graceOnArrearsAgeing;
this.graceOnArrearsAging = graceOnArrearsAging;
this.daysInMonthType = daysInMonthType;
this.daysInYearType = daysInYearType;
this.isInterestRecalculationEnabled = isInterestRecalculationEnabled;