Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kjozsa committed Jul 16, 2024
1 parent 6c4932b commit 6536bfc
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@
import com.google.gson.JsonPrimitive;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
Expand Down Expand Up @@ -138,6 +141,7 @@
import org.apache.fineract.portfolio.loanproduct.domain.InterestRecalculationCompoundingMethod;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRelatedDetail;
import org.apache.fineract.portfolio.loanproduct.domain.LoanRefundType;
import org.apache.fineract.portfolio.loanproduct.domain.LoanRescheduleStrategyMethod;
import org.apache.fineract.portfolio.loanproduct.domain.RecalculationFrequencyType;
import org.apache.fineract.portfolio.loanproduct.domain.RepaymentStartDateType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -113,6 +114,7 @@ public static LoanTransactionType fromInt(final Integer transactionType) {
case 30 -> LoanTransactionType.REAMORTIZE;
case 31 -> LoanTransactionType.INTEREST_PAYMENT_WAIVER;
case 32 -> LoanTransactionType.ACCRUAL_ACTIVITY;
case 33 -> LoanTransactionType.INTEREST_REFUND;
default -> LoanTransactionType.INVALID;
};
}
Expand Down Expand Up @@ -221,4 +223,10 @@ public boolean isDownPayment() {
public boolean isAccrualActivity() {
return this.equals(LoanTransactionType.ACCRUAL_ACTIVITY);
}

public boolean isInterestRefund() {
return this.equals(LoanTransactionType.INTEREST_REFUND);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
import com.google.gson.JsonObject;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
package org.apache.fineract.portfolio.loanproduct.domain;

import jakarta.persistence.Column;
import jakarta.persistence.ElementCollection;
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;
Expand Down Expand Up @@ -153,6 +155,12 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
@Column(name = "enable_accrual_activity_posting", nullable = false)
private boolean enableAccrualActivityPosting = false;

@ElementCollection
@Enumerated(EnumType.STRING)
@Column(name = "supported_interest_refund_types", nullable = false)
private List<LoanRefundType> 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,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.apache.fineract.portfolio.loanproduct.domain;

public enum LoanRefundType {
MERCHANT_ISSUED_REFUND, //
PAYOUT_REFUND, //
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ public static LoanTransactionEnumData transactionType(final LoanTransactionType
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");
};
}

Expand Down

0 comments on commit 6536bfc

Please sign in to comment.