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 a4e5f7e4e3 FINERACT-1597: Allow terminal period slab end values
a4e5f7e4e3 is described below

commit a4e5f7e4e3c8fd53559f8de5b04dd58995c1ee9f
Author: airajena <[email protected]>
AuthorDate: Sun Mar 1 15:32:15 2026 +0530

    FINERACT-1597: Allow terminal period slab end values
---
 .../domain/InterestRateChart.java                  |  3 ---
 .../domain/InterestRateChartSlabFields.java        |  5 -----
 .../domain/InterestRateChartValidationTest.java    | 22 ++++++++++++++++++++++
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git 
a/fineract-savings/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChart.java
 
b/fineract-savings/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChart.java
index a6a65ba741..e16b8fefc0 100644
--- 
a/fineract-savings/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChart.java
+++ 
b/fineract-savings/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChart.java
@@ -177,9 +177,6 @@ public class InterestRateChart extends 
AbstractPersistableCustom<Long> {
 
                     }
                 }
-            } else if (iSlabs.slabFields().isNotProperPriodEnd()) {
-                
baseDataValidator.failWithCodeNoParameterAddedToErrorCode("chart.slabs.range.end.incorrect",
 iSlabs.slabFields().toPeriod(),
-                        iSlabs.slabFields().getAmountRangeTo());
             }
         }
     }
diff --git 
a/fineract-savings/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java
 
b/fineract-savings/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java
index 2e97e34e93..5e6cefd363 100644
--- 
a/fineract-savings/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java
+++ 
b/fineract-savings/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java
@@ -247,11 +247,6 @@ public class InterestRateChartSlabFields {
                 && !(interestRateChartSlabFields.fromPeriod.equals(1) || 
interestRateChartSlabFields.fromPeriod.equals(0));
     }
 
-    public boolean isNotProperPriodEnd() {
-        return !(this.toPeriod == null && this.amountRangeTo == null);
-
-    }
-
     public boolean isRateChartOverlapping(final InterestRateChartSlabFields 
that, final boolean isPrimaryGroupingByAmount) {
         boolean isPeriodOverLapping = isPeriodOverlapping(that);
         boolean isAmountOverLapping = isAmountOverlapping(that);
diff --git 
a/fineract-savings/src/test/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartValidationTest.java
 
b/fineract-savings/src/test/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartValidationTest.java
index 4a88b32cb7..b2cebbcab0 100644
--- 
a/fineract-savings/src/test/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartValidationTest.java
+++ 
b/fineract-savings/src/test/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartValidationTest.java
@@ -20,11 +20,15 @@ package 
org.apache.fineract.portfolio.interestratechart.domain;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
+import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.fineract.infrastructure.core.data.ApiParameterError;
 import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
+import org.apache.fineract.portfolio.savings.SavingsPeriodFrequencyType;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -71,4 +75,22 @@ public class InterestRateChartValidationTest {
         // Check that arguments are present
         assertFalse(actualError.getArgs().isEmpty());
     }
+
+    @Test
+    public void 
testSinglePeriodChartSlabWithExplicitEndDoesNotFailValidation() {
+        InterestRateChartFields chartFields = 
InterestRateChartFields.createNew("chart", "chart", LocalDate.of(2022, 1, 1),
+                LocalDate.of(2022, 12, 31), false);
+        InterestRateChart chart = InterestRateChart.createNew(chartFields, 
List.of());
+
+        InterestRateChartSlabFields slabFields = 
InterestRateChartSlabFields.createNew("Level 1", 
SavingsPeriodFrequencyType.MONTHS, 0, 3,
+                null, null, new BigDecimal("12"), "USD");
+        InterestRateChartSlab.createNew(slabFields, chart);
+
+        DataValidatorBuilder validator = new 
DataValidatorBuilder(dataValidationErrors).resource("savings.interestRateChart")
+                .parameter("slabs");
+        chart.validateChartSlabs(validator);
+
+        assertTrue(dataValidationErrors.isEmpty(),
+                "Expected no validation error for a single well-formed period 
slab with explicit toPeriod");
+    }
 }

Reply via email to