2727import org .apache .fineract .organisation .monetary .domain .Money ;
2828import org .apache .fineract .portfolio .loanaccount .data .LoanTermVariationsData ;
2929import org .apache .fineract .portfolio .loanaccount .domain .LoanRepaymentScheduleInstallment ;
30- import org .apache .fineract .portfolio .loanaccount .loanschedule .data .OutstandingDetails ;
31- import org .apache .fineract .portfolio .loanaccount .loanschedule .data .PeriodDueDetails ;
32- import org .apache .fineract .portfolio .loanaccount .loanschedule .data .ProgressiveLoanInterestScheduleModel ;
33- import org .apache .fineract .portfolio .loanaccount .loanschedule .data .RepaymentPeriod ;
3430import org .apache .fineract .portfolio .loanaccount .loanschedule .domain .LoanScheduleModelRepaymentPeriod ;
31+ import org .apache .fineract .portfolio .loanproduct .calc .data .OutstandingDetails ;
32+ import org .apache .fineract .portfolio .loanproduct .calc .data .PeriodDueDetails ;
33+ import org .apache .fineract .portfolio .loanproduct .calc .data .ProgressiveLoanInterestScheduleModel ;
34+ import org .apache .fineract .portfolio .loanproduct .calc .data .RepaymentPeriod ;
3535import org .apache .fineract .portfolio .loanproduct .domain .LoanProductMinimumRepaymentScheduleRelatedDetail ;
3636
3737public interface EMICalculator {
3838
39+ /**
40+ * This method creates an Interest model with repayment periods from the schedule periods which generated by
41+ * schedule generator.
42+ */
3943 @ NotNull
4044 ProgressiveLoanInterestScheduleModel generatePeriodInterestScheduleModel (@ NotNull List <LoanScheduleModelRepaymentPeriod > periods ,
4145 @ NotNull LoanProductMinimumRepaymentScheduleRelatedDetail loanProductRelatedDetail ,
4246 List <LoanTermVariationsData > loanTermVariations , Integer installmentAmountInMultiplesOf , MathContext mc );
4347
48+ /**
49+ * This method creates an Interest model with repayment periods from the installments which retrieved from the
50+ * database.
51+ */
4452 @ NotNull
4553 ProgressiveLoanInterestScheduleModel generateInstallmentInterestScheduleModel (
4654 @ NotNull List <LoanRepaymentScheduleInstallment > installments ,
4755 @ NotNull LoanProductMinimumRepaymentScheduleRelatedDetail loanProductRelatedDetail ,
4856 List <LoanTermVariationsData > loanTermVariations , Integer installmentAmountInMultiplesOf , MathContext mc );
4957
58+ /**
59+ * Find repayment period based on Due Date.
60+ */
5061 Optional <RepaymentPeriod > findRepaymentPeriod (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate dueDate );
5162
63+ /**
64+ * Applies the Bank disbursement on the interest model. This method recalculates the EMI amounts from the action
65+ * date.
66+ */
5267 void addDisbursement (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate disbursementDueDate , Money disbursedAmount );
5368
69+ /**
70+ * Applies the interest rate change on the interest model. This method recalculates the EMI amounts from the action
71+ * date.
72+ */
5473 void changeInterestRate (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate newInterestSubmittedOnDate ,
5574 BigDecimal newInterestRate );
5675
76+ /**
77+ * This method applies outstanding balance correction on the interest model. Negative amount decreases the
78+ * outstanding balance while positive amounts are increasing that. Typically used for late repayment or to count
79+ * repayments.
80+ */
5781 void addBalanceCorrection (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate balanceCorrectionDate ,
5882 Money balanceCorrectionAmount );
5983
84+ /**
85+ * This method used for pay interest portion during the repayment transaction.
86+ */
6087 void payInterest (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate repaymentPeriodDueDate , LocalDate transactionDate ,
6188 Money interestAmount );
6289
90+ /**
91+ * This method used for pay principal portion during the repayment transaction.
92+ */
6393 void payPrincipal (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate repaymentPeriodDueDate , LocalDate transactionDate ,
6494 Money principalAmount );
6595
96+ /**
97+ * This method used for charge back principal portion. This method increases the outstanding balance. This method
98+ * creates a calculated "virtual" EMI for the applied period.
99+ */
100+ void chargebackPrincipal (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate transactionDate ,
101+ Money chargebackPrincipalAmount );
102+
103+ /**
104+ * This method used for charge back interest portion. This method adds extra interest due. This method creates a
105+ * calculated "virtual" EMI for the applied period.
106+ */
107+ void chargebackInterest (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate transactionDate , Money chargebackInterestAmount );
108+
109+ /**
110+ * This method gives back the maximum of the due principal and maximum of the due interest for a requested day.
111+ */
66112 @ NotNull
67113 PeriodDueDetails getDueAmounts (@ NotNull ProgressiveLoanInterestScheduleModel scheduleModel , @ NotNull LocalDate periodDueDate ,
68114 @ NotNull LocalDate targetDate );
69115
116+ /**
117+ * Gives back the sum of the interest from the whole model on the given date.
118+ */
70119 @ NotNull
71120 Money getPeriodInterestTillDate (@ NotNull ProgressiveLoanInterestScheduleModel scheduleModel , @ NotNull LocalDate periodDueDate ,
72- @ NotNull LocalDate targetDate );
121+ @ NotNull LocalDate targetDate , boolean includeChargebackInterest );
73122
74123 Money getOutstandingLoanBalanceOfPeriod (ProgressiveLoanInterestScheduleModel interestScheduleModel , LocalDate repaymentPeriodDueDate ,
75124 LocalDate targetDate );
@@ -78,5 +127,9 @@ Money getOutstandingLoanBalanceOfPeriod(ProgressiveLoanInterestScheduleModel int
78127
79128 Money getSumOfDueInterestsOnDate (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate subjectDate );
80129
130+ /**
131+ * This method stops the interest counting for the given range. Chargeback interest counts even if the normal
132+ * interest paused.
133+ */
81134 void applyInterestPause (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate fromDate , LocalDate endDate );
82135}
0 commit comments