FINERACT-2398: Re-amortization Interest Handling configuration
This commit is contained in:
committed by
Adam Saghy
parent
8a86759773
commit
a849e9bae3
+3
@@ -142,6 +142,8 @@ public interface LoanApiConstants {
|
||||
String CHARGE_OFF_REASONS = "ChargeOffReasons";
|
||||
// loan ReAge
|
||||
String REAGE_REASONS = "ReAgeReasons";
|
||||
// loan ReAmortization
|
||||
String REAMORTIZATION_REASONS = "ReAmortizationReasons";
|
||||
// fore closure constants
|
||||
String transactionDateParamName = "transactionDate";
|
||||
String noteParamName = "note";
|
||||
@@ -186,6 +188,7 @@ public interface LoanApiConstants {
|
||||
String BUY_DOWN_FEE_COMMAND = "buyDownFee";
|
||||
String BUY_DOWN_FEE_ADJUSTMENT_COMMAND = "buyDownFeeAdjustment";
|
||||
String REAGE_COMMAND = "reAge";
|
||||
String REAMORTIZATION_COMMAND = "reAmortization";
|
||||
|
||||
// Data Validator names
|
||||
String LOAN_FRAUD_DATAVALIDATOR_PREFIX = "loans.fraud";
|
||||
|
||||
+3
@@ -23,4 +23,7 @@ public interface LoanReAmortizationApiConstants {
|
||||
String localeParameterName = "locale";
|
||||
String dateFormatParameterName = "dateFormat";
|
||||
String externalIdParameterName = "externalId";
|
||||
|
||||
String reAmortizationInterestHandlingParamName = "reAmortizationInterestHandling";
|
||||
String reasonCodeValueIdParamName = "reasonCodeValueId";
|
||||
}
|
||||
|
||||
+2
@@ -370,6 +370,8 @@ final class LoanTransactionsApiResourceSwagger {
|
||||
public Integer numberOfInstallments;
|
||||
@Schema(example = "DEFAULT")
|
||||
public String reAgeInterestHandling;
|
||||
@Schema(example = "DEFAULT")
|
||||
public String reAmortizationInterestHandling;
|
||||
@Schema(example = "1")
|
||||
public Long reasonCodeValueId;
|
||||
|
||||
|
||||
+2
@@ -121,6 +121,8 @@ public class LoanTransactionData implements Serializable {
|
||||
private Collection<CodeValueData> reAgeReasonOptions = null;
|
||||
private Collection<PeriodFrequencyType> periodFrequencyOptions = null;
|
||||
private Collection<StringEnumOptionData> reAgeInterestHandlingOptions = null;
|
||||
private Collection<CodeValueData> reAmortizationReasonOptions = null;
|
||||
private Collection<StringEnumOptionData> reAmortizationInterestHandlingOptions = null;
|
||||
|
||||
public static LoanTransactionData importInstance(BigDecimal repaymentAmount, LocalDate lastRepaymentDate, Long repaymentTypeId,
|
||||
Integer rowIndex, String locale, String dateFormat) {
|
||||
|
||||
+5
@@ -48,6 +48,7 @@ import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.reaging.LoanReAgeParameter;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.reamortization.LoanReAmortizationParameter;
|
||||
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||
import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail;
|
||||
|
||||
@@ -145,6 +146,10 @@ public class LoanTransaction extends AbstractAuditableWithUTCDateTimeCustom<Long
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY, mappedBy = "loanTransaction")
|
||||
private LoanReAgeParameter loanReAgeParameter;
|
||||
|
||||
@Setter
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY, mappedBy = "loanTransaction")
|
||||
private LoanReAmortizationParameter loanReAmortizationParameter;
|
||||
|
||||
@Setter
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "classification_cv_id")
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 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.reamortization;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum LoanReAmortizationInterestHandlingType {
|
||||
|
||||
DEFAULT("loanReAmortizationInterestHandlingType.default", "Default"), //
|
||||
WAIVE_INTEREST("loanReAmortizationInterestHandlingType.waiveInterest", "Waive Interest"), //
|
||||
EQUAL_AMORTIZATION_INTEREST_SPLIT("loanReAmortizationInterestHandlingType.equalAmortizationInterestSplit",
|
||||
"Equal Amortization Interest Split"), ///
|
||||
;
|
||||
|
||||
private final String code;
|
||||
private final String humanReadableName;
|
||||
|
||||
public static List<StringEnumOptionData> getValuesAsEnumOptionDataList() {
|
||||
return Arrays.stream(values()).map(v -> new StringEnumOptionData(v.name(), v.getCode(), v.getHumanReadableName())).toList();
|
||||
}
|
||||
|
||||
public StringEnumOptionData asEnumOptionData() {
|
||||
return new StringEnumOptionData(name(), getCode(), getHumanReadableName());
|
||||
}
|
||||
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* 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.reamortization;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.apache.fineract.infrastructure.codes.domain.CodeValue;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_loan_reamortization_parameter")
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class LoanReAmortizationParameter extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "loan_transaction_id", nullable = false)
|
||||
private LoanTransaction loanTransaction;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "interest_handling_type")
|
||||
private LoanReAmortizationInterestHandlingType interestHandlingType;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "reamortization_reason_code_value_id", nullable = true)
|
||||
private CodeValue reamortizationReason;
|
||||
|
||||
// for JPA, don't use
|
||||
protected LoanReAmortizationParameter() {}
|
||||
}
|
||||
+2
@@ -34,8 +34,10 @@ public interface LoanTransactionMapper {
|
||||
@Mapping(target = "writeOffReasonOptions", ignore = true)
|
||||
@Mapping(target = "chargeOffReasonOptions", ignore = true)
|
||||
@Mapping(target = "reAgeReasonOptions", ignore = true)
|
||||
@Mapping(target = "reAmortizationReasonOptions", ignore = true)
|
||||
@Mapping(target = "periodFrequencyOptions", ignore = true)
|
||||
@Mapping(target = "reAgeInterestHandlingOptions", ignore = true)
|
||||
@Mapping(target = "reAmortizationInterestHandlingOptions", ignore = true)
|
||||
@Mapping(target = "classificationOptions", ignore = true)
|
||||
@Mapping(target = "paymentTypeOptions", ignore = true)
|
||||
@Mapping(target = "overpaymentPortion", ignore = true)
|
||||
|
||||
+2
@@ -166,4 +166,6 @@ public interface LoanReadPlatformService {
|
||||
Long getResolvedLoanTransactionId(Long transactionId, ExternalId externalTransactionId);
|
||||
|
||||
LoanTransactionData retrieveLoanReAgeTemplate(Long loanId);
|
||||
|
||||
LoanTransactionData retrieveLoanReAmortizationTemplate(Long loanId);
|
||||
}
|
||||
|
||||
+1
@@ -56,4 +56,5 @@
|
||||
<include relativeToChangelogFile="true" file="parts/1031_loan_merchant_buy_down_fee.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/1032_add_classification_to_loan_transaction.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/1033_add_reage_reasons_for_loan.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/1034_loan_reamortization_parameters.xml"/>
|
||||
</databaseChangeLog>
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
<?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.1.xsd">
|
||||
<changeSet author="fineract" id="1" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
|
||||
<createTable tableName="m_loan_reamortization_parameter">
|
||||
<column autoIncrement="true" name="id" type="BIGINT">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="loan_transaction_id" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column defaultValue="DEFAULT" name="interest_handling_type" type="VARCHAR(40)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column defaultValueComputed="NULL" name="reamortization_reason_code_value_id" type="INT"/>
|
||||
<column name="created_by" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="last_modified_by" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet id="2-mysql" author="fineract" context="mysql">
|
||||
<addColumn tableName="m_loan_reamortization_parameter">
|
||||
<column name="created_on_utc" type="DATETIME(6)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="last_modified_on_utc" type="DATETIME(6)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
<changeSet id="2-postgresql" author="fineract" context="postgresql">
|
||||
<addColumn tableName="m_loan_reamortization_parameter">
|
||||
<column name="created_on_utc" type="TIMESTAMP WITH TIME ZONE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="last_modified_on_utc" type="TIMESTAMP WITH TIME ZONE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
<changeSet author="fineract" id="4">
|
||||
<insert tableName="m_code">
|
||||
<column name="code_name" value="ReAmortizationReasons"/>
|
||||
<column name="is_system_defined" valueBoolean="true"/>
|
||||
</insert>
|
||||
</changeSet>
|
||||
<changeSet author="fineract" id="5">
|
||||
<addForeignKeyConstraint baseColumnNames="reamortization_reason_code_value_id" baseTableName="m_loan_reamortization_parameter"
|
||||
constraintName="FK_reamortization_reason_code_m_code_value" deferrable="false"
|
||||
initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT"
|
||||
referencedColumnNames="id" referencedTableName="m_code_value" validate="true"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
+1
@@ -109,6 +109,7 @@
|
||||
<class>org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRelation</class>
|
||||
<class>org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionToRepaymentScheduleMapping</class>
|
||||
<class>org.apache.fineract.portfolio.loanaccount.domain.reaging.LoanReAgeParameter</class>
|
||||
<class>org.apache.fineract.portfolio.loanaccount.domain.reamortization.LoanReAmortizationParameter</class>
|
||||
<class>org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanRepaymentScheduleHistory</class>
|
||||
<class>org.apache.fineract.portfolio.loanaccount.rescheduleloan.domain.LoanRescheduleRequest</class>
|
||||
<class>org.apache.fineract.portfolio.loanproduct.domain.LoanProduct</class>
|
||||
|
||||
Reference in New Issue
Block a user