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 0904c4f5302952da832135d8368724f088f8ba9d
Author: mariiaKraievska <[email protected]>
AuthorDate: Tue Feb 3 12:07:49 2026 +0200

    FINERACT-2421: Add pastDueDate to loan summary and event - E2E test
---
 .../test/stepdef/loan/InlineCOBStepDef.java        | 23 +++++++++
 .../fineract/test/stepdef/loan/LoanStepDef.java    |  1 +
 .../resources/features/LoanDelinquency.feature     | 54 ++++++++++++++++++++--
 3 files changed, 75 insertions(+), 3 deletions(-)

diff --git 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/InlineCOBStepDef.java
 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/InlineCOBStepDef.java
index 82f82e8a26..032dd96a4c 100644
--- 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/InlineCOBStepDef.java
+++ 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/InlineCOBStepDef.java
@@ -19,6 +19,7 @@
 package org.apache.fineract.test.stepdef.loan;
 
 import static org.apache.fineract.client.feign.util.FeignCalls.ok;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import io.cucumber.java.en.Then;
 import io.cucumber.java.en.When;
@@ -30,10 +31,12 @@ import org.apache.fineract.client.models.InlineJobRequest;
 import org.apache.fineract.client.models.PostLoansResponse;
 import org.apache.fineract.test.messaging.EventAssertion;
 import 
org.apache.fineract.test.messaging.event.assetexternalization.LoanAccountCustomSnapshotEvent;
+import org.apache.fineract.test.messaging.event.loan.LoanBalanceChangedEvent;
 import 
org.apache.fineract.test.messaging.event.loan.repayment.LoanRepaymentDueEvent;
 import 
org.apache.fineract.test.messaging.event.loan.repayment.LoanRepaymentOverdueEvent;
 import org.apache.fineract.test.stepdef.AbstractStepDef;
 import org.apache.fineract.test.support.TestContextKey;
