FINERACT-2264: Interest pause issue - Interest calculation start again in case of early repayment during interest period
This commit is contained in:
@@ -3899,15 +3899,15 @@ Feature: LoanAccrualActivity
|
|||||||
Then Loan Repayment schedule has 6 periods, with the following data for periods:
|
Then Loan Repayment schedule has 6 periods, with the following data for periods:
|
||||||
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||||
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||||
| 1 | 31 | 01 February 2024 | | 83.49 | 16.51 | 0.5 | 0.0 | 0.0 | 17.01 | 15.0 | 15.0 | 0.0 | 2.01 |
|
| 1 | 31 | 01 February 2024 | | 83.22 | 16.78 | 0.23 | 0.0 | 0.0 | 17.01 | 15.0 | 15.0 | 0.0 | 2.01 |
|
||||||
| 2 | 29 | 01 March 2024 | | 66.65 | 16.84 | 0.17 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
| 2 | 29 | 01 March 2024 | | 66.38 | 16.84 | 0.17 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||||
| 3 | 31 | 01 April 2024 | | 50.04 | 16.61 | 0.4 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
| 3 | 31 | 01 April 2024 | | 49.77 | 16.61 | 0.4 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||||
| 4 | 30 | 01 May 2024 | | 33.32 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
| 4 | 30 | 01 May 2024 | | 33.05 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||||
| 5 | 31 | 01 June 2024 | | 16.5 | 16.82 | 0.19 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
| 5 | 31 | 01 June 2024 | | 16.23 | 16.82 | 0.19 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||||
| 6 | 30 | 01 July 2024 | | 0.0 | 16.5 | 0.1 | 0.0 | 0.0 | 16.6 | 0.0 | 0.0 | 0.0 | 16.6 |
|
| 6 | 30 | 01 July 2024 | | 0.0 | 16.23 | 0.09 | 0.0 | 0.0 | 16.32 | 0.0 | 0.0 | 0.0 | 16.32 |
|
||||||
Then Loan Repayment schedule has the following data in Total row:
|
Then Loan Repayment schedule has the following data in Total row:
|
||||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||||
| 100.0 | 1.65 | 0.0 | 0.0 | 101.65 | 15.0 | 15.0 | 0.0 | 86.65 |
|
| 100.0 | 1.37 | 0.0 | 0.0 | 101.37 | 15.0 | 15.0 | 0.0 | 86.37 |
|
||||||
When Admin sets the business date to "5 March 2024"
|
When Admin sets the business date to "5 March 2024"
|
||||||
When Admin runs inline COB job for Loan
|
When Admin runs inline COB job for Loan
|
||||||
Then Loan Transactions tab has the following data:
|
Then Loan Transactions tab has the following data:
|
||||||
@@ -3928,23 +3928,6 @@ Feature: LoanAccrualActivity
|
|||||||
| 14 January 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
| 14 January 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
||||||
| 15 January 2024 | Repayment | 15.0 | 15.0 | 0.0 | 0.0 | 0.0 | 85.0 | false | false |
|
| 15 January 2024 | Repayment | 15.0 | 15.0 | 0.0 | 0.0 | 0.0 | 85.0 | false | false |
|
||||||
| 15 January 2024 | Accrual Adjustment | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
| 15 January 2024 | Accrual Adjustment | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
||||||
| 16 January 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 17 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 18 January 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 19 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 20 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 21 January 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 22 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 23 January 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 24 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 25 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 26 January 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 27 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 28 January 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 29 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 30 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 31 January 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 01 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
|
||||||
| 21 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
| 21 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
||||||
| 22 February 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
| 22 February 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false |
|
||||||
| 23 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
| 23 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
||||||
|
|||||||
@@ -251,6 +251,9 @@ Feature: Loan interest pause on repayment schedule
|
|||||||
Then Loan Repayment schedule has the following data in Total row:
|
Then Loan Repayment schedule has the following data in Total row:
|
||||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||||
| 100 | 1.57 | 0 | 0 | 101.57 | 0.0 | 0 | 0 | 101.57 |
|
| 100 | 1.57 | 0 | 0 | 101.57 | 0.0 | 0 | 0 | 101.57 |
|
||||||
|
When Admin sets the business date to "12 February 2024"
|
||||||
|
When Admin runs inline COB job for Loan
|
||||||
|
And Customer makes "AUTOPAY" repayment on "12 February 2024" with 0.01 EUR transaction amount
|
||||||
When Admin sets the business date to "15 March 2024"
|
When Admin sets the business date to "15 March 2024"
|
||||||
When Admin runs inline COB job for Loan
|
When Admin runs inline COB job for Loan
|
||||||
When Admin sets the business date to "5 April 2024"
|
When Admin sets the business date to "5 April 2024"
|
||||||
@@ -297,6 +300,7 @@ Feature: Loan interest pause on repayment schedule
|
|||||||
| 07 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
| 07 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
||||||
| 08 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
| 08 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
||||||
| 09 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
| 09 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
||||||
|
| 12 February 2024 | Repayment | 0.01 | 0.01 | 0.0 | 0.0 | 0.0 | 99.99 | false | false |
|
||||||
| 11 March 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
| 11 March 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
||||||
| 12 March 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
| 12 March 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
||||||
| 13 March 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
| 13 March 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false |
|
||||||
|
|||||||
+7
@@ -89,6 +89,13 @@ public class InterestPeriod implements Comparable<InterestPeriod> {
|
|||||||
zero.getMc(), false);
|
zero.getMc(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static InterestPeriod withEmptyAmounts(@NotNull RepaymentPeriod repaymentPeriod, @NotNull LocalDate fromDate, LocalDate dueDate,
|
||||||
|
boolean isPaused) {
|
||||||
|
final Money zero = repaymentPeriod.getEmi().zero();
|
||||||
|
return new InterestPeriod(repaymentPeriod, fromDate, dueDate, BigDecimal.ZERO, BigDecimal.ZERO, zero, zero, zero, zero, zero,
|
||||||
|
zero.getMc(), isPaused);
|
||||||
|
}
|
||||||
|
|
||||||
public static InterestPeriod withPausedAndEmptyAmounts(@NotNull RepaymentPeriod repaymentPeriod, @NotNull LocalDate fromDate,
|
public static InterestPeriod withPausedAndEmptyAmounts(@NotNull RepaymentPeriod repaymentPeriod, @NotNull LocalDate fromDate,
|
||||||
LocalDate dueDate) {
|
LocalDate dueDate) {
|
||||||
final Money zero = repaymentPeriod.getEmi().zero();
|
final Money zero = repaymentPeriod.getEmi().zero();
|
||||||
|
|||||||
+2
-1
@@ -246,12 +246,13 @@ public class ProgressiveLoanInterestScheduleModel {
|
|||||||
final InterestPeriod previousInterestPeriod = findPreviousInterestPeriod(repaymentPeriod, balanceChangeDate);
|
final InterestPeriod previousInterestPeriod = findPreviousInterestPeriod(repaymentPeriod, balanceChangeDate);
|
||||||
final LocalDate originalDueDate = previousInterestPeriod.getDueDate();
|
final LocalDate originalDueDate = previousInterestPeriod.getDueDate();
|
||||||
final LocalDate newDueDate = calculateNewDueDate(previousInterestPeriod, balanceChangeDate);
|
final LocalDate newDueDate = calculateNewDueDate(previousInterestPeriod, balanceChangeDate);
|
||||||
|
final boolean isPaused = previousInterestPeriod.isPaused();
|
||||||
|
|
||||||
previousInterestPeriod.setDueDate(newDueDate);
|
previousInterestPeriod.setDueDate(newDueDate);
|
||||||
previousInterestPeriod.addDisbursementAmount(disbursedAmount);
|
previousInterestPeriod.addDisbursementAmount(disbursedAmount);
|
||||||
previousInterestPeriod.addBalanceCorrectionAmount(correctionAmount);
|
previousInterestPeriod.addBalanceCorrectionAmount(correctionAmount);
|
||||||
|
|
||||||
final InterestPeriod interestPeriod = InterestPeriod.withEmptyAmounts(repaymentPeriod, newDueDate, originalDueDate);
|
final InterestPeriod interestPeriod = InterestPeriod.withEmptyAmounts(repaymentPeriod, newDueDate, originalDueDate, isPaused);
|
||||||
repaymentPeriod.getInterestPeriods().add(interestPeriod);
|
repaymentPeriod.getInterestPeriods().add(interestPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user