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


The following commit(s) were added to refs/heads/develop by this push:
     new 88635972e [FINERACT-1953] Matured on date fix
88635972e is described below

commit 88635972eb52d3c0beb5903e6c2225935367f1a7
Author: taskain7 <[email protected]>
AuthorDate: Tue Jul 18 10:56:54 2023 +0200

    [FINERACT-1953] Matured on date fix
---
 .../apache/fineract/portfolio/loanaccount/domain/Loan.java    |  2 +-
 .../integrationtests/LoanTransactionChargebackTest.java       | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git 
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
index 60da8b625..bc3964152 100644
--- 
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
+++ 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
@@ -7124,7 +7124,7 @@ public class Loan extends 
AbstractAuditableWithUTCDateTimeCustom {
     }
 
     public void handleMaturityDateActivate() {
-        if (this.expectedMaturityDate != null && this.actualMaturityDate == 
null) {
+        if (this.expectedMaturityDate != null && 
!this.expectedMaturityDate.equals(this.actualMaturityDate)) {
             this.actualMaturityDate = this.expectedMaturityDate;
         }
     }
diff --git 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java
 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java
index 12adba163..d01e31cd2 100644
--- 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java
+++ 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java
@@ -293,6 +293,8 @@ public class LoanTransactionChargebackTest {
             getLoansLoanIdResponse = 
loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId);
             assertNotNull(getLoansLoanIdResponse);
             loanTransactionHelper.validateLoanStatus(getLoansLoanIdResponse, 
"loanStatusType.closed.obligations.met");
+            assertNotNull(getLoansLoanIdResponse.getTimeline());
+            assertEquals(todaysDate, 
getLoansLoanIdResponse.getTimeline().getActualMaturityDate());
 
             reviewLoanTransactionRelations(loanId, transactionId, 0, 
Double.valueOf("0.00"));
 
@@ -308,6 +310,10 @@ public class LoanTransactionChargebackTest {
 
             
loanTransactionHelper.validateLoanPrincipalOustandingBalance(getLoansLoanIdResponse,
 Double.valueOf("500.00"));
 
+            assertNotNull(getLoansLoanIdResponse.getTimeline());
+            
assertEquals(getLoansLoanIdResponse.getTimeline().getExpectedMaturityDate(),
+                    
getLoansLoanIdResponse.getTimeline().getActualMaturityDate());
+
             // N+1 Scenario
             
loanTransactionHelper.printRepaymentSchedule(getLoansLoanIdResponse);
             getLoanRepaymentSchedule = 
getLoansLoanIdResponse.getRepaymentSchedule();
@@ -397,6 +403,11 @@ public class LoanTransactionChargebackTest {
         loanTransactionHelper.validateLoanStatus(getLoansLoanIdResponse, 
"loanStatusType.active");
 
         
loanTransactionHelper.validateLoanPrincipalOustandingBalance(getLoansLoanIdResponse,
 Double.valueOf("100.00"));
+
+        assertNotNull(getLoansLoanIdResponse.getTimeline());
+        
assertEquals(getLoansLoanIdResponse.getTimeline().getExpectedMaturityDate(),
+                getLoansLoanIdResponse.getTimeline().getActualMaturityDate());
+
         GetJournalEntriesTransactionIdResponse journalEntries = 
journalEntryHelper
                 .getJournalEntries("L" + chargebackTransactionId.toString());
         assertEquals(3L, journalEntries.getTotalFilteredRecords());

Reply via email to