We have the principle that the repayment amount should not be greater than the outstanding debt minus the prepaid amount. The formula is below:

repayment amount

<=

outstanding debt

-

remaining prepaid amount

no matter prepayment or partial early repayment or full early repayment

INTEREST_DUE +
PRINCIPAL_DUE +
INTEREST_OVERDUE +
PRINCIPAL_OVERDUE +
PRINCIPAL +
ACCRUED_INTEREST

minus

PREPAID

Regarding the principle above, we can’t do the prepayment that pays the sum of the future installments' total amount, because the sum of the future installments' total amount will contain the principal and all the future interest and it’s larger than the outstanding debt.

The outstanding debt only contains the principal and accrued interest(interest from last repayment day to prepayment day).

If we do a prepayment first, then we have this amount on the PREPAID address, and after that(can be executed immediately or a few days/terms later), we do a partial or full early repayment, and our installment plan will change.

For this scenario, since we have some restrictions on the early repayment operation like we can't do the early repayment when loan is in overdue state, and early repayment will deduct the accrued interest( daily interest * days between last repayment day and the early repayment day) and part of the principal(early repayment amount - accrued interest), so at the timeline of after the early repayment , the outstanding debt only contains the PRINCIPAL amount.

However, at this point, if we find the remaining prepaid amount equals the outstanding debt, we need to use the remaining prepaid amount to pay off the loan and trigger the close loan workflow.

So at this time the remaining prepaid amount will be treated as an early repayment. And prepaid amount will no longer pay the future interest as before.

Example:

installment 

interest

principal 

EMI

remaining capital

1

1-2-2022

84.93

376.52

461.45

9623.48

2

1-3-2022

73.82

387.63

461.45

9235.86

3

1-4-2022

78.44

383.01

461.45

8852.85

4

1-5-2022

72.76

388.69

461.45

8464.16

5

1-6-2022

71.89

389.56

461.45

8074.60

6

1-7-2022

66.37

395.08

461.45

7679.52

prepayment

20-7-2022

 

 

1000

 

7

1-8-2022

65.22

396.23

461.45

7283.29

Prepayment amount remaining

538.55

 

8 partial/full repayment

17-8-2022

31.93

6744.74

6776.67

538.55

Prepayment amount remaining

538.55

 

9 prepayment as early repayment

17-8-2022

0

538.55

538.55

0

The loan is paid off and the future installments will be invalid and won’t be shown to our customer.