FINERACT-2107: Interest refund configuration
This commit is contained in:
+2
-4
@@ -4457,8 +4457,7 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
calendarHistoryDataWrapper, scheduleGeneratorDTO.getNumberOfdays(), scheduleGeneratorDTO.isSkipRepaymentOnFirstDayofMonth(),
|
||||
holidayDetailDTO, allowCompoundingOnEod, scheduleGeneratorDTO.isFirstRepaymentDateAllowedOnHoliday(),
|
||||
scheduleGeneratorDTO.isInterestToBeRecoveredFirstWhenGreaterThanEMI(), this.fixedPrincipalPercentagePerInstallment,
|
||||
scheduleGeneratorDTO.isPrincipalCompoundingDisabledForOverdueLoans(), repaymentStartDateType, getSubmittedOnDate(),
|
||||
loanProduct.getLoanProductRelatedDetail().isEnableAccrualActivityPosting());
|
||||
scheduleGeneratorDTO.isPrincipalCompoundingDisabledForOverdueLoans(), repaymentStartDateType, getSubmittedOnDate());
|
||||
}
|
||||
|
||||
public BigDecimal constructLoanTermVariations(FloatingRateDTO floatingRateDTO, BigDecimal annualNominalInterestRate,
|
||||
@@ -4706,8 +4705,7 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
compoundingCalendarInstance, compoundingFrequencyType, this.loanProduct.preCloseInterestCalculationStrategy(),
|
||||
rescheduleStrategyMethod, loanCalendar, getApprovedPrincipal(), annualNominalInterestRate, loanTermVariations,
|
||||
calendarHistoryDataWrapper, numberofdays, isSkipRepaymentonmonthFirst, holidayDetailDTO, allowCompoundingOnEod, false,
|
||||
false, this.fixedPrincipalPercentagePerInstallment, false, repaymentStartDateType, getSubmittedOnDate(),
|
||||
loanProduct.getLoanProductRelatedDetail().isEnableAccrualActivityPosting());
|
||||
false, this.fixedPrincipalPercentagePerInstallment, false, repaymentStartDateType, getSubmittedOnDate());
|
||||
}
|
||||
|
||||
public void updateRescheduledByUser(AppUser rescheduledByUser) {
|
||||
|
||||
+7
@@ -65,6 +65,7 @@ public enum LoanTransactionType {
|
||||
REAMORTIZE(30, "loanTransactionType.reAmortize"), //
|
||||
INTEREST_PAYMENT_WAIVER(31, "loanTransactionType.interestPaymentWaiver"), //
|
||||
ACCRUAL_ACTIVITY(32, "loanTransactionType.accrualActivity"), //
|
||||
INTEREST_REFUND(33, "loanTransactionType.interestRefund"), //
|
||||
;
|
||||
|
||||
private final Integer value;
|
||||
@@ -113,6 +114,7 @@ public enum LoanTransactionType {
|
||||
case 30 -> LoanTransactionType.REAMORTIZE;
|
||||
case 31 -> LoanTransactionType.INTEREST_PAYMENT_WAIVER;
|
||||
case 32 -> LoanTransactionType.ACCRUAL_ACTIVITY;
|
||||
case 33 -> LoanTransactionType.INTEREST_REFUND;
|
||||
default -> LoanTransactionType.INVALID;
|
||||
};
|
||||
}
|
||||
@@ -221,4 +223,9 @@ public enum LoanTransactionType {
|
||||
public boolean isAccrualActivity() {
|
||||
return this.equals(LoanTransactionType.ACCRUAL_ACTIVITY);
|
||||
}
|
||||
|
||||
public boolean isInterestRefund() {
|
||||
return this.equals(LoanTransactionType.INTEREST_REFUND);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+11
-7
@@ -53,6 +53,7 @@ import org.apache.fineract.portfolio.loanproduct.domain.InterestRecalculationCom
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanPreClosureInterestCalculationStrategy;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRelatedDetail;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanRescheduleStrategyMethod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanSupportedInterestRefundTypes;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.RecalculationFrequencyType;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.RepaymentStartDateType;
|
||||
|
||||
@@ -225,6 +226,7 @@ public final class LoanApplicationTerms {
|
||||
private final LoanScheduleType loanScheduleType;
|
||||
private final LoanScheduleProcessingType loanScheduleProcessingType;
|
||||
private final boolean enableAccrualActivityPosting;
|
||||
private final List<LoanSupportedInterestRefundTypes> supportedInterestRefundTypes;
|
||||
|
||||
public static LoanApplicationTerms assembleFrom(final ApplicationCurrency currency, final Integer loanTermFrequency,
|
||||
final PeriodFrequencyType loanTermPeriodFrequencyType, final Integer numberOfRepayments, final Integer repaymentEvery,
|
||||
@@ -253,7 +255,7 @@ public final class LoanApplicationTerms {
|
||||
final Boolean isAutoRepaymentForDownPaymentEnabled, final RepaymentStartDateType repaymentStartDateType,
|
||||
final LocalDate submittedOnDate, final LoanScheduleType loanScheduleType,
|
||||
final LoanScheduleProcessingType loanScheduleProcessingType, final Integer fixedLength,
|
||||
final boolean enableAccrualActivityPosting) {
|
||||
final boolean enableAccrualActivityPosting, final List<LoanSupportedInterestRefundTypes> supportedInterestRefundTypes) {
|
||||
|
||||
final LoanRescheduleStrategyMethod rescheduleStrategyMethod = null;
|
||||
final CalendarHistoryDataWrapper calendarHistoryDataWrapper = null;
|
||||
@@ -272,7 +274,7 @@ public final class LoanApplicationTerms {
|
||||
isInterestToBeRecoveredFirstWhenGreaterThanEMI, fixedPrincipalPercentagePerInstallment,
|
||||
isPrincipalCompoundingDisabledForOverdueLoans, enableDownPayment, disbursedAmountPercentageForDownPayment,
|
||||
isAutoRepaymentForDownPaymentEnabled, repaymentStartDateType, submittedOnDate, loanScheduleType, loanScheduleProcessingType,
|
||||
fixedLength, enableAccrualActivityPosting);
|
||||
fixedLength, enableAccrualActivityPosting, supportedInterestRefundTypes);
|
||||
|
||||
}
|
||||
|
||||
@@ -293,8 +295,7 @@ public final class LoanApplicationTerms {
|
||||
final boolean isSkipRepaymentOnFirstDayOfMonth, final HolidayDetailDTO holidayDetailDTO, final boolean allowCompoundingOnEod,
|
||||
final boolean isFirstRepaymentDateAllowedOnHoliday, final boolean isInterestToBeRecoveredFirstWhenGreaterThanEMI,
|
||||
final BigDecimal fixedPrincipalPercentagePerInstallment, final boolean isPrincipalCompoundingDisabledForOverdueLoans,
|
||||
final RepaymentStartDateType repaymentStartDateType, final LocalDate submittedOnDate,
|
||||
final boolean enableAccrualActivityPosting) {
|
||||
final RepaymentStartDateType repaymentStartDateType, final LocalDate submittedOnDate) {
|
||||
|
||||
final Integer numberOfRepayments = loanProductRelatedDetail.getNumberOfRepayments();
|
||||
final Integer repaymentEvery = loanProductRelatedDetail.getRepayEvery();
|
||||
@@ -346,7 +347,8 @@ public final class LoanApplicationTerms {
|
||||
isInterestToBeRecoveredFirstWhenGreaterThanEMI, fixedPrincipalPercentagePerInstallment,
|
||||
isPrincipalCompoundingDisabledForOverdueLoans, isDownPaymentEnabled, disbursedAmountPercentageForDownPayment,
|
||||
isAutoRepaymentForDownPaymentEnabled, repaymentStartDateType, submittedOnDate, loanScheduleType, loanScheduleProcessingType,
|
||||
fixedLength, enableAccrualActivityPosting);
|
||||
fixedLength, loanProductRelatedDetail.isEnableAccrualActivityPosting(),
|
||||
loanProductRelatedDetail.getSupportedInterestRefundTypes());
|
||||
}
|
||||
|
||||
private LoanApplicationTerms(final ApplicationCurrency currency, final Integer loanTermFrequency,
|
||||
@@ -375,7 +377,8 @@ public final class LoanApplicationTerms {
|
||||
final boolean isPrincipalCompoundingDisabledForOverdueLoans, final boolean isDownPaymentEnabled,
|
||||
final BigDecimal disbursedAmountPercentageForDownPayment, final boolean isAutoRepaymentForDownPaymentEnabled,
|
||||
final RepaymentStartDateType repaymentStartDateType, final LocalDate submittedOnDate, final LoanScheduleType loanScheduleType,
|
||||
final LoanScheduleProcessingType loanScheduleProcessingType, final Integer fixedLength, boolean enableAccrualActivityPosting) {
|
||||
final LoanScheduleProcessingType loanScheduleProcessingType, final Integer fixedLength, boolean enableAccrualActivityPosting,
|
||||
final List<LoanSupportedInterestRefundTypes> supportedInterestRefundTypes) {
|
||||
|
||||
this.currency = currency;
|
||||
this.loanTermFrequency = loanTermFrequency;
|
||||
@@ -473,6 +476,7 @@ public final class LoanApplicationTerms {
|
||||
this.loanScheduleType = loanScheduleType;
|
||||
this.loanScheduleProcessingType = loanScheduleProcessingType;
|
||||
this.fixedLength = fixedLength;
|
||||
this.supportedInterestRefundTypes = supportedInterestRefundTypes;
|
||||
}
|
||||
|
||||
public Money adjustPrincipalIfLastRepaymentPeriod(final Money principalForPeriod, final Money totalCumulativePrincipalToDate,
|
||||
@@ -1337,7 +1341,7 @@ public final class LoanApplicationTerms {
|
||||
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.loanScheduleProcessingType, this.fixedLength, this.enableAccrualActivityPosting, this.supportedInterestRefundTypes);
|
||||
}
|
||||
|
||||
public Integer getLoanTermFrequency() {
|
||||
|
||||
+1
@@ -165,5 +165,6 @@ public interface LoanProductConstants {
|
||||
String FIXED_LENGTH = "fixedLength";
|
||||
|
||||
String ENABLE_ACCRUAL_ACTIVITY_POSTING = "enableAccrualActivityPosting";
|
||||
String SUPPORTED_INTEREST_REFUND_TYPES = "supportedInterestRefundTypes";
|
||||
|
||||
}
|
||||
|
||||
+7
@@ -25,6 +25,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
|
||||
import org.apache.fineract.portfolio.delinquency.api.DelinquencyApiResourceSwagger.GetDelinquencyBucketsResponse;
|
||||
|
||||
/**
|
||||
@@ -318,6 +319,7 @@ final class LoanProductsApiResourceSwagger {
|
||||
public boolean active;
|
||||
}
|
||||
|
||||
public List<String> supportedInterestRefundTypes;
|
||||
}
|
||||
|
||||
@Schema(description = "PostLoanProductsResponse")
|
||||
@@ -600,6 +602,7 @@ final class LoanProductsApiResourceSwagger {
|
||||
@Schema(example = "0")
|
||||
public Integer principalThresholdForLastInstalment;
|
||||
public GetLoanProductsResponse.GetLoanProductsRepaymentStartDateType repaymentStartDateType;
|
||||
public List<StringEnumOptionData> supportedInterestRefundTypes;
|
||||
}
|
||||
|
||||
@Schema(description = "GetLoanProductsTemplateResponse")
|
||||
@@ -1063,6 +1066,8 @@ final class LoanProductsApiResourceSwagger {
|
||||
public List<EnumOptionData> creditAllocationAllocationTypes;
|
||||
public List<EnumOptionData> creditAllocationTransactionTypes;
|
||||
|
||||
public List<StringEnumOptionData> supportedInterestRefundTypes;
|
||||
public List<StringEnumOptionData> supportedInterestRefundTypesOptions;
|
||||
}
|
||||
|
||||
@Schema(description = "GetLoanProductsProductIdResponse")
|
||||
@@ -1336,6 +1341,7 @@ final class LoanProductsApiResourceSwagger {
|
||||
public EnumOptionData loanScheduleProcessingType;
|
||||
@Schema(example = "false")
|
||||
public Boolean enableAccrualActivityPosting;
|
||||
public List<StringEnumOptionData> supportedInterestRefundTypes;
|
||||
}
|
||||
|
||||
@Schema(description = "PutLoanProductsProductIdRequest")
|
||||
@@ -1627,6 +1633,7 @@ final class LoanProductsApiResourceSwagger {
|
||||
public boolean active;
|
||||
}
|
||||
|
||||
public List<String> supportedInterestRefundTypes;
|
||||
}
|
||||
|
||||
public static final class AdvancedPaymentData {
|
||||
|
||||
+18
-6
@@ -33,6 +33,7 @@ import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.data.PaymentTypeToGLAccountMapper;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
import org.apache.fineract.portfolio.calendar.data.CalendarData;
|
||||
import org.apache.fineract.portfolio.charge.data.ChargeData;
|
||||
@@ -134,6 +135,7 @@ public class LoanProductData implements Serializable {
|
||||
private final boolean canDefineInstallmentAmount;
|
||||
private final Integer installmentAmountInMultiplesOf;
|
||||
private final EnumOptionData repaymentStartDateType;
|
||||
private final List<StringEnumOptionData> supportedInterestRefundTypes;
|
||||
|
||||
// charges
|
||||
private final Collection<ChargeData> charges;
|
||||
@@ -190,6 +192,7 @@ public class LoanProductData implements Serializable {
|
||||
private final List<EnumOptionData> interestRecalculationFrequencyTypeOptions;
|
||||
private final List<FloatingRateData> floatingRateOptions;
|
||||
private final List<EnumOptionData> repaymentStartDateTypeOptions;
|
||||
private final List<StringEnumOptionData> supportedInterestRefundTypesOptions;
|
||||
|
||||
private final Boolean multiDisburseLoan;
|
||||
private final Integer maxTrancheCount;
|
||||
@@ -325,6 +328,7 @@ public class LoanProductData implements Serializable {
|
||||
final EnumOptionData loanScheduleTypeOptions = null;
|
||||
final EnumOptionData loanScheduleProcessingTypeOptions = null;
|
||||
final boolean enableAccrualActivityPosting = false;
|
||||
final List<StringEnumOptionData> supportedInterestRefundTypes = null;
|
||||
|
||||
return new LoanProductData(id, name, shortName, description, currency, principal, minPrincipal, maxPrincipal, tolerance,
|
||||
numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod,
|
||||
@@ -345,7 +349,7 @@ public class LoanProductData implements Serializable {
|
||||
fixedPrincipalPercentagePerInstallment, delinquencyBucketOptions, delinquencyBucket, dueDaysForRepaymentEvent,
|
||||
overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, enableAutoRepaymentForDownPayment,
|
||||
paymentAllocation, creditAllocation, repaymentStartDateType, enableInstallmentLevelDelinquency, loanScheduleType,
|
||||
loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting);
|
||||
loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting, supportedInterestRefundTypes);
|
||||
|
||||
}
|
||||
|
||||
@@ -446,6 +450,7 @@ public class LoanProductData implements Serializable {
|
||||
final EnumOptionData loanScheduleType = null;
|
||||
final EnumOptionData loanScheduleProcessingType = null;
|
||||
final boolean enableAccrualActivityPosting = false;
|
||||
final List<StringEnumOptionData> supportedInterestRefundTypes = null;
|
||||
|
||||
return new LoanProductData(id, name, shortName, description, currency, principal, minPrincipal, maxPrincipal, tolerance,
|
||||
numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod,
|
||||
@@ -466,7 +471,7 @@ public class LoanProductData implements Serializable {
|
||||
fixedPrincipalPercentagePerInstallment, delinquencyBucketOptions, delinquencyBucket, dueDaysForRepaymentEvent,
|
||||
overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, enableAutoRepaymentForDownPayment,
|
||||
paymentAllocation, creditAllocation, repaymentStartDateType, enableInstallmentLevelDelinquency, loanScheduleType,
|
||||
loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting);
|
||||
loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting, supportedInterestRefundTypes);
|
||||
|
||||
}
|
||||
|
||||
@@ -574,6 +579,7 @@ public class LoanProductData implements Serializable {
|
||||
final EnumOptionData loanScheduleType = LoanScheduleType.CUMULATIVE.asEnumOptionData();
|
||||
final EnumOptionData loanScheduleProcessingType = LoanScheduleProcessingType.HORIZONTAL.asEnumOptionData();
|
||||
final boolean enableAccrualActivityPosting = false;
|
||||
final List<StringEnumOptionData> supportedInterestRefundTypes = null;
|
||||
|
||||
return new LoanProductData(id, name, shortName, description, currency, principal, minPrincipal, maxPrincipal, tolerance,
|
||||
numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod,
|
||||
@@ -594,7 +600,7 @@ public class LoanProductData implements Serializable {
|
||||
fixedPrincipalPercentagePerInstallment, delinquencyBucketOptions, delinquencyBucket, dueDaysForRepaymentEvent,
|
||||
overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, enableAutoRepaymentForDownPayment,
|
||||
paymentAllocation, creditAllocation, repaymentStartDateType, enableInstallmentLevelDelinquency, loanScheduleType,
|
||||
loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting);
|
||||
loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting, supportedInterestRefundTypes);
|
||||
|
||||
}
|
||||
|
||||
@@ -696,6 +702,7 @@ public class LoanProductData implements Serializable {
|
||||
final EnumOptionData loanScheduleType = null;
|
||||
final EnumOptionData loanScheduleProcessingType = null;
|
||||
final boolean enableAccrualActivityPosting = false;
|
||||
final List<StringEnumOptionData> supportedInterestRefundTypes = null;
|
||||
|
||||
return new LoanProductData(id, name, shortName, description, currency, principal, minPrincipal, maxPrincipal, tolerance,
|
||||
numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod,
|
||||
@@ -716,7 +723,7 @@ public class LoanProductData implements Serializable {
|
||||
fixedPrincipalPercentagePerInstallment, delinquencyBucketOptions, delinquencyBucket, dueDaysForRepaymentEvent,
|
||||
overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, enableAutoRepaymentForDownPayment,
|
||||
paymentAllocation, creditAllocationData, repaymentStartDateType, enableInstallmentLevelDelinquency, loanScheduleType,
|
||||
loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting);
|
||||
loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting, supportedInterestRefundTypes);
|
||||
}
|
||||
|
||||
public static LoanProductData withAccountingDetails(final LoanProductData productData, final Map<String, Object> accountingMappings,
|
||||
@@ -767,7 +774,7 @@ public class LoanProductData implements Serializable {
|
||||
final Collection<AdvancedPaymentData> paymentAllocation, final Collection<CreditAllocationData> creditAllocation,
|
||||
final EnumOptionData repaymentStartDateType, final boolean enableInstallmentLevelDelinquency,
|
||||
final EnumOptionData loanScheduleType, final EnumOptionData loanScheduleProcessingType, final Integer fixedLength,
|
||||
final boolean enableAccrualActivityPosting) {
|
||||
final boolean enableAccrualActivityPosting, final List<StringEnumOptionData> supportedInterestRefundTypes) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.shortName = shortName;
|
||||
@@ -904,6 +911,8 @@ public class LoanProductData implements Serializable {
|
||||
this.loanScheduleTypeOptions = null;
|
||||
this.loanScheduleProcessingTypeOptions = null;
|
||||
this.enableAccrualActivityPosting = enableAccrualActivityPosting;
|
||||
this.supportedInterestRefundTypes = supportedInterestRefundTypes;
|
||||
this.supportedInterestRefundTypesOptions = null;
|
||||
}
|
||||
|
||||
public LoanProductData(final LoanProductData productData, final Collection<ChargeData> chargeOptions,
|
||||
@@ -925,7 +934,8 @@ public class LoanProductData implements Serializable {
|
||||
final List<EnumOptionData> advancedPaymentAllocationFutureInstallmentAllocationRules,
|
||||
final List<EnumOptionData> advancedPaymentAllocationTypes, final List<EnumOptionData> loanScheduleTypeOptions,
|
||||
final List<EnumOptionData> loanScheduleProcessingTypeOptions, final List<EnumOptionData> creditAllocationTransactionTypes,
|
||||
final List<EnumOptionData> creditAllocationAllocationTypes) {
|
||||
final List<EnumOptionData> creditAllocationAllocationTypes,
|
||||
final List<StringEnumOptionData> supportedInterestRefundTypesOptions) {
|
||||
|
||||
this.id = productData.id;
|
||||
this.name = productData.name;
|
||||
@@ -1080,6 +1090,8 @@ public class LoanProductData implements Serializable {
|
||||
this.loanScheduleProcessingTypeOptions = loanScheduleProcessingTypeOptions;
|
||||
this.loanScheduleTypeOptions = loanScheduleTypeOptions;
|
||||
this.enableAccrualActivityPosting = productData.enableAccrualActivityPosting;
|
||||
this.supportedInterestRefundTypesOptions = supportedInterestRefundTypesOptions;
|
||||
this.supportedInterestRefundTypes = productData.supportedInterestRefundTypes;
|
||||
}
|
||||
|
||||
private Collection<ChargeData> nullIfEmpty(final Collection<ChargeData> charges) {
|
||||
|
||||
+13
-3
@@ -442,6 +442,15 @@ public class LoanProduct extends AbstractPersistableCustom<Long> {
|
||||
final boolean enableAccrualActivityPosting = command
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.ENABLE_ACCRUAL_ACTIVITY_POSTING);
|
||||
|
||||
List<LoanSupportedInterestRefundTypes> supportedInterestRefundTypes = new ArrayList<>();
|
||||
if (command.parameterExists(LoanProductConstants.SUPPORTED_INTEREST_REFUND_TYPES)) {
|
||||
JsonArray supportedTransactionsForInterestRefund = command
|
||||
.arrayOfParameterNamed(LoanProductConstants.SUPPORTED_INTEREST_REFUND_TYPES);
|
||||
supportedTransactionsForInterestRefund.iterator().forEachRemaining(value -> {
|
||||
supportedInterestRefundTypes.add(LoanSupportedInterestRefundTypes.valueOf(value.getAsString()));
|
||||
});
|
||||
}
|
||||
|
||||
return new LoanProduct(fund, loanTransactionProcessingStrategy, loanProductPaymentAllocationRules, loanProductCreditAllocationRules,
|
||||
name, shortName, description, currency, principal, minPrincipal, maxPrincipal, interestRatePerPeriod,
|
||||
minInterestRatePerPeriod, maxInterestRatePerPeriod, interestFrequencyType, annualInterestRate, interestMethod,
|
||||
@@ -461,7 +470,7 @@ public class LoanProduct extends AbstractPersistableCustom<Long> {
|
||||
allowApprovedDisbursedAmountsOverApplied, overAppliedCalculationType, overAppliedNumber, dueDaysForRepaymentEvent,
|
||||
overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, enableAutoRepaymentForDownPayment,
|
||||
repaymentStartDateType, enableInstallmentLevelDelinquency, loanScheduleType, loanScheduleProcessingType, fixedLength,
|
||||
enableAccrualActivityPosting);
|
||||
enableAccrualActivityPosting, supportedInterestRefundTypes);
|
||||
|
||||
}
|
||||
|
||||
@@ -679,7 +688,7 @@ public class LoanProduct extends AbstractPersistableCustom<Long> {
|
||||
final boolean enableAutoRepaymentForDownPayment, final RepaymentStartDateType repaymentStartDateType,
|
||||
final boolean enableInstallmentLevelDelinquency, final LoanScheduleType loanScheduleType,
|
||||
final LoanScheduleProcessingType loanScheduleProcessingType, final Integer fixedLength,
|
||||
final boolean enableAccrualActivityPosting) {
|
||||
final boolean enableAccrualActivityPosting, final List<LoanSupportedInterestRefundTypes> supportedInterestRefundTypes) {
|
||||
this.fund = fund;
|
||||
this.transactionProcessingStrategyCode = transactionProcessingStrategyCode;
|
||||
|
||||
@@ -728,7 +737,8 @@ public class LoanProduct extends AbstractPersistableCustom<Long> {
|
||||
recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment, graceOnInterestCharged, amortizationMethod,
|
||||
inArrearsTolerance, graceOnArrearsAgeing, daysInMonthType.getValue(), daysInYearType.getValue(),
|
||||
isInterestRecalculationEnabled, isEqualAmortization, enableDownPayment, disbursedAmountPercentageForDownPayment,
|
||||
enableAutoRepaymentForDownPayment, loanScheduleType, loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting);
|
||||
enableAutoRepaymentForDownPayment, loanScheduleType, loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting,
|
||||
supportedInterestRefundTypes);
|
||||
|
||||
this.loanProductMinMaxConstraints = new LoanProductMinMaxConstraints(defaultMinPrincipal, defaultMaxPrincipal,
|
||||
defaultMinNominalInterestRatePerPeriod, defaultMaxNominalInterestRatePerPeriod, defaultMinNumberOfInstallments,
|
||||
|
||||
+10
-3
@@ -19,12 +19,14 @@
|
||||
package org.apache.fineract.portfolio.loanproduct.domain;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Convert;
|
||||
import jakarta.persistence.Embeddable;
|
||||
import jakarta.persistence.Embedded;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -153,6 +155,10 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
@Column(name = "enable_accrual_activity_posting", nullable = false)
|
||||
private boolean enableAccrualActivityPosting = false;
|
||||
|
||||
@Convert(converter = SupportedInterestRefundTypesListConverter.class)
|
||||
@Column(name = "supported_interest_refund_types")
|
||||
private List<LoanSupportedInterestRefundTypes> supportedInterestRefundTypes = List.of();
|
||||
|
||||
public static LoanProductRelatedDetail createFrom(final MonetaryCurrency currency, final BigDecimal principal,
|
||||
final BigDecimal nominalInterestRatePerPeriod, final PeriodFrequencyType interestRatePeriodFrequencyType,
|
||||
final BigDecimal nominalAnnualInterestRate, final InterestMethod interestMethod,
|
||||
@@ -165,7 +171,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
final boolean enableDownPayment, final BigDecimal disbursedAmountPercentageForDownPayment,
|
||||
final boolean enableAutoRepaymentForDownPayment, final LoanScheduleType loanScheduleType,
|
||||
final LoanScheduleProcessingType loanScheduleProcessingType, final Integer fixedLength,
|
||||
final boolean enableAccrualActivityPosting) {
|
||||
final boolean enableAccrualActivityPosting, final List<LoanSupportedInterestRefundTypes> supportedInterestRefundTypes) {
|
||||
|
||||
return new LoanProductRelatedDetail(currency, principal, nominalInterestRatePerPeriod, interestRatePeriodFrequencyType,
|
||||
nominalAnnualInterestRate, interestMethod, interestCalculationPeriodMethod, allowPartialPeriodInterestCalcualtion,
|
||||
@@ -173,7 +179,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment, graceOnInterestCharged, amortizationMethod,
|
||||
inArrearsTolerance, graceOnArrearsAgeing, daysInMonthType, daysInYearType, isInterestRecalculationEnabled,
|
||||
isEqualAmortization, enableDownPayment, disbursedAmountPercentageForDownPayment, enableAutoRepaymentForDownPayment,
|
||||
loanScheduleType, loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting);
|
||||
loanScheduleType, loanScheduleProcessingType, fixedLength, enableAccrualActivityPosting, supportedInterestRefundTypes);
|
||||
}
|
||||
|
||||
protected LoanProductRelatedDetail() {
|
||||
@@ -192,7 +198,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
final boolean enableDownPayment, final BigDecimal disbursedAmountPercentageForDownPayment,
|
||||
final boolean enableAutoRepaymentForDownPayment, final LoanScheduleType loanScheduleType,
|
||||
final LoanScheduleProcessingType loanScheduleProcessingType, final Integer fixedLength,
|
||||
final boolean enableAccrualActivityPosting) {
|
||||
final boolean enableAccrualActivityPosting, List<LoanSupportedInterestRefundTypes> supportedInterestRefundTypes) {
|
||||
this.currency = currency;
|
||||
this.principal = defaultPrincipal;
|
||||
this.nominalInterestRatePerPeriod = defaultNominalInterestRatePerPeriod;
|
||||
@@ -226,6 +232,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
this.loanScheduleType = loanScheduleType;
|
||||
this.loanScheduleProcessingType = loanScheduleProcessingType;
|
||||
this.enableAccrualActivityPosting = enableAccrualActivityPosting;
|
||||
this.supportedInterestRefundTypes = supportedInterestRefundTypes;
|
||||
}
|
||||
|
||||
private Integer defaultToNullIfZero(final Integer value) {
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.fineract.portfolio.loanproduct.domain;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum LoanSupportedInterestRefundTypes {
|
||||
|
||||
MERCHANT_ISSUED_REFUND(LoanTransactionType.MERCHANT_ISSUED_REFUND, "loanRefundType.merchant_issued_refund", "Merchant issued refund"), //
|
||||
PAYOUT_REFUND(LoanTransactionType.PAYOUT_REFUND, "loanRefundType.payout_refund", "Payout refund"), //
|
||||
;
|
||||
|
||||
private final LoanTransactionType transactionType;
|
||||
private final String code;
|
||||
private final String humanReadableName;
|
||||
|
||||
public static List<StringEnumOptionData> getValuesAsStringEnumOptionDataList() {
|
||||
return Arrays.stream(values()).map(v -> new StringEnumOptionData(v.name(), v.getCode(), v.getHumanReadableName())).toList();
|
||||
}
|
||||
|
||||
public StringEnumOptionData getValueAsStringEnumOptionData() {
|
||||
return new StringEnumOptionData(name(), getCode(), getHumanReadableName());
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -41,7 +41,8 @@ public enum PaymentAllocationTransactionType {
|
||||
WAIVE_INTEREST(LoanTransactionType.WAIVE_INTEREST, "Waive interest"), //
|
||||
CHARGE_PAYMENT(LoanTransactionType.CHARGE_PAYMENT, "Charge payment"), //
|
||||
REFUND_FOR_ACTIVE_LOAN(LoanTransactionType.REFUND_FOR_ACTIVE_LOAN, "Refund for active loan"), //
|
||||
INTEREST_PAYMENT_WAIVER(LoanTransactionType.INTEREST_PAYMENT_WAIVER, "Interest payment waiver");
|
||||
INTEREST_PAYMENT_WAIVER(LoanTransactionType.INTEREST_PAYMENT_WAIVER, "Interest payment waiver"), //
|
||||
INTEREST_REFUND(LoanTransactionType.INTEREST_REFUND, "Interest refund");
|
||||
|
||||
private final LoanTransactionType loanTransactionType;
|
||||
private final String humanReadableName;
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.fineract.portfolio.loanproduct.domain;
|
||||
|
||||
// TODO FINERACT-1932-Fineract modularization: Move to fineract-progressive-loan module after refactor of Loan and LoanProduct classes
|
||||
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import jakarta.persistence.Converter;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.data.GenericEnumListConverter;
|
||||
|
||||
@Converter(autoApply = true)
|
||||
public class SupportedInterestRefundTypesListConverter extends GenericEnumListConverter<LoanSupportedInterestRefundTypes>
|
||||
implements AttributeConverter<List<LoanSupportedInterestRefundTypes>, String> {
|
||||
|
||||
@Override
|
||||
public boolean isUnique() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public SupportedInterestRefundTypesListConverter() {
|
||||
super(LoanSupportedInterestRefundTypes.class);
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -321,6 +321,8 @@ public final class LoanEnumerations {
|
||||
LoanTransactionType.REAMORTIZE.getCode(), "Re-amortize");
|
||||
case ACCRUAL_ACTIVITY -> new LoanTransactionEnumData(LoanTransactionType.ACCRUAL_ACTIVITY.getValue().longValue(),
|
||||
LoanTransactionType.ACCRUAL_ACTIVITY.getCode(), "Accrual Activity");
|
||||
case INTEREST_REFUND -> new LoanTransactionEnumData(LoanTransactionType.INTEREST_REFUND.getValue().longValue(),
|
||||
LoanTransactionType.INTEREST_REFUND.getCode(), "Interest Refund");
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -44,4 +44,5 @@
|
||||
<include relativeToChangelogFile="true" file="parts/1019_add_fixed_length.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/1020_add_re_aged_flag_to_loan_installment.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/1021_add_loan_status_change_history.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/1022_add_interest_refund_support.xml"/>
|
||||
</databaseChangeLog>
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?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="1022-1">
|
||||
<addColumn tableName="m_product_loan">
|
||||
<column name="supported_interest_refund_types" type="TEXT"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
<changeSet author="fineract" id="1022-2">
|
||||
<addColumn tableName="m_loan">
|
||||
<column name="supported_interest_refund_types" type="TEXT"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
Reference in New Issue
Block a user