FINERACT-2154: Store "Pre-close interest calculation strategy" on loan level
This commit is contained in:
+16
-2
@@ -20,11 +20,14 @@ package org.apache.fineract.portfolio.loanaccount.domain;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestRecalculationCompoundingMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreCloseInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductInterestRecalculationDetails;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanRescheduleStrategyMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.RecalculationFrequencyType;
|
||||
@@ -88,6 +91,10 @@ public class LoanInterestRecalculationDetails extends AbstractPersistableCustom<
|
||||
@Column(name = "allow_compounding_on_eod")
|
||||
private Boolean allowCompoundingOnEod;
|
||||
|
||||
@Column(name = "pre_close_interest_calculation_strategy")
|
||||
@Enumerated(EnumType.ORDINAL)
|
||||
private LoanPreCloseInterestCalculationStrategy preCloseInterestCalculationStrategy;
|
||||
|
||||
@Column(name = "disallow_interest_calc_on_past_due")
|
||||
private Boolean disallowInterestCalculationOnPastDue;
|
||||
|
||||
@@ -99,7 +106,8 @@ public class LoanInterestRecalculationDetails extends AbstractPersistableCustom<
|
||||
final Integer restFrequencyType, final Integer restInterval, final Integer restFrequencyNthDay, Integer restFrequencyWeekday,
|
||||
Integer restFrequencyOnDay, Integer compoundingFrequencyType, Integer compoundingInterval, Integer compoundingFrequencyNthDay,
|
||||
Integer compoundingFrequencyWeekday, Integer compoundingFrequencyOnDay, final boolean isCompoundingToBePostedAsTransaction,
|
||||
final boolean allowCompoundingOnEod, final boolean disallowInterestCalculationOnPastDue) {
|
||||
final boolean allowCompoundingOnEod, final boolean disallowInterestCalculationOnPastDue,
|
||||
final LoanPreCloseInterestCalculationStrategy preCloseInterestCalculationStrategy) {
|
||||
this.interestRecalculationCompoundingMethod = interestRecalculationCompoundingMethod;
|
||||
this.rescheduleStrategyMethod = rescheduleStrategyMethod;
|
||||
this.restFrequencyNthDay = restFrequencyNthDay;
|
||||
@@ -115,6 +123,7 @@ public class LoanInterestRecalculationDetails extends AbstractPersistableCustom<
|
||||
this.isCompoundingToBePostedAsTransaction = isCompoundingToBePostedAsTransaction;
|
||||
this.allowCompoundingOnEod = allowCompoundingOnEod;
|
||||
this.disallowInterestCalculationOnPastDue = disallowInterestCalculationOnPastDue;
|
||||
this.preCloseInterestCalculationStrategy = preCloseInterestCalculationStrategy;
|
||||
}
|
||||
|
||||
public static LoanInterestRecalculationDetails createFrom(
|
||||
@@ -132,7 +141,8 @@ public class LoanInterestRecalculationDetails extends AbstractPersistableCustom<
|
||||
loanProductInterestRecalculationDetails.getCompoundingFrequencyOnDay(),
|
||||
loanProductInterestRecalculationDetails.getIsCompoundingToBePostedAsTransaction(),
|
||||
loanProductInterestRecalculationDetails.allowCompoundingOnEod(),
|
||||
loanProductInterestRecalculationDetails.disallowInterestCalculationOnPastDue());
|
||||
loanProductInterestRecalculationDetails.disallowInterestCalculationOnPastDue(),
|
||||
loanProductInterestRecalculationDetails.getPreCloseInterestCalculationStrategy());
|
||||
}
|
||||
|
||||
public void updateLoan(final Loan loan) {
|
||||
@@ -198,4 +208,8 @@ public class LoanInterestRecalculationDetails extends AbstractPersistableCustom<
|
||||
public Boolean disallowInterestCalculationOnPastDue() {
|
||||
return disallowInterestCalculationOnPastDue;
|
||||
}
|
||||
|
||||
public LoanPreCloseInterestCalculationStrategy getPreCloseInterestCalculationStrategy() {
|
||||
return preCloseInterestCalculationStrategy;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -52,7 +52,7 @@ import org.apache.fineract.portfolio.loanproduct.domain.AmortizationMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestCalculationPeriodMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestRecalculationCompoundingMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreClosureInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreCloseInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRelatedDetail;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanRescheduleStrategyMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanSupportedInterestRefundTypes;
|
||||
@@ -173,7 +173,7 @@ public final class LoanApplicationTerms {
|
||||
private BigDecimal principalThresholdForLastInstalment;
|
||||
private Integer installmentAmountInMultiplesOf;
|
||||
|
||||
private LoanPreClosureInterestCalculationStrategy preClosureInterestCalculationStrategy;
|
||||
private LoanPreCloseInterestCalculationStrategy preClosureInterestCalculationStrategy;
|
||||
|
||||
private Money approvedPrincipal;
|
||||
|
||||
@@ -450,7 +450,7 @@ public final class LoanApplicationTerms {
|
||||
final InterestRecalculationCompoundingMethod interestRecalculationCompoundingMethod,
|
||||
final CalendarInstance compoundingCalendarInstance, final RecalculationFrequencyType compoundingFrequencyType,
|
||||
final BigDecimal principalThresholdForLastInstalment, final Integer installmentAmountInMultiplesOf,
|
||||
final LoanPreClosureInterestCalculationStrategy preClosureInterestCalculationStrategy, final Calendar loanCalendar,
|
||||
final LoanPreCloseInterestCalculationStrategy preClosureInterestCalculationStrategy, final Calendar loanCalendar,
|
||||
BigDecimal approvedAmount, List<LoanTermVariationsData> loanTermVariations,
|
||||
Boolean isInterestChargedFromDateSameAsDisbursalDateEnabled, final Integer numberOfDays,
|
||||
boolean isSkipRepaymentOnFirstDayOfMonth, final HolidayDetailDTO holidayDetailDTO, final boolean allowCompoundingOnEod,
|
||||
@@ -494,7 +494,7 @@ public final class LoanApplicationTerms {
|
||||
final RecalculationFrequencyType recalculationFrequencyType, final CalendarInstance restCalendarInstance,
|
||||
final InterestRecalculationCompoundingMethod compoundingMethod, final CalendarInstance compoundingCalendarInstance,
|
||||
final RecalculationFrequencyType compoundingFrequencyType,
|
||||
final LoanPreClosureInterestCalculationStrategy loanPreClosureInterestCalculationStrategy,
|
||||
final LoanPreCloseInterestCalculationStrategy loanPreClosureInterestCalculationStrategy,
|
||||
final LoanRescheduleStrategyMethod rescheduleStrategyMethod, final Calendar loanCalendar, BigDecimal approvedAmount,
|
||||
BigDecimal annualNominalInterestRate, final List<LoanTermVariationsData> loanTermVariations,
|
||||
final CalendarHistoryDataWrapper calendarHistoryDataWrapper, final Integer numberOfDays,
|
||||
@@ -574,7 +574,7 @@ public final class LoanApplicationTerms {
|
||||
final CalendarInstance restCalendarInstance, final RecalculationFrequencyType recalculationFrequencyType,
|
||||
final CalendarInstance compoundingCalendarInstance, final RecalculationFrequencyType compoundingFrequencyType,
|
||||
final BigDecimal principalThresholdForLastInstalment, final Integer installmentAmountInMultiplesOf,
|
||||
final LoanPreClosureInterestCalculationStrategy preClosureInterestCalculationStrategy, final Calendar loanCalendar,
|
||||
final LoanPreCloseInterestCalculationStrategy preClosureInterestCalculationStrategy, final Calendar loanCalendar,
|
||||
BigDecimal approvedAmount, List<LoanTermVariationsData> loanTermVariations,
|
||||
final CalendarHistoryDataWrapper calendarHistoryDataWrapper, Boolean isInterestChargedFromDateSameAsDisbursalDateEnabled,
|
||||
final Integer numberOfDays, final boolean isSkipRepaymentOnFirstDayOfMonth, final HolidayDetailDTO holidayDetailDTO,
|
||||
@@ -1795,7 +1795,7 @@ public final class LoanApplicationTerms {
|
||||
return this.interestCalculationPeriodMethod;
|
||||
}
|
||||
|
||||
public LoanPreClosureInterestCalculationStrategy getPreClosureInterestCalculationStrategy() {
|
||||
public LoanPreCloseInterestCalculationStrategy getPreClosureInterestCalculationStrategy() {
|
||||
return this.preClosureInterestCalculationStrategy;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ import java.io.Serializable;
|
||||
import lombok.Getter;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestRecalculationCompoundingMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreClosureInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreCloseInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanRescheduleStrategyMethod;
|
||||
|
||||
@Getter
|
||||
@@ -102,7 +102,7 @@ public class LoanProductInterestRecalculationData implements Serializable {
|
||||
final boolean isArrearsBasedOnOriginalSchedule = false;
|
||||
final boolean isCompoundingToBePostedAsTransaction = false;
|
||||
final EnumOptionData preCloseInterestCalculationStrategy = preCloseInterestCalculationStrategy(
|
||||
LoanPreClosureInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE);
|
||||
LoanPreCloseInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE);
|
||||
final boolean allowCompoundingOnEod = false;
|
||||
final boolean disallowInterestCalculationOnPastDue = false;
|
||||
|
||||
|
||||
+7
-7
@@ -21,7 +21,7 @@ package org.apache.fineract.portfolio.loanproduct.domain;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum LoanPreClosureInterestCalculationStrategy {
|
||||
public enum LoanPreCloseInterestCalculationStrategy {
|
||||
|
||||
NONE(0, "loanPreClosureInterestCalculationStrategy.none"), //
|
||||
TILL_PRE_CLOSURE_DATE(1, "loanPreClosureInterestCalculationStrategy.tillPreClosureDate"), //
|
||||
@@ -33,13 +33,13 @@ public enum LoanPreClosureInterestCalculationStrategy {
|
||||
private final Integer value;
|
||||
private final String code;
|
||||
|
||||
private static final Map<Integer, LoanPreClosureInterestCalculationStrategy> intToEnumMap = new HashMap<>();
|
||||
private static final Map<Integer, LoanPreCloseInterestCalculationStrategy> intToEnumMap = new HashMap<>();
|
||||
private static int minValue;
|
||||
private static int maxValue;
|
||||
|
||||
static {
|
||||
int i = 0;
|
||||
for (final LoanPreClosureInterestCalculationStrategy type : LoanPreClosureInterestCalculationStrategy.values()) {
|
||||
for (final LoanPreCloseInterestCalculationStrategy type : LoanPreCloseInterestCalculationStrategy.values()) {
|
||||
if (i == 0) {
|
||||
minValue = type.value;
|
||||
}
|
||||
@@ -54,11 +54,11 @@ public enum LoanPreClosureInterestCalculationStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
public static LoanPreClosureInterestCalculationStrategy fromInt(final Integer ruleTypeValue) {
|
||||
public static LoanPreCloseInterestCalculationStrategy fromInt(final Integer ruleTypeValue) {
|
||||
return intToEnumMap.get(ruleTypeValue);
|
||||
}
|
||||
|
||||
LoanPreClosureInterestCalculationStrategy(final Integer value, final String code) {
|
||||
LoanPreCloseInterestCalculationStrategy(final Integer value, final String code) {
|
||||
this.value = value;
|
||||
this.code = code;
|
||||
}
|
||||
@@ -80,10 +80,10 @@ public enum LoanPreClosureInterestCalculationStrategy {
|
||||
}
|
||||
|
||||
public boolean calculateTillRestFrequencyEnabled() {
|
||||
return this.getValue().equals(LoanPreClosureInterestCalculationStrategy.TILL_REST_FREQUENCY_DATE.getValue());
|
||||
return this.getValue().equals(LoanPreCloseInterestCalculationStrategy.TILL_REST_FREQUENCY_DATE.getValue());
|
||||
}
|
||||
|
||||
public boolean calculateTillPreClosureDateEnabled() {
|
||||
return this.getValue().equals(LoanPreClosureInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE.getValue());
|
||||
return this.getValue().equals(LoanPreCloseInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE.getValue());
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1594,10 +1594,10 @@ public class LoanProduct extends AbstractPersistableCustom<Long> {
|
||||
return isBasedOnOriginalSchedule;
|
||||
}
|
||||
|
||||
public LoanPreClosureInterestCalculationStrategy preCloseInterestCalculationStrategy() {
|
||||
LoanPreClosureInterestCalculationStrategy preCloseInterestCalculationStrategy = LoanPreClosureInterestCalculationStrategy.NONE;
|
||||
public LoanPreCloseInterestCalculationStrategy preCloseInterestCalculationStrategy() {
|
||||
LoanPreCloseInterestCalculationStrategy preCloseInterestCalculationStrategy = LoanPreCloseInterestCalculationStrategy.NONE;
|
||||
if (this.isInterestRecalculationEnabled()) {
|
||||
preCloseInterestCalculationStrategy = getProductInterestRecalculationDetails().preCloseInterestCalculationStrategy();
|
||||
preCloseInterestCalculationStrategy = getProductInterestRecalculationDetails().getPreCloseInterestCalculationStrategy();
|
||||
}
|
||||
return preCloseInterestCalculationStrategy;
|
||||
}
|
||||
|
||||
+8
-8
@@ -88,7 +88,7 @@ public class LoanProductInterestRecalculationDetails extends AbstractPersistable
|
||||
private boolean isArrearsBasedOnOriginalSchedule;
|
||||
|
||||
@Column(name = "pre_close_interest_calculation_strategy")
|
||||
private Integer preClosureInterestCalculationStrategy;
|
||||
private Integer preCloseInterestCalculationStrategy;
|
||||
|
||||
@Column(name = "is_compounding_to_be_posted_as_transaction")
|
||||
private Boolean isCompoundingToBePostedAsTransaction;
|
||||
@@ -159,7 +159,7 @@ public class LoanProductInterestRecalculationDetails extends AbstractPersistable
|
||||
Integer preCloseInterestCalculationStrategy = command
|
||||
.integerValueOfParameterNamed(LoanProductConstants.preClosureInterestCalculationStrategyParamName);
|
||||
if (preCloseInterestCalculationStrategy == null) {
|
||||
preCloseInterestCalculationStrategy = LoanPreClosureInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE.getValue();
|
||||
preCloseInterestCalculationStrategy = LoanPreCloseInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE.getValue();
|
||||
}
|
||||
|
||||
final boolean isCompoundingToBePostedAsTransaction = command
|
||||
@@ -196,7 +196,7 @@ public class LoanProductInterestRecalculationDetails extends AbstractPersistable
|
||||
this.compoundingFrequencyOnDay = compoundingFrequencyOnDay;
|
||||
this.compoundingFrequencyWeekday = compoundingFrequencyWeekday;
|
||||
this.isArrearsBasedOnOriginalSchedule = isArrearsBasedOnOriginalSchedule;
|
||||
this.preClosureInterestCalculationStrategy = preCloseInterestCalculationStrategy;
|
||||
this.preCloseInterestCalculationStrategy = preCloseInterestCalculationStrategy;
|
||||
this.isCompoundingToBePostedAsTransaction = isCompoundingToBePostedAsTransaction;
|
||||
this.allowCompoundingOnEod = allowCompoundingOnEod;
|
||||
this.disallowInterestCalculationOnPastDue = disallowInterestCalculationOnPastDue;
|
||||
@@ -397,13 +397,13 @@ public class LoanProductInterestRecalculationDetails extends AbstractPersistable
|
||||
}
|
||||
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.preClosureInterestCalculationStrategyParamName,
|
||||
this.preClosureInterestCalculationStrategy)) {
|
||||
this.preCloseInterestCalculationStrategy)) {
|
||||
Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.preClosureInterestCalculationStrategyParamName);
|
||||
if (newValue == null) {
|
||||
newValue = LoanPreClosureInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE.getValue();
|
||||
newValue = LoanPreCloseInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE.getValue();
|
||||
}
|
||||
actualChanges.put(LoanProductConstants.preClosureInterestCalculationStrategyParamName, newValue);
|
||||
this.preClosureInterestCalculationStrategy = newValue;
|
||||
this.preCloseInterestCalculationStrategy = newValue;
|
||||
}
|
||||
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.isCompoundingToBePostedAsTransactionParamName,
|
||||
@@ -443,8 +443,8 @@ public class LoanProductInterestRecalculationDetails extends AbstractPersistable
|
||||
return this.isArrearsBasedOnOriginalSchedule;
|
||||
}
|
||||
|
||||
public LoanPreClosureInterestCalculationStrategy preCloseInterestCalculationStrategy() {
|
||||
return LoanPreClosureInterestCalculationStrategy.fromInt(this.preClosureInterestCalculationStrategy);
|
||||
public LoanPreCloseInterestCalculationStrategy getPreCloseInterestCalculationStrategy() {
|
||||
return LoanPreCloseInterestCalculationStrategy.fromInt(this.preCloseInterestCalculationStrategy);
|
||||
}
|
||||
|
||||
public Integer getRestFrequencyNthDay() {
|
||||
|
||||
+3
-3
@@ -49,7 +49,7 @@ import org.apache.fineract.portfolio.loanproduct.domain.AmortizationMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestCalculationPeriodMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestRecalculationCompoundingMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreClosureInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreCloseInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductValueConditionType;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanRescheduleStrategyMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.RecalculationFrequencyType;
|
||||
@@ -175,8 +175,8 @@ public class LoanDropdownReadPlatformServiceImpl implements LoanDropdownReadPlat
|
||||
@Override
|
||||
public List<EnumOptionData> retrievePreCloseInterestCalculationStrategyOptions() {
|
||||
|
||||
return Arrays.asList(preCloseInterestCalculationStrategy(LoanPreClosureInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE),
|
||||
preCloseInterestCalculationStrategy(LoanPreClosureInterestCalculationStrategy.TILL_REST_FREQUENCY_DATE));
|
||||
return Arrays.asList(preCloseInterestCalculationStrategy(LoanPreCloseInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE),
|
||||
preCloseInterestCalculationStrategy(LoanPreCloseInterestCalculationStrategy.TILL_REST_FREQUENCY_DATE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-7
@@ -33,7 +33,7 @@ import org.apache.fineract.portfolio.loanproduct.domain.AmortizationMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestCalculationPeriodMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestRecalculationCompoundingMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreClosureInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreCloseInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductParamType;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductValueConditionType;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanRescheduleStrategyMethod;
|
||||
@@ -522,19 +522,19 @@ public final class LoanEnumerations {
|
||||
}
|
||||
|
||||
public static EnumOptionData preCloseInterestCalculationStrategy(final int id) {
|
||||
return preCloseInterestCalculationStrategy(LoanPreClosureInterestCalculationStrategy.fromInt(id));
|
||||
return preCloseInterestCalculationStrategy(LoanPreCloseInterestCalculationStrategy.fromInt(id));
|
||||
}
|
||||
|
||||
public static EnumOptionData preCloseInterestCalculationStrategy(final LoanPreClosureInterestCalculationStrategy type) {
|
||||
public static EnumOptionData preCloseInterestCalculationStrategy(final LoanPreCloseInterestCalculationStrategy type) {
|
||||
EnumOptionData optionData = null;
|
||||
switch (type) {
|
||||
case TILL_PRE_CLOSURE_DATE:
|
||||
optionData = new EnumOptionData(LoanPreClosureInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE.getValue().longValue(),
|
||||
LoanPreClosureInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE.getCode(), "Till Pre-Close Date");
|
||||
optionData = new EnumOptionData(LoanPreCloseInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE.getValue().longValue(),
|
||||
LoanPreCloseInterestCalculationStrategy.TILL_PRE_CLOSURE_DATE.getCode(), "Till Pre-Close Date");
|
||||
break;
|
||||
case TILL_REST_FREQUENCY_DATE:
|
||||
optionData = new EnumOptionData(LoanPreClosureInterestCalculationStrategy.TILL_REST_FREQUENCY_DATE.getValue().longValue(),
|
||||
LoanPreClosureInterestCalculationStrategy.TILL_REST_FREQUENCY_DATE.getCode(), "Till Rest Frequency Date");
|
||||
optionData = new EnumOptionData(LoanPreCloseInterestCalculationStrategy.TILL_REST_FREQUENCY_DATE.getValue().longValue(),
|
||||
LoanPreCloseInterestCalculationStrategy.TILL_REST_FREQUENCY_DATE.getCode(), "Till Rest Frequency Date");
|
||||
break;
|
||||
case NONE:
|
||||
break;
|
||||
|
||||
+1
@@ -47,4 +47,5 @@
|
||||
<include relativeToChangelogFile="true" file="parts/1022_add_interest_refund_support.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/1023_add_charge_off_behaviour.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/1024_accrual_adjustment_transaction_type.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/1025_store_pre_closure_strategy_to_loan_level.xml"/>
|
||||
</databaseChangeLog>
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
-->
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
|
||||
|
||||
<changeSet author="fineract" id="1024-1">
|
||||
<addColumn tableName="m_loan_recalculation_details">
|
||||
<column defaultValueNumeric="1" name="pre_close_interest_calculation_strategy" type="SMALLINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</addColumn>
|
||||
<sql>
|
||||
UPDATE m_loan_recalculation_details SET pre_close_interest_calculation_strategy = 2 WHERE loan_id IN (
|
||||
SELECT ml.id FROM m_loan ml, m_product_loan_recalculation_details plrd WHERE plrd.product_id = ml.product_id AND plrd.pre_close_interest_calculation_strategy = 2
|
||||
)
|
||||
</sql>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
+4
-5
@@ -93,7 +93,7 @@ import org.apache.fineract.portfolio.loanproduct.domain.AllocationType;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.CreditAllocationTransactionType;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.DueType;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.FutureInstallmentAllocationRule;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreClosureInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreCloseInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRelatedDetail;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
@@ -1657,10 +1657,10 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep
|
||||
|
||||
private LocalDate calculateNewPayDateInCaseOfInAdvancePayment(LoanTransaction loanTransaction,
|
||||
LoanRepaymentScheduleInstallment inAdvanceInstallment) {
|
||||
LoanPreClosureInterestCalculationStrategy strategy = loanTransaction.getLoan().getLoanProduct()
|
||||
.preCloseInterestCalculationStrategy();
|
||||
LoanPreCloseInterestCalculationStrategy strategy = loanTransaction.getLoan().getLoanInterestRecalculationDetails()
|
||||
.getPreCloseInterestCalculationStrategy();
|
||||
|
||||
LocalDate payDate = switch (strategy) {
|
||||
return switch (strategy) {
|
||||
case TILL_PRE_CLOSURE_DATE -> loanTransaction.getTransactionDate();
|
||||
// TODO use isInPeriod
|
||||
case TILL_REST_FREQUENCY_DATE -> loanTransaction.getTransactionDate().isAfter(inAdvanceInstallment.getFromDate()) //
|
||||
@@ -1669,7 +1669,6 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep
|
||||
: loanTransaction.getTransactionDate(); //
|
||||
case NONE -> throw new IllegalStateException("Unexpected PreClosureInterestCalculationStrategy: NONE");
|
||||
};
|
||||
return payDate;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+2
-2
@@ -61,7 +61,7 @@ import org.apache.fineract.portfolio.loanproduct.domain.AmortizationMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestCalculationPeriodMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.InterestRecalculationCompoundingMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreClosureInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreCloseInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductPaymentAllocationRule;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductValueConditionType;
|
||||
@@ -1224,7 +1224,7 @@ public final class LoanProductDataValidator {
|
||||
.extractIntegerWithLocaleNamed(LoanProductConstants.preClosureInterestCalculationStrategyParamName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.preClosureInterestCalculationStrategyParamName)
|
||||
.value(preCloseInterestCalculationStrategy).ignoreIfNull().inMinMaxRange(
|
||||
LoanPreClosureInterestCalculationStrategy.getMinValue(), LoanPreClosureInterestCalculationStrategy.getMaxValue());
|
||||
LoanPreCloseInterestCalculationStrategy.getMinValue(), LoanPreCloseInterestCalculationStrategy.getMaxValue());
|
||||
}
|
||||
|
||||
public void validateForUpdate(final JsonCommand command, final LoanProduct loanProduct) {
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import static org.apache.fineract.portfolio.loanaccount.loanschedule.domain.Loan
|
||||
import static org.apache.fineract.portfolio.loanproduct.domain.AmortizationMethod.EQUAL_PRINCIPAL;
|
||||
import static org.apache.fineract.portfolio.loanproduct.domain.InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD;
|
||||
import static org.apache.fineract.portfolio.loanproduct.domain.InterestMethod.FLAT;
|
||||
import static org.apache.fineract.portfolio.loanproduct.domain.LoanPreClosureInterestCalculationStrategy.NONE;
|
||||
import static org.apache.fineract.portfolio.loanproduct.domain.LoanPreCloseInterestCalculationStrategy.NONE;
|
||||
import static org.apache.fineract.portfolio.loanproduct.domain.RepaymentStartDateType.DISBURSEMENT_DATE;
|
||||
import static org.apache.fineract.util.TimeZoneConstants.ASIA_MANILA_ID;
|
||||
import static org.apache.fineract.util.TimeZoneConstants.EUROPE_BERLIN_ID;
|
||||
|
||||
Reference in New Issue
Block a user