FINERACT-1971: Added reamortization foundational work

This commit is contained in:
Arnold Galovics
2024-02-27 08:15:26 +01:00
committed by Arnold Gálovics
parent 6ee881b89a
commit 4a11f0ca29
21 changed files with 669 additions and 4 deletions
@@ -0,0 +1,26 @@
/**
* 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.api;
public interface LoanReAmortizationApiConstants {
String localeParameterName = "locale";
String dateFormatParameterName = "dateFormat";
String externalIdParameterName = "externalId";
}
@@ -57,6 +57,7 @@ public class LoanTransactionEnumData {
private final boolean chargeoff;
private final boolean downPayment;
private final boolean reAge;
private final boolean reAmortize;
public LoanTransactionEnumData(final Long id, final String code, final String value) {
this.id = id;
@@ -88,6 +89,7 @@ public class LoanTransactionEnumData {
this.chargeoff = Long.valueOf(27).equals(this.id);
this.downPayment = Long.valueOf(28).equals(this.id);
this.reAge = Long.valueOf(LoanTransactionType.REAGE.getValue()).equals(this.id);
this.reAmortize = Long.valueOf(LoanTransactionType.REAMORTIZE.getValue()).equals(this.id);
}
public boolean isRepaymentType() {
@@ -685,6 +685,10 @@ public class LoanTransaction extends AbstractAuditableWithUTCDateTimeCustom {
return getTypeOf().isReAge() && isNotReversed();
}
public boolean isReAmortize() {
return getTypeOf().isReAmortize() && isNotReversed();
}
public boolean isIdentifiedBy(final Long identifier) {
return getId().equals(identifier);
}
@@ -61,7 +61,7 @@ public enum LoanTransactionType {
CHARGE_ADJUSTMENT(26, "loanTransactionType.chargeAdjustment"), //
CHARGE_OFF(27, "loanTransactionType.chargeOff"), //
DOWN_PAYMENT(28, "loanTransactionType.downPayment"), //
REAGE(29, "loanTransactionType.reAge");
REAGE(29, "loanTransactionType.reAge"), REAMORTIZE(30, "loanTransactionType.reAmortize");
private final Integer value;
private final String code;
@@ -106,6 +106,7 @@ public enum LoanTransactionType {
case 27 -> LoanTransactionType.CHARGE_OFF;
case 28 -> LoanTransactionType.DOWN_PAYMENT;
case 29 -> LoanTransactionType.REAGE;
case 30 -> LoanTransactionType.REAMORTIZE;
default -> LoanTransactionType.INVALID;
};
}
@@ -198,6 +199,10 @@ public enum LoanTransactionType {
return this.equals(LoanTransactionType.REAGE);
}
public boolean isReAmortize() {
return this.equals(LoanTransactionType.REAMORTIZE);
}
public boolean isDownPayment() {
return this.equals(LoanTransactionType.DOWN_PAYMENT);
}
@@ -315,6 +315,8 @@ public final class LoanEnumerations {
LoanTransactionType.DOWN_PAYMENT.getCode(), "Down Payment");
case REAGE -> new LoanTransactionEnumData(LoanTransactionType.REAGE.getValue().longValue(), LoanTransactionType.REAGE.getCode(),
"Re-age");
case REAMORTIZE -> new LoanTransactionEnumData(LoanTransactionType.REAMORTIZE.getValue().longValue(),
LoanTransactionType.REAMORTIZE.getCode(), "Re-amortize");
};
}