somasorosdpc commented on code in PR #4294:
URL: https://github.com/apache/fineract/pull/4294#discussion_r1950478748
##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/EMICalculator.java:
##########
@@ -27,49 +27,98 @@
import org.apache.fineract.organisation.monetary.domain.Money;
import org.apache.fineract.portfolio.loanaccount.data.LoanTermVariationsData;
import
org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
-import
org.apache.fineract.portfolio.loanaccount.loanschedule.data.OutstandingDetails;
-import
org.apache.fineract.portfolio.loanaccount.loanschedule.data.PeriodDueDetails;
-import
org.apache.fineract.portfolio.loanaccount.loanschedule.data.ProgressiveLoanInterestScheduleModel;
-import
org.apache.fineract.portfolio.loanaccount.loanschedule.data.RepaymentPeriod;
import
org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleModelRepaymentPeriod;
+import org.apache.fineract.portfolio.loanproduct.calc.data.OutstandingDetails;
+import org.apache.fineract.portfolio.loanproduct.calc.data.PeriodDueDetails;
+import
org.apache.fineract.portfolio.loanproduct.calc.data.ProgressiveLoanInterestScheduleModel;
+import org.apache.fineract.portfolio.loanproduct.calc.data.RepaymentPeriod;
import
org.apache.fineract.portfolio.loanproduct.domain.LoanProductMinimumRepaymentScheduleRelatedDetail;
public interface EMICalculator {
+ /**
+ * This method creates an Interest model with repayment periods from the
schedule periods which generated by
+ * schedule generator.
+ */
@NotNull
ProgressiveLoanInterestScheduleModel
generatePeriodInterestScheduleModel(@NotNull
List<LoanScheduleModelRepaymentPeriod> periods,
@NotNull LoanProductMinimumRepaymentScheduleRelatedDetail
loanProductRelatedDetail,
List<LoanTermVariationsData> loanTermVariations, Integer
installmentAmountInMultiplesOf, MathContext mc);
+ /**
+ * This method creates an Interest model with repayment periods from the
installments which retrieved from the
+ * database.
+ */
@NotNull
ProgressiveLoanInterestScheduleModel
generateInstallmentInterestScheduleModel(
@NotNull List<LoanRepaymentScheduleInstallment> installments,
@NotNull LoanProductMinimumRepaymentScheduleRelatedDetail
loanProductRelatedDetail,
List<LoanTermVariationsData> loanTermVariations, Integer
installmentAmountInMultiplesOf, MathContext mc);
+ /**
+ * Find repayment period based on Due Date.
+ */
Optional<RepaymentPeriod>
findRepaymentPeriod(ProgressiveLoanInterestScheduleModel scheduleModel,
LocalDate dueDate);
+ /**
+ * Applies the Bank disbursement on the interest model. This method
recalculates the EMI amounts from the action
+ * date.
+ */
void addDisbursement(ProgressiveLoanInterestScheduleModel scheduleModel,
LocalDate disbursementDueDate, Money disbursedAmount);
+ /**
+ * Applies the interest rate change on the interest model. This method
recalculates the EMI amounts from the action
+ * date.
+ */
void changeInterestRate(ProgressiveLoanInterestScheduleModel
scheduleModel, LocalDate newInterestSubmittedOnDate,
BigDecimal newInterestRate);
+ /**
+ * This method applies outstanding balance correction on the interest
model. Negative amount decreases the
+ * outstanding balance while positive amounts are increasing that.
Typically used for late repayment or to count
+ * repayments.
+ */
void addBalanceCorrection(ProgressiveLoanInterestScheduleModel
scheduleModel, LocalDate balanceCorrectionDate,
Money balanceCorrectionAmount);
+ /**
+ * This method used for pay interest portion during the repayment
transaction.
+ */
void payInterest(ProgressiveLoanInterestScheduleModel scheduleModel,
LocalDate repaymentPeriodDueDate, LocalDate transactionDate,
Money interestAmount);
+ /**
+ * This method used for pay principal portion during the repayment
transaction.
+ */
void payPrincipal(ProgressiveLoanInterestScheduleModel scheduleModel,
LocalDate repaymentPeriodDueDate, LocalDate transactionDate,
Money principalAmount);
+ /**
+ * This method used for charge back principal portion. This method
increases the outstanding balance. This method
+ * creates a calculated "virtual" EMI for the applied period.
+ */
+ void chargebackPrincipal(ProgressiveLoanInterestScheduleModel
scheduleModel, LocalDate transactionDate,
+ Money chargebackPrincipalAmount);
+
+ /**
+ * This method used for charge back interest portion. This method adds
extra interest due. This method creates a
+ * calculated "virtual" EMI for the applied period.
+ */
+ void chargebackInterest(ProgressiveLoanInterestScheduleModel
scheduleModel, LocalDate transactionDate, Money chargebackInterestAmount);
+
+ /**
+ * This method gives back the maximum of the due principal and maximum of
the due interest for a requested day.
+ */
@NotNull
PeriodDueDetails getDueAmounts(@NotNull
ProgressiveLoanInterestScheduleModel scheduleModel, @NotNull LocalDate
periodDueDate,
@NotNull LocalDate targetDate);
+ /**
+ * Gives back the sum of the interest from the whole model on the given
date.
+ */
@NotNull
Money getPeriodInterestTillDate(@NotNull
ProgressiveLoanInterestScheduleModel scheduleModel, @NotNull LocalDate
periodDueDate,
- @NotNull LocalDate targetDate);
+ @NotNull LocalDate targetDate, boolean includeChargebackInterest);
Review Comment:
Accrual calculation will use it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]