+import org.junit.jupiter.api.Assertions;
 import org.springframework.beans.factory.annotation.Autowired;
 
 public class InlineCOBStepDef extends AbstractStepDef {
@@ -49,6 +52,7 @@ public class InlineCOBStepDef extends AbstractStepDef {
     @When("Admin runs inline COB job for Loan")
     public void runInlineCOB() throws IOException {
         PostLoansResponse loanResponse = 
testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+        Assertions.assertNotNull(loanResponse);
         long loanId = loanResponse.getLoanId();
 
         InlineJobRequest inlineJobRequest = new 
InlineJobRequest().addLoanIdsItem(loanId);
@@ -59,6 +63,7 @@ public class InlineCOBStepDef extends AbstractStepDef {
     @Then("Loan Repayment Due Business Event is created")
     public void checkLoanRepaymentDueBusinessEventCreated() {
         PostLoansResponse loanResponse = 
testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+        Assertions.assertNotNull(loanResponse);
         long loanId = loanResponse.getLoanId();
 
         eventAssertion.assertEventRaised(LoanRepaymentDueEvent.class, loanId);
@@ -67,6 +72,7 @@ public class InlineCOBStepDef extends AbstractStepDef {
     @Then("Loan Repayment Overdue Business Event is created")
     public void checkLoanRepaymentOverdueBusinessEventCreated() {
         PostLoansResponse loanResponse = 
testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+        Assertions.assertNotNull(loanResponse);
         long loanId = loanResponse.getLoanId();
 
         eventAssertion.assertEventRaised(LoanRepaymentOverdueEvent.class, 
loanId);
@@ -75,9 +81,26 @@ public class InlineCOBStepDef extends AbstractStepDef {
     @Then("LoanAccountCustomSnapshotBusinessEvent is created with business 
date {string}")
     public void 
checkLoanRepaymentDueBusinessEventCreatedWithBusinessDate(String 
expectedBusinessDate) {
         PostLoansResponse loanResponse = 
testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+        Assertions.assertNotNull(loanResponse);
         long loanId = loanResponse.getLoanId();
 
         LocalDate expectedBusinessDateParsed = 
LocalDate.parse(expectedBusinessDate, FORMATTER);
         eventAssertion.assertEvent(LoanAccountCustomSnapshotEvent.class, 
loanId).isRaisedOnBusinessDate(expectedBusinessDateParsed);
     }
+
+    @Then("LoanBalanceChangedBusinessEvent has pastDueDate {string}")
+    public void checkLoanBalanceChangedBusinessEventHasPastDueDate(final 
String expectedPastDueDate) {
+        final PostLoansResponse loanResponse = 
testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+        Assertions.assertNotNull(loanResponse);
+        final long loanId = loanResponse.getLoanId();
+
+        final String expectedPastDueDateValue = 
"null".equals(expectedPastDueDate) ? null : expectedPastDueDate;
+
+        eventAssertion.assertEvent(LoanBalanceChangedEvent.class, 
loanId).extractingData(loanAccountDataV1 -> {
+            final String actualPastDueDate = loanAccountDataV1.getDelinquent() 
== null ? null
+                    : loanAccountDataV1.getDelinquent().getPastDueDate();
+            assertThat(actualPastDueDate).as("pastDueDate in 
LoanBalanceChangedBusinessEvent").isEqualTo(expectedPastDueDateValue);
+            return null;
+        });
+    }
 }
diff --git 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java
 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java
index ecfd1bd889..c7c1887d7f 100644
--- 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java
+++ 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java
@@ -1622,6 +1622,7 @@ public class LoanStepDef extends AbstractStepDef {
                 .isEqualTo(statusExpected);//
         eventCheckHelper.disburseLoanEventCheck(loanId);
         
eventCheckHelper.loanDisbursalTransactionEventCheck(loanDisburseResponse);
+        eventCheckHelper.loanBalanceChangedEventCheck(loanId);
     }
 
     @And("Admin successfully add disbursement detail to the loan on {string} 
with {double} EUR transaction amount")
diff --git 
a/fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature 
b/fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature
index e0479d43fd..6204135ce6 100644
--- 
a/fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature
+++ 
b/fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature
@@ -2177,11 +2177,12 @@ Feature: LoanDelinquency
       | classification | delinquentAmount | delinquentDate   | delinquentDays 
| pastDueDays |
       | RANGE_90       | 666.68           | 06 February 2025 | 98             
| 103         |
 
+  @TestRailId:C4619
   Scenario: Verify that pastDueDate is returned correctly for overdue loan
     When Admin sets the business date to "01 October 2023"
     When Admin creates a client with random data
     When Admin creates a fully customized loan with the following data:
-      | LoanProduct                                                            
                           | submitted on date | with Principal | ANNUAL 
interest rate % | interest type | interest calculation period | amortization 
type  | loanTermFrequency | loanTermFrequencyType | repaymentEvery | 
repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | 
graceOnInterestPayment | interest free period | Payment strategy            |
+      | LoanProduct                                                            
                          | submitted on date | with Principal | ANNUAL 
interest rate % | interest type | interest calculation period | amortization 
type  | loanTermFrequency | loanTermFrequencyType | repaymentEvery | 
repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | 
graceOnInterestPayment | interest free period | Payment strategy            |
       | 
LP2_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY
 | 01 October 2023   | 1000           | 0                      | FLAT          
| SAME_AS_REPAYMENT_PERIOD    | EQUAL_INSTALLMENTS | 45                | DAYS   
               | 15             | DAYS                   | 3                  | 
0                       | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
     And Admin successfully approves the loan on "01 October 2023" with "1000" 
amount and expected disbursement date on "01 October 2023"
     When Admin successfully disburse the loan on "01 October 2023" with "1000" 
EUR transaction amount
@@ -2191,11 +2192,12 @@ Feature: LoanDelinquency
       | classification | delinquentAmount | delinquentDate  | pastDueDate     
| delinquentDays | pastDueDays |
       | RANGE_3        | 250.0            | 04 October 2023 | 01 October 2023 
| 6              | 9           |
 
+  @TestRailId:C4620
   Scenario: Verify that pastDueDate is null when loan has no overdue
     When Admin sets the business date to "01 October 2023"
     When Admin creates a client with random data
     When Admin creates a fully customized loan with the following data:
-      | LoanProduct                                                            
                           | submitted on date | with Principal | ANNUAL 
interest rate % | interest type | interest calculation period | amortization 
type  | loanTermFrequency | loanTermFrequencyType | repaymentEvery | 
repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | 
graceOnInterestPayment | interest free period | Payment strategy            |
+      | LoanProduct                                                            
                          | submitted on date | with Principal | ANNUAL 
interest rate % | interest type | interest calculation period | amortization 
type  | loanTermFrequency | loanTermFrequencyType | repaymentEvery | 
repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | 
graceOnInterestPayment | interest free period | Payment strategy            |
       | 
LP2_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY
 | 01 October 2023   | 1000           | 0                      | FLAT          
| SAME_AS_REPAYMENT_PERIOD    | EQUAL_INSTALLMENTS | 45                | DAYS   
               | 15             | DAYS                   | 3                  | 
0                       | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
     And Admin successfully approves the loan on "01 October 2023" with "1000" 
amount and expected disbursement date on "01 October 2023"
     When Admin successfully disburse the loan on "01 October 2023" with "1000" 
EUR transaction amount
@@ -2205,11 +2207,12 @@ Feature: LoanDelinquency
       | classification | delinquentAmount | delinquentDate | pastDueDate | 
delinquentDays | pastDueDays |
       | NO_DELINQUENCY | 0.0              | null           | null        | 0   
           | 0           |
 
+  @TestRailId:C4621
   Scenario: Verify that pastDueDate equals chargeback date when chargeback 
creates overdue
     When Admin sets the business date to "01 October 2023"
     When Admin creates a client with random data
     When Admin creates a fully customized loan with the following data:
-      | LoanProduct                                                            
                           | submitted on date | with Principal | ANNUAL 
interest rate % | interest type | interest calculation period | amortization 
type  | loanTermFrequency | loanTermFrequencyType | repaymentEvery | 
repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | 
graceOnInterestPayment | interest free period | Payment strategy            |
+      | LoanProduct                                                            
                          | submitted on date | with Principal | ANNUAL 
interest rate % | interest type | interest calculation period | amortization 
type  | loanTermFrequency | loanTermFrequencyType | repaymentEvery | 
repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | 
graceOnInterestPayment | interest free period | Payment strategy            |
       | 
LP2_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY
 | 01 October 2023   | 1000           | 0                      | FLAT          
| SAME_AS_REPAYMENT_PERIOD    | EQUAL_INSTALLMENTS | 45                | DAYS   
               | 15             | DAYS                   | 3                  | 
0                       | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
     And Admin successfully approves the loan on "01 October 2023" with "1000" 
amount and expected disbursement date on "01 October 2023"
     When Admin successfully disburse the loan on "01 October 2023" with "1000" 
EUR transaction amount
@@ -2221,3 +2224,48 @@ Feature: LoanDelinquency
     Then Loan has the following LOAN level delinquency data:
       | classification | delinquentAmount | delinquentDate  | pastDueDate     
| delinquentDays | pastDueDays |
       | RANGE_1        | 250.0            | 08 October 2023 | 05 October 2023 
| 2              | 5           |
+
+  @TestRailId:C4622
+  Scenario: Verify that pastDueDate is present in 
LoanBalanceChangedBusinessEvent for overdue loan
+    When Admin sets the business date to "01 October 2023"
+    When Admin creates a client with random data
+    When Admin creates a fully customized loan with the following data:
+      | LoanProduct                                                   | 
submitted on date | with Principal | ANNUAL interest rate % | interest type     
| interest calculation period | amortization type   | loanTermFrequency | 
loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | 
numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | 
interest free period | Payment strategy            |
+      | LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 
October 2023   | 1000           | 7                      | DECLINING_BALANCE | 
DAILY                       |  EQUAL_INSTALLMENTS | 45                | DAYS    
              | 15             | DAYS                   | 3                  | 
0                       | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "01 October 2023" with "1000" 
amount and expected disbursement date on "01 October 2023"
+    When Admin successfully disburse the loan on "01 October 2023" with "1000" 
EUR transaction amount
+    When Admin sets the business date to "20 October 2023"
+    And Create an interest pause period with start date "25 October 2023" and 
end date "30 October 2023"
+    And LoanBalanceChangedBusinessEvent has pastDueDate "2023-10-16"
+
+  @TestRailId:C4623
+  Scenario: Verify that pastDueDate is null in LoanBalanceChangedBusinessEvent 
when loan has no overdue
+    When Admin sets the business date to "01 October 2023"
+    When Admin creates a client with random data
+    When Admin creates a fully customized loan with the following data:
+      | LoanProduct                                                   | 
submitted on date | with Principal | ANNUAL interest rate % | interest type     
| interest calculation period | amortization type   | loanTermFrequency | 
loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | 
numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | 
interest free period | Payment strategy            |
+      | LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 
October 2023   | 1000           | 7                      | DECLINING_BALANCE | 
DAILY                       |  EQUAL_INSTALLMENTS | 45                | DAYS    
              | 15             | DAYS                   | 3                  | 
0                       | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "01 October 2023" with "1000" 
amount and expected disbursement date on "01 October 2023"
+    When Admin successfully disburse the loan on "01 October 2023" with "1000" 
EUR transaction amount
+    When Admin sets the business date to "16 October 2023"
+    And Customer makes "AUTOPAY" repayment on "16 October 2023" with 335.28 
EUR transaction amount
+    When Admin sets the business date to "20 October 2023"
+    And Create an interest pause period with start date "25 October 2023" and 
end date "30 October 2023"
+    And LoanBalanceChangedBusinessEvent has pastDueDate "null"
+
+  @TestRailId:C4624
+  Scenario: Verify that pastDueDate is present in 
LoanBalanceChangedBusinessEvent and equals chargeback date when chargeback 
creates overdue
+    When Admin sets the business date to "01 October 2023"
+    When Admin creates a client with random data
+    When Admin creates a fully customized loan with the following data:
+      | LoanProduct                                                   | 
submitted on date | with Principal | ANNUAL interest rate % | interest type     
| interest calculation period | amortization type   | loanTermFrequency | 
loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | 
numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | 
interest free period | Payment strategy            |
+      | LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 
October 2023   | 1000           | 7                      | DECLINING_BALANCE | 
DAILY                       |  EQUAL_INSTALLMENTS | 45                | DAYS    
              | 15             | DAYS                   | 3                  | 
0                       | 0                      | 0                    | 
ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "01 October 2023" with "1000" 
amount and expected disbursement date on "01 October 2023"
+    When Admin successfully disburse the loan on "01 October 2023" with "1000" 
EUR transaction amount
+    When Admin sets the business date to "16 October 2023"
+    And Customer makes "AUTOPAY" repayment on "16 October 2023" with 335.28 
EUR transaction amount
+    When Admin sets the business date to "20 October 2023"
+    When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 335.28 
EUR transaction amount
+    When Admin sets the business date to "25 October 2023"
+    And Create an interest pause period with start date "25 October 2023" and 
end date "30 October 2023"
+    Then LoanBalanceChangedBusinessEvent has pastDueDate "2023-10-20"

Reply via email to