This is an automated email from the ASF dual-hosted git repository.

adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit 509cbd8b1905bd22ef5722b57ac4179dc539fcba
Author: Soma Sörös <[email protected]>
AuthorDate: Wed Apr 16 11:22:36 2025 +0200

    FINERACT-2264: Interest pause issue - Interest calculation start again in 
case of early repayment during interest period
---
 .../resources/features/LoanAccrualActivity.feature | 31 +++++-----------------
 .../resources/features/LoanInterestPause.feature   |  4 +++
 .../loanproduct/calc/data/InterestPeriod.java      |  7 +++++
 .../data/ProgressiveLoanInterestScheduleModel.java |  3 ++-
 4 files changed, 20 insertions(+), 25 deletions(-)

diff --git 
a/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature
 
b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature
index 71b9795953..a0ceb922f7 100644
--- 
a/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature
+++ 
b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature
@@ -3899,15 +3899,15 @@ Feature: LoanAccrualActivity
     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 |
       |    |      | 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     
   |
-      | 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    
   |
-      | 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    
   |
-      | 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    
   |
-      | 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    
   |
-      | 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     
   |
+      | 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.38           | 16.84     
    | 0.17     | 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.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.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.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:
       | 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 runs inline COB job for Loan
     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    |
       | 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    |
-      | 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    |
       | 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    |
diff --git 
a/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPause.feature
 
b/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPause.feature
index 56f4d5fbab..23d775711f 100644
--- 
a/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPause.feature
+++ 
b/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPause.feature
@@ -251,6 +251,9 @@ Feature: Loan interest pause on repayment schedule
     Then Loan Repayment schedule has the following data in Total row:
       | Principal due | Interest | Fees | Penalties | Due    | Paid | In 
advance | Late | Outstanding |
       | 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 runs inline COB job for Loan
     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    |
       | 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    |
+      | 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    |
       | 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    |
diff --git 
a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriod.java
 
b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriod.java
index 6c99aebe4f..4863125693 100644
--- 
a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriod.java
+++ 
b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriod.java
@@ -89,6 +89,13 @@ public class InterestPeriod implements 
Comparable<InterestPeriod> {
                 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,
             LocalDate dueDate) {
         final Money zero = repaymentPeriod.getEmi().zero();
diff --git 
a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/ProgressiveLoanInterestScheduleModel.java
 
b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/ProgressiveLoanInterestScheduleModel.java
index 5f5a63aa0b..51f568b27f 100644
--- 
a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/ProgressiveLoanInterestScheduleModel.java
+++ 
b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/ProgressiveLoanInterestScheduleModel.java
@@ -246,12 +246,13 @@ public class ProgressiveLoanInterestScheduleModel {
         final InterestPeriod previousInterestPeriod = 
findPreviousInterestPeriod(repaymentPeriod, balanceChangeDate);
         final LocalDate originalDueDate = previousInterestPeriod.getDueDate();
         final LocalDate newDueDate = 
calculateNewDueDate(previousInterestPeriod, balanceChangeDate);
+        final boolean isPaused = previousInterestPeriod.isPaused();
 
         previousInterestPeriod.setDueDate(newDueDate);
         previousInterestPeriod.addDisbursementAmount(disbursedAmount);
         previousInterestPeriod.addBalanceCorrectionAmount(correctionAmount);
 
-        final InterestPeriod interestPeriod = 
InterestPeriod.withEmptyAmounts(repaymentPeriod, newDueDate, originalDueDate);
+        final InterestPeriod interestPeriod = 
InterestPeriod.withEmptyAmounts(repaymentPeriod, newDueDate, originalDueDate, 
isPaused);
         repaymentPeriod.getInterestPeriods().add(interestPeriod);
     }
 

Reply via email to