FINERACT-1968: Enhance Loan product template with advanced payment allocation

This commit is contained in:
Adam Saghy
2023-09-08 14:45:44 +02:00
parent c04f435b1a
commit 4b02527561
8 changed files with 193 additions and 32 deletions
@@ -79,6 +79,9 @@ import org.apache.fineract.portfolio.loanaccount.api.LoanApiConstants;
import org.apache.fineract.portfolio.loanproduct.LoanProductConstants;
import org.apache.fineract.portfolio.loanproduct.data.LoanProductData;
import org.apache.fineract.portfolio.loanproduct.data.TransactionProcessingStrategyData;
import org.apache.fineract.portfolio.loanproduct.domain.FutureInstallmentAllocationRule;
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationTransactionType;
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
import org.apache.fineract.portfolio.loanproduct.exception.LoanProductNotFoundException;
import org.apache.fineract.portfolio.loanproduct.productmix.data.ProductMixData;
import org.apache.fineract.portfolio.loanproduct.productmix.service.ProductMixReadPlatformService;
@@ -407,6 +410,11 @@ public class LoanProductsApiResource {
.retrievePreCloseInterestCalculationStrategyOptions();
final List<FloatingRateData> floatingRateOptions = this.floatingRateReadPlatformService.retrieveLookupActive();
final List<EnumOptionData> repaymentStartDateTypeOptions = dropdownReadPlatformService.retrieveRepaymentStartDateTypeOptions();
final List<EnumOptionData> advancedPaymentAllocationTransactionTypes = PaymentAllocationTransactionType
.getValuesAsEnumOptionDataList();
final List<EnumOptionData> advancedPaymentAllocationFutureInstallmentAllocationRules = FutureInstallmentAllocationRule
.getValuesAsEnumOptionDataList();
final List<EnumOptionData> advancedPaymentAllocationTypes = PaymentAllocationType.getValuesAsEnumOptionDataList();
return new LoanProductData(productData, chargeOptions, penaltyOptions, paymentTypeOptions, currencyOptions, amortizationTypeOptions,
interestTypeOptions, interestCalculationPeriodTypeOptions, repaymentFrequencyTypeOptions, interestRateFrequencyTypeOptions,
@@ -414,7 +422,9 @@ public class LoanProductsApiResource {
loanCycleValueConditionTypeOptions, daysInMonthTypeOptions, daysInYearTypeOptions,
interestRecalculationCompoundingTypeOptions, rescheduleStrategyTypeOptions, interestRecalculationFrequencyTypeOptions,
preCloseInterestCalculationStrategyOptions, floatingRateOptions, interestRecalculationNthDayTypeOptions,
interestRecalculationDayOfWeekTypeOptions, isRatesEnabled, delinquencyBucketOptions, repaymentStartDateTypeOptions);
interestRecalculationDayOfWeekTypeOptions, isRatesEnabled, delinquencyBucketOptions, repaymentStartDateTypeOptions,
advancedPaymentAllocationTransactionTypes, advancedPaymentAllocationFutureInstallmentAllocationRules,
advancedPaymentAllocationTypes);
}
}
@@ -813,7 +813,7 @@ final class LoanProductsApiResourceSwagger {
public Boolean penalty;
public GetLoanProductsCurrencyOptions currency;
@Schema(example = "100")
public Long amount;
public BigDecimal amount;
public GetLoanChargeTimeType chargeTimeType;
public GetLoanProductsChargeAppliesTo chargeAppliesTo;
public GetLoanChargeCalculationType chargeCalculationType;
@@ -865,7 +865,7 @@ final class LoanProductsApiResourceSwagger {
@Schema(example = "over payment")
public String name;
@Schema(example = "13")
public Integer glCode;
public String glCode;
@Schema(example = "false")
public Boolean disabled;
@Schema(example = "true")
@@ -888,7 +888,7 @@ final class LoanProductsApiResourceSwagger {
@Schema(example = "Loan portfolio")
public String name;
@Schema(example = "02")
public Integer glCode;
public String glCode;
@Schema(example = "false")
public Boolean disabled;
@Schema(example = "true")
@@ -923,7 +923,7 @@ final class LoanProductsApiResourceSwagger {
@Schema(example = "loans written off 2")
public String name;
@Schema(example = "12")
public Integer glCode;
public String glCode;
@Schema(example = "false")
public Boolean disabled;
@Schema(example = "true")
@@ -958,7 +958,7 @@ final class LoanProductsApiResourceSwagger {
@Schema(example = "income from interest")
public String name;
@Schema(example = "04")
public Integer glCode;
public String glCode;
@Schema(example = "false")
public Boolean disabled;
@Schema(example = "true")
@@ -1031,6 +1031,9 @@ final class LoanProductsApiResourceSwagger {
public Set<GetLoanProductsResponse.GetLoanProductsInterestRecalculationData.GetLoanProductsRescheduleStrategyType> rescheduleStrategyTypeOptions;
public Set<GetLoanProductsResponse.GetLoanProductsInterestRecalculationData.GetLoanProductsInterestRecalculationCompoundingFrequencyType> interestRecalculationFrequencyTypeOptions;
public Set<GetLoanProductsResponse.GetLoanProductsRepaymentStartDateType> repaymentStartDateTypeOptions;
public List<EnumOptionData> advancedPaymentAllocationTransactionTypes;
public List<EnumOptionData> advancedPaymentAllocationFutureInstallmentAllocationRules;
public List<EnumOptionData> advancedPaymentAllocationTypes;
}
@Schema(description = "GetLoanProductsProductIdResponse")
@@ -167,6 +167,9 @@ public class LoanProductData implements Serializable {
private final List<EnumOptionData> interestRecalculationDayOfWeekTypeOptions;
private final List<EnumOptionData> rescheduleStrategyTypeOptions;
private final List<EnumOptionData> preClosureInterestCalculationStrategyOptions;
private final List<EnumOptionData> advancedPaymentAllocationTransactionTypes;
private final List<EnumOptionData> advancedPaymentAllocationFutureInstallmentAllocationRules;
private final List<EnumOptionData> advancedPaymentAllocationTypes;
private final List<EnumOptionData> interestRecalculationFrequencyTypeOptions;
private final List<FloatingRateData> floatingRateOptions;
@@ -835,6 +838,9 @@ public class LoanProductData implements Serializable {
this.enableAutoRepaymentForDownPayment = enableAutoRepaymentForDownPayment;
this.repaymentStartDateType = repaymentStartDateType;
this.repaymentStartDateTypeOptions = null;
this.advancedPaymentAllocationTransactionTypes = null;
this.advancedPaymentAllocationFutureInstallmentAllocationRules = null;
this.advancedPaymentAllocationTypes = null;
}
public LoanProductData(final LoanProductData productData, final Collection<ChargeData> chargeOptions,
@@ -851,7 +857,10 @@ public class LoanProductData implements Serializable {
final List<EnumOptionData> preCloseInterestCalculationStrategyOptions, final List<FloatingRateData> floatingRateOptions,
final List<EnumOptionData> interestRecalculationNthDayTypeOptions,
final List<EnumOptionData> interestRecalculationDayOfWeekTypeOptions, final boolean isRatesEnabled,
final Collection<DelinquencyBucketData> delinquencyBucketOptions, final List<EnumOptionData> repaymentStartDateTypeOptions) {
final Collection<DelinquencyBucketData> delinquencyBucketOptions, final List<EnumOptionData> repaymentStartDateTypeOptions,
final List<EnumOptionData> advancedPaymentAllocationTransactionTypes,
final List<EnumOptionData> advancedPaymentAllocationFutureInstallmentAllocationRules,
final List<EnumOptionData> advancedPaymentAllocationTypes) {
this.id = productData.id;
this.name = productData.name;
this.shortName = productData.shortName;
@@ -992,6 +1001,9 @@ public class LoanProductData implements Serializable {
this.paymentAllocation = productData.paymentAllocation;
this.repaymentStartDateType = productData.repaymentStartDateType;
this.repaymentStartDateTypeOptions = repaymentStartDateTypeOptions;
this.advancedPaymentAllocationTransactionTypes = advancedPaymentAllocationTransactionTypes;
this.advancedPaymentAllocationFutureInstallmentAllocationRules = advancedPaymentAllocationFutureInstallmentAllocationRules;
this.advancedPaymentAllocationTypes = advancedPaymentAllocationTypes;
}
private Collection<ChargeData> nullIfEmpty(final Collection<ChargeData> charges) {