From b01ccc461986fa9cc78152f4eb6c8bea3c2db304 Mon Sep 17 00:00:00 2001 From: Peter Bagrij Date: Thu, 25 Jan 2024 12:18:00 +0100 Subject: [PATCH] FINERACT-2042 Configurable Allocation Rules for Chargeback Transaction. PR 1 of 3 - Persistence Layer --- .../portfolio/loanaccount/domain/Loan.java | 11 ++ .../domain/LoanCreditAllocationRule.java | 62 ++++++++ .../domain/LoanPaymentAllocationRule.java | 4 +- .../domain/AllocationTypeListConverter.java | 6 +- .../CreditAllocationTransactionType.java | 40 ++++++ .../loanproduct/domain/LoanProduct.java | 47 +++--- .../LoanProductCreditAllocationRule.java | 59 ++++++++ .../LoanProductPaymentAllocationRule.java | 2 +- .../PaymentAllocationTypeListConverter.java | 39 +++++ .../module/loan/module-changelog-master.xml | 1 + .../parts/1016_add_credit_allocation_rule.xml | 135 ++++++++++++++++++ ...WritePlatformServiceJpaRepositoryImpl.java | 8 +- .../src/main/resources/jpa/persistence.xml | 4 + 13 files changed, 390 insertions(+), 28 deletions(-) create mode 100644 fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCreditAllocationRule.java create mode 100644 fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/CreditAllocationTransactionType.java create mode 100644 fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductCreditAllocationRule.java create mode 100644 fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/PaymentAllocationTypeListConverter.java create mode 100644 fineract-loan/src/main/resources/db/changelog/tenant/module/loan/parts/1016_add_credit_allocation_rule.xml diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java index 0235c8b6b..3e1ab126f 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java @@ -243,6 +243,9 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom { @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = true, fetch = FetchType.LAZY) private List paymentAllocationRules = new ArrayList<>(); + @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = true, fetch = FetchType.LAZY) + private List creditAllocationRules = new ArrayList<>(); + @Embedded private LoanProductRelatedDetail loanRepaymentScheduleDetail; @@ -7183,6 +7186,14 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom { this.paymentAllocationRules = loanPaymentAllocationRules; } + public List getCreditAllocationRules() { + return creditAllocationRules; + } + + public void setCreditAllocationRules(List loanCreditAllocationRules) { + this.creditAllocationRules = loanCreditAllocationRules; + } + public String getTransactionProcessingStrategyCode() { return transactionProcessingStrategyCode; } diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCreditAllocationRule.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCreditAllocationRule.java new file mode 100644 index 000000000..490dacadf --- /dev/null +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCreditAllocationRule.java @@ -0,0 +1,62 @@ +/** + * 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.loanaccount.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.Convert; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import jakarta.persistence.UniqueConstraint; +import java.util.List; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom; +import org.apache.fineract.portfolio.loanproduct.domain.AllocationType; +import org.apache.fineract.portfolio.loanproduct.domain.AllocationTypeListConverter; +import org.apache.fineract.portfolio.loanproduct.domain.CreditAllocationTransactionType; + +@Getter +@Setter +@Entity +@Table(name = "m_loan_credit_allocation_rule", uniqueConstraints = { + @UniqueConstraint(columnNames = { "loan_id", "transaction_type" }, name = "uq_m_loan_credit_allocation_rule") }) +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class LoanCreditAllocationRule extends AbstractAuditableWithUTCDateTimeCustom { + + @ManyToOne + @JoinColumn(name = "loan_id", nullable = false) + private Loan loan; + + @Column(name = "transaction_type", nullable = false) + @Enumerated(EnumType.STRING) + private CreditAllocationTransactionType transactionType; + + @Convert(converter = AllocationTypeListConverter.class) + @Column(name = "allocation_types", nullable = false) + private List allocationTypes; + +} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanPaymentAllocationRule.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanPaymentAllocationRule.java index ce1bc7486..8304b5019 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanPaymentAllocationRule.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanPaymentAllocationRule.java @@ -34,10 +34,10 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom; -import org.apache.fineract.portfolio.loanproduct.domain.AllocationTypeListConverter; 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.domain.PaymentAllocationTypeListConverter; @Getter @Setter @@ -56,7 +56,7 @@ public class LoanPaymentAllocationRule extends AbstractAuditableWithUTCDateTimeC @Enumerated(EnumType.STRING) private PaymentAllocationTransactionType transactionType; - @Convert(converter = AllocationTypeListConverter.class) + @Convert(converter = PaymentAllocationTypeListConverter.class) @Column(name = "allocation_types", nullable = false) private List allocationTypes; diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/AllocationTypeListConverter.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/AllocationTypeListConverter.java index a6643017c..7659ea36d 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/AllocationTypeListConverter.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/AllocationTypeListConverter.java @@ -24,8 +24,8 @@ import java.util.List; import org.apache.fineract.infrastructure.core.data.GenericEnumListConverter; @Converter(autoApply = true) -public class AllocationTypeListConverter extends GenericEnumListConverter - implements AttributeConverter, String> { +public class AllocationTypeListConverter extends GenericEnumListConverter + implements AttributeConverter, String> { @Override public boolean isUnique() { @@ -33,7 +33,7 @@ public class AllocationTypeListConverter extends GenericEnumListConverter getValuesAsEnumOptionDataList() { + return Arrays.stream(values()).map(v -> new EnumOptionData((long) (v.ordinal() + 1), v.name(), v.getHumanReadableName())).toList(); + } +} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java index ad7864172..8bf064ae5 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java @@ -95,6 +95,9 @@ public class LoanProduct extends AbstractPersistableCustom { @OneToMany(cascade = CascadeType.ALL, mappedBy = "loanProduct", orphanRemoval = true, fetch = FetchType.EAGER) private List paymentAllocationRules = new ArrayList<>(); + @OneToMany(cascade = CascadeType.ALL, mappedBy = "loanProduct", orphanRemoval = true, fetch = FetchType.EAGER) + private List creditAllocationRules = new ArrayList<>(); + @Column(name = "name", nullable = false, unique = true) private String name; @@ -223,7 +226,8 @@ public class LoanProduct extends AbstractPersistableCustom { public static LoanProduct assembleFromJson(final Fund fund, final String loanTransactionProcessingStrategy, final List productCharges, final JsonCommand command, final AprCalculator aprCalculator, FloatingRate floatingRate, - final List productRates, List loanProductPaymentAllocationRules) { + final List productRates, List loanProductPaymentAllocationRules, + List loanProductCreditAllocationRules) { final String name = command.stringValueOfParameterNamed("name"); final String shortName = command.stringValueOfParameterNamed(LoanProductConstants.SHORT_NAME); @@ -425,25 +429,25 @@ public class LoanProduct extends AbstractPersistableCustom { final boolean enableInstallmentLevelDelinquency = command .booleanPrimitiveValueOfParameterNamed(LoanProductConstants.ENABLE_INSTALLMENT_LEVEL_DELINQUENCY); - return new LoanProduct(fund, loanTransactionProcessingStrategy, loanProductPaymentAllocationRules, name, shortName, description, - currency, principal, minPrincipal, maxPrincipal, interestRatePerPeriod, minInterestRatePerPeriod, maxInterestRatePerPeriod, - interestFrequencyType, annualInterestRate, interestMethod, interestCalculationPeriodMethod, - allowPartialPeriodInterestCalcualtion, repaymentEvery, repaymentFrequencyType, numberOfRepayments, minNumberOfRepayments, - maxNumberOfRepayments, graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment, - graceOnInterestCharged, amortizationMethod, inArrearsTolerance, productCharges, accountingRuleType, includeInBorrowerCycle, - startDate, closeDate, externalId, useBorrowerCycle, loanProductBorrowerCycleVariations, multiDisburseLoan, maxTrancheCount, - outstandingLoanBalance, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType, - isInterestRecalculationEnabled, interestRecalculationSettings, minimumDaysBetweenDisbursalAndFirstRepayment, - holdGuarantorFunds, loanProductGuaranteeDetails, principalThresholdForLastInstallment, - accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineEmiAmount, installmentAmountInMultiplesOf, loanConfigurableAttributes, - isLinkedToFloatingInterestRates, floatingRate, interestRateDifferential, minDifferentialLendingRate, - maxDifferentialLendingRate, defaultDifferentialLendingRate, isFloatingInterestRateCalculationAllowed, - isVariableInstallmentsAllowed, minimumGapBetweenInstallments, maximumGapBetweenInstallments, - syncExpectedWithDisbursementDate, canUseForTopup, isEqualAmortization, productRates, fixedPrincipalPercentagePerInstallment, - disallowExpectedDisbursements, allowApprovedDisbursedAmountsOverApplied, overAppliedCalculationType, overAppliedNumber, - dueDaysForRepaymentEvent, overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, - enableAutoRepaymentForDownPayment, repaymentStartDateType, enableInstallmentLevelDelinquency, loanScheduleType, - loanScheduleProcessingType); + return new LoanProduct(fund, loanTransactionProcessingStrategy, loanProductPaymentAllocationRules, loanProductCreditAllocationRules, + name, shortName, description, currency, principal, minPrincipal, maxPrincipal, interestRatePerPeriod, + minInterestRatePerPeriod, maxInterestRatePerPeriod, interestFrequencyType, annualInterestRate, interestMethod, + interestCalculationPeriodMethod, allowPartialPeriodInterestCalcualtion, repaymentEvery, repaymentFrequencyType, + numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, graceOnPrincipalPayment, + recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment, graceOnInterestCharged, amortizationMethod, + inArrearsTolerance, productCharges, accountingRuleType, includeInBorrowerCycle, startDate, closeDate, externalId, + useBorrowerCycle, loanProductBorrowerCycleVariations, multiDisburseLoan, maxTrancheCount, outstandingLoanBalance, + graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType, isInterestRecalculationEnabled, + interestRecalculationSettings, minimumDaysBetweenDisbursalAndFirstRepayment, holdGuarantorFunds, + loanProductGuaranteeDetails, principalThresholdForLastInstallment, accountMovesOutOfNPAOnlyOnArrearsCompletion, + canDefineEmiAmount, installmentAmountInMultiplesOf, loanConfigurableAttributes, isLinkedToFloatingInterestRates, + floatingRate, interestRateDifferential, minDifferentialLendingRate, maxDifferentialLendingRate, + defaultDifferentialLendingRate, isFloatingInterestRateCalculationAllowed, isVariableInstallmentsAllowed, + minimumGapBetweenInstallments, maximumGapBetweenInstallments, syncExpectedWithDisbursementDate, canUseForTopup, + isEqualAmortization, productRates, fixedPrincipalPercentagePerInstallment, disallowExpectedDisbursements, + allowApprovedDisbursedAmountsOverApplied, overAppliedCalculationType, overAppliedNumber, dueDaysForRepaymentEvent, + overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, enableAutoRepaymentForDownPayment, + repaymentStartDateType, enableInstallmentLevelDelinquency, loanScheduleType, loanScheduleProcessingType); } @@ -626,7 +630,8 @@ public class LoanProduct extends AbstractPersistableCustom { } public LoanProduct(final Fund fund, final String transactionProcessingStrategyCode, - final List paymentAllocationRules, final String name, final String shortName, + final List paymentAllocationRules, + final List creditAllocationRules, final String name, final String shortName, final String description, final MonetaryCurrency currency, final BigDecimal defaultPrincipal, final BigDecimal defaultMinPrincipal, final BigDecimal defaultMaxPrincipal, final BigDecimal defaultNominalInterestRatePerPeriod, final BigDecimal defaultMinNominalInterestRatePerPeriod, diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductCreditAllocationRule.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductCreditAllocationRule.java new file mode 100644 index 000000000..76001ba95 --- /dev/null +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductCreditAllocationRule.java @@ -0,0 +1,59 @@ +/** + * 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 jakarta.persistence.Column; +import jakarta.persistence.Convert; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import jakarta.persistence.UniqueConstraint; +import java.util.List; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom; + +@Getter +@Setter +@Entity +@Table(name = "m_loan_product_credit_allocation_rule", uniqueConstraints = { + @UniqueConstraint(columnNames = { "loan_product_id", "transaction_type" }, name = "uq_m_loan_product_credit_allocation_rule") }) +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class LoanProductCreditAllocationRule extends AbstractAuditableWithUTCDateTimeCustom { + + @ManyToOne + @JoinColumn(name = "loan_product_id", nullable = false) + private LoanProduct loanProduct; + + @Column(name = "transaction_type", nullable = false) + @Enumerated(EnumType.STRING) + private CreditAllocationTransactionType transactionType; + + @Convert(converter = AllocationTypeListConverter.class) + @Column(name = "allocation_types", nullable = false) + private List allocationTypes; + +} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductPaymentAllocationRule.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductPaymentAllocationRule.java index a1953c060..fbf4055b9 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductPaymentAllocationRule.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductPaymentAllocationRule.java @@ -52,7 +52,7 @@ public class LoanProductPaymentAllocationRule extends AbstractAuditableWithUTCDa @Enumerated(EnumType.STRING) private PaymentAllocationTransactionType transactionType; - @Convert(converter = AllocationTypeListConverter.class) + @Convert(converter = PaymentAllocationTypeListConverter.class) @Column(name = "allocation_types", nullable = false) private List allocationTypes; diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/PaymentAllocationTypeListConverter.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/PaymentAllocationTypeListConverter.java new file mode 100644 index 000000000..82e9dc42a --- /dev/null +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/PaymentAllocationTypeListConverter.java @@ -0,0 +1,39 @@ +/** + * 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 jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import java.util.List; +import org.apache.fineract.infrastructure.core.data.GenericEnumListConverter; + +@Converter(autoApply = true) +public class PaymentAllocationTypeListConverter extends GenericEnumListConverter + implements AttributeConverter, String> { + + @Override + public boolean isUnique() { + return true; + } + + public PaymentAllocationTypeListConverter() { + super(PaymentAllocationType.class); + } + +} diff --git a/fineract-loan/src/main/resources/db/changelog/tenant/module/loan/module-changelog-master.xml b/fineract-loan/src/main/resources/db/changelog/tenant/module/loan/module-changelog-master.xml index 22bc477ab..16760fc8b 100644 --- a/fineract-loan/src/main/resources/db/changelog/tenant/module/loan/module-changelog-master.xml +++ b/fineract-loan/src/main/resources/db/changelog/tenant/module/loan/module-changelog-master.xml @@ -38,4 +38,5 @@ + diff --git a/fineract-loan/src/main/resources/db/changelog/tenant/module/loan/parts/1016_add_credit_allocation_rule.xml b/fineract-loan/src/main/resources/db/changelog/tenant/module/loan/parts/1016_add_credit_allocation_rule.xml new file mode 100644 index 000000000..bbcb64553 --- /dev/null +++ b/fineract-loan/src/main/resources/db/changelog/tenant/module/loan/parts/1016_add_credit_allocation_rule.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java index a47fe5e0c..6f94cbda3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java @@ -55,6 +55,7 @@ import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.AprCalculat import org.apache.fineract.portfolio.loanproduct.LoanProductConstants; import org.apache.fineract.portfolio.loanproduct.domain.AdvancedPaymentAllocationsJsonParser; import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct; +import org.apache.fineract.portfolio.loanproduct.domain.LoanProductCreditAllocationRule; import org.apache.fineract.portfolio.loanproduct.domain.LoanProductPaymentAllocationRule; import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository; import org.apache.fineract.portfolio.loanproduct.exception.InvalidCurrencyException; @@ -109,13 +110,18 @@ public class LoanProductWritePlatformServiceJpaRepositoryImpl implements LoanPro final List rates = assembleListOfProductRates(command); final List loanProductPaymentAllocationRules = advancedPaymentJsonParser .assembleLoanProductPaymentAllocationRules(command, loanTransactionProcessingStrategyCode); + List loanProductCreditAllocationRules = new ArrayList<>(); // TODO: this + // shall be + // parsed from + // the json + // command FloatingRate floatingRate = null; if (command.parameterExists("floatingRatesId")) { floatingRate = this.floatingRateRepository .findOneWithNotFoundDetection(command.longValueOfParameterNamed("floatingRatesId")); } final LoanProduct loanProduct = LoanProduct.assembleFromJson(fund, loanTransactionProcessingStrategyCode, charges, command, - this.aprCalculator, floatingRate, rates, loanProductPaymentAllocationRules); + this.aprCalculator, floatingRate, rates, loanProductPaymentAllocationRules, loanProductCreditAllocationRules); loanProduct.updateLoanProductInRelatedClasses(); loanProduct.setTransactionProcessingStrategyName( loanRepaymentScheduleTransactionProcessorFactory.determineProcessor(loanTransactionProcessingStrategyCode).getName()); diff --git a/fineract-provider/src/main/resources/jpa/persistence.xml b/fineract-provider/src/main/resources/jpa/persistence.xml index b1fba72c9..a402cf603 100644 --- a/fineract-provider/src/main/resources/jpa/persistence.xml +++ b/fineract-provider/src/main/resources/jpa/persistence.xml @@ -114,6 +114,10 @@ org.apache.fineract.portfolio.loanproduct.domain.AllocationTypeListConverter org.apache.fineract.portfolio.loanproduct.domain.LoanProductPaymentAllocationRule org.apache.fineract.portfolio.loanaccount.domain.LoanPaymentAllocationRule + org.apache.fineract.portfolio.loanproduct.domain.LoanProductCreditAllocationRule + org.apache.fineract.portfolio.loanaccount.domain.LoanCreditAllocationRule + org.apache.fineract.portfolio.loanproduct.domain.CreditAllocationTransactionType + org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationTypeListConverter false