27
27
import org .apache .fineract .organisation .monetary .domain .Money ;
28
28
import org .apache .fineract .portfolio .loanaccount .data .LoanTermVariationsData ;
29
29
import 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 ;
34
30
import 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 ;
35
35
import org .apache .fineract .portfolio .loanproduct .domain .LoanProductMinimumRepaymentScheduleRelatedDetail ;
36
36
37
37
public interface EMICalculator {
38
38
39
+ /**
40
+ * This method creates an Interest model with repayment periods from the schedule periods which generated by
41
+ * schedule generator.
42
+ */
39
43
@ NotNull
40
44
ProgressiveLoanInterestScheduleModel generatePeriodInterestScheduleModel (@ NotNull List <LoanScheduleModelRepaymentPeriod > periods ,
41
45
@ NotNull LoanProductMinimumRepaymentScheduleRelatedDetail loanProductRelatedDetail ,
42
46
List <LoanTermVariationsData > loanTermVariations , Integer installmentAmountInMultiplesOf , MathContext mc );
43
47
48
+ /**
49
+ * This method creates an Interest model with repayment periods from the installments which retrieved from the
50
+ * database.
51
+ */
44
52
@ NotNull
45
53
ProgressiveLoanInterestScheduleModel generateInstallmentInterestScheduleModel (
46
54
@ NotNull List <LoanRepaymentScheduleInstallment > installments ,
47
55
@ NotNull LoanProductMinimumRepaymentScheduleRelatedDetail loanProductRelatedDetail ,
48
56
List <LoanTermVariationsData > loanTermVariations , Integer installmentAmountInMultiplesOf , MathContext mc );
49
57
58
+ /**
59
+ * Find repayment period based on Due Date.
60
+ */
50
61
Optional <RepaymentPeriod > findRepaymentPeriod (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate dueDate );
51
62
63
+ /**
64
+ * Applies the Bank disbursement on the interest model. This method recalculates the EMI amounts from the action
65
+ * date.
66
+ */
52
67
void addDisbursement (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate disbursementDueDate , Money disbursedAmount );
53
68
69
+ /**
70
+ * Applies the interest rate change on the interest model. This method recalculates the EMI amounts from the action
71
+ * date.
72
+ */
54
73
void changeInterestRate (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate newInterestSubmittedOnDate ,
55
74
BigDecimal newInterestRate );
56
75
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
+ */
57
81
void addBalanceCorrection (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate balanceCorrectionDate ,
58
82
Money balanceCorrectionAmount );
59
83
84
+ /**
85
+ * This method used for pay interest portion during the repayment transaction.
86
+ */
60
87
void payInterest (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate repaymentPeriodDueDate , LocalDate transactionDate ,
61
88
Money interestAmount );
62
89
90
+ /**
91
+ * This method used for pay principal portion during the repayment transaction.
92
+ */
63
93
void payPrincipal (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate repaymentPeriodDueDate , LocalDate transactionDate ,
64
94
Money principalAmount );
65
95
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
+ */
66
112
@ NotNull
67
113
PeriodDueDetails getDueAmounts (@ NotNull ProgressiveLoanInterestScheduleModel scheduleModel , @ NotNull LocalDate periodDueDate ,
68
114
@ NotNull LocalDate targetDate );
69
115
116
+ /**
117
+ * Gives back the sum of the interest from the whole model on the given date.
118
+ */
70
119
@ NotNull
71
120
Money getPeriodInterestTillDate (@ NotNull ProgressiveLoanInterestScheduleModel scheduleModel , @ NotNull LocalDate periodDueDate ,
72
- @ NotNull LocalDate targetDate );
121
+ @ NotNull LocalDate targetDate , boolean includeChargebackInterest );
73
122
74
123
Money getOutstandingLoanBalanceOfPeriod (ProgressiveLoanInterestScheduleModel interestScheduleModel , LocalDate repaymentPeriodDueDate ,
75
124
LocalDate targetDate );
@@ -78,5 +127,9 @@ Money getOutstandingLoanBalanceOfPeriod(ProgressiveLoanInterestScheduleModel int
78
127
79
128
Money getSumOfDueInterestsOnDate (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate subjectDate );
80
129
130
+ /**
131
+ * This method stops the interest counting for the given range. Chargeback interest counts even if the normal
132
+ * interest paused.
133
+ */
81
134
void applyInterestPause (ProgressiveLoanInterestScheduleModel scheduleModel , LocalDate fromDate , LocalDate endDate );
82
135
}
0 commit comments