Skip to content

Commit 63d11df

Browse files
MarianaDmytrivBinariksbudaidev
authored andcommitted
FINERACT-2455: additional checks within e2e test scenarios for period payment rate change history
1 parent de8fa63 commit 63d11df

3 files changed

Lines changed: 62 additions & 5 deletions

File tree

.github/workflows/regression-safety-db-changes.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@ jobs:
107107
TEST_TENANT_ID: default
108108
INITIALIZATION_ENABLED: true
109109
EVENT_VERIFICATION_ENABLED: false
110+
# The PR workspace is downloaded pre-built, so every buildJavaSdk output (Avro schemas and
111+
# the OpenAPI clients) is already on disk. Regenerating them also drags in
112+
# :fineract-provider:resolve, which boots a second Spring context alongside the backend that
113+
# is already running and exhausts the runner. Do NOT use this in the `baseline` working
114+
# directory: that tree is a fresh checkout and has to generate its sources.
115+
SKIP_SDK_GEN: >-
116+
-x :fineract-avro-schemas:buildJavaSdk
117+
-x :fineract-client:buildJavaSdk
118+
-x :fineract-client-feign:buildJavaSdk
110119
# devRun connection args (reused across instances)
111120
DEVRUN_ARGS: >-
112121
--spring.datasource.hikari.driverClassName=org.postgresql.Driver
@@ -229,7 +238,7 @@ jobs:
229238
./gradlew --no-daemon --console=plain \
230239
:fineract-e2e-tests-runner:cucumber \
231240
-Pcucumber.tags="@RegressionSafety" \
232-
-x spotlessCheck
241+
-x spotlessCheck $SKIP_SDK_GEN
233242
234243
- name: "Instance #1: Stop backend"
235244
if: always()
@@ -262,7 +271,7 @@ jobs:
262271
# The liquibase-only profile sets web-application-type=none, so Spring Boot
263272
# exits naturally after migrations complete. The 600s timeout is a safety net
264273
# that FAILS the step if migrations hang — it is NOT treated as success.
265-
timeout 600 ./gradlew --no-daemon :fineract-provider:bootRun --args="\
274+
timeout 600 ./gradlew --no-daemon $SKIP_SDK_GEN :fineract-provider:bootRun --args="\
266275
--spring.profiles.active=liquibase-only \
267276
--spring.datasource.hikari.driverClassName=org.postgresql.Driver \
268277
--spring.datasource.hikari.jdbcUrl=jdbc:postgresql://localhost:5432/fineract_tenants \
@@ -324,7 +333,7 @@ jobs:
324333
./gradlew --no-daemon --console=plain \
325334
:fineract-e2e-tests-runner:cucumber \
326335
-Pcucumber.tags="@RegressionSafety" \
327-
-x spotlessCheck
336+
-x spotlessCheck $SKIP_SDK_GEN
328337
329338
- name: "Instance #2: Stop backend"
330339
if: always()
@@ -352,7 +361,7 @@ jobs:
352361
353362
- name: "Instance #3: Start PR backend"
354363
run: |
355-
./gradlew :fineract-provider:devRun --args="${DEVRUN_ARGS}" &
364+
./gradlew $SKIP_SDK_GEN :fineract-provider:devRun --args="${DEVRUN_ARGS}" &
356365
BACKEND_PID=$!
357366
echo $BACKEND_PID > backend.pid
358367
@@ -386,7 +395,7 @@ jobs:
386395
./gradlew --no-daemon --console=plain \
387396
:fineract-e2e-tests-runner:cucumber \
388397
-Pcucumber.tags="@RegressionSafety" \
389-
-x spotlessCheck
398+
-x spotlessCheck $SKIP_SDK_GEN
390399
391400
- name: "Instance #3: Stop backend"
392401
if: always()

fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/WorkingCapitalLoanAccountStepDef.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,15 @@ public void verifyWorkingCapitalLoanAccountData(final DataTable table) {
330330
log.info("Verified working capital loan account data for loan ID: {}", loanId);
331331
}
332332

333+
@And("Working capital loan account has the correct period payment rate history data:")
334+
public void verifyWorkingCapitalLoanAccountPeriodPaymentRateHistoryData(final DataTable table)
335+
throws InvocationTargetException, IllegalAccessException {
336+
final Long loanId = getCreatedLoanId();
337+
final GetWorkingCapitalLoansLoanIdResponse rateChangesHistoryResponse = retrieveLoanDetails(loanId);
338+
List<WorkingCapitalLoanPeriodPaymentRateChangeData> actualRateChanges = rateChangesHistoryResponse.getPeriodPaymentRateHistory();
339+
assertTable(WorkingCapitalLoanPeriodPaymentRateChangeData.class, table, actualRateChanges);
340+
}
341+
333342
@Then("Working capital loan details has the auto-generated fields present")
334343
public void verifyAutoGeneratedFieldsPresent() {
335344
final Long loanId = getCreatedLoanId();

fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalPeriodPaymentRate.feature

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@ Feature: Working Capital Period Payment Rate
371371
| Effective Date | Previous Rate | New Rate | Reversed |
372372
| 10 January 2026 | 18.0 | 11.0 | false |
373373
| 20 January 2026 | 11.0 | 20.0 | false |
374+
And Working capital loan account has the correct period payment rate history data:
375+
| effectiveDate | previousRate | newRate | eir | calculatedAnnualEIR | dailyPaymentAmount | discountAmount | outstandingBalanceAtSplit | segmentTerm | reversed |
376+
| 10 January 2026 | 18.0 | 11.0 | 0.000653823564 | 0.265288 | 30.56 | 1000.0 | 9000.0 | 328 | false |
377+
| 20 January 2026 | 11.0 | 20.0 | 0.001185944716 | 0.532173 | 55.56 | 1000.0 | 9000.0 | 180 | false |
374378
# The rate in force today is the latest change effective on or before it, which the backdated one sits behind.
375379
And Working Capital Loan period payment rate in effect is "20"
376380
And Admin retrieves the projected amortization schedule
@@ -433,6 +437,7 @@ Feature: Working Capital Period Payment Rate
433437
| 8 | 2026-01-09 | 50.00 | 8553.54 | 9.18 | 896.46 |
434438
| 9 | 2026-01-10 | 30.56 | 8550.84 | 5.73 | 899.91 |
435439
| 10 | 2026-01-11 | 30.56 | 8525.99 | 5.71 | 894.20 |
440+
Then a Working Capital Loan Period Payment Rate Changed business event is raised
436441
Then Admin closes the Working Capital loan with a full repayment on "20 January 2026"
437442

438443
@TestRailId:C93986
@@ -478,6 +483,10 @@ Feature: Working Capital Period Payment Rate
478483
| 32 | 2026-02-02 | 30.56 | 8050.85 | 5.28 | 788.04 |
479484
| 308 | 2026-11-05 | 30.56 | 402.45 | 0.28 | 1.88 |
480485
| 309 | 2026-11-06 | 30.56 | 372.16 | 0.26 | 1.62 |
486+
And Working capital loan account has the correct period payment rate history data:
487+
| effectiveDate | previousRate | newRate | eir | calculatedAnnualEIR | dailyPaymentAmount | discountAmount | outstandingBalanceAtSplit | segmentTerm | reversed |
488+
| 01 February 2026 | 18.0 | 11.0 | 0.000653988469 | 0.265363 | 30.56 | 798.62 | 8101.39 | 292 | false |
489+
Then a Working Capital Loan Period Payment Rate Changed business event is raised
481490
#--- the effective date arrives and the change is in force at once. The assertion sits before the COB run
482491
#--- deliberately: the rate in force is derived from the change history, so no job has to bring it up to date.
483492
When Admin sets the business date to "01 February 2026"
@@ -514,6 +523,11 @@ Feature: Working Capital Period Payment Rate
514523
| 10 January 2026 | 18.0 | 11.0 | true |
515524
| 10 January 2026 | 18.0 | 17.0 | false |
516525
| 20 January 2026 | 17.0 | 20.0 | false |
526+
And Working capital loan account has the correct period payment rate history data:
527+
| effectiveDate | previousRate | newRate | eir | calculatedAnnualEIR | dailyPaymentAmount | discountAmount | outstandingBalanceAtSplit | segmentTerm | reversed |
528+
| 10 January 2026 | 18.0 | 17.0 | 0.001008699894 | 0.437562 | 47.22 | 1000.0 | 9000.0 | 212 | false |
529+
| 20 January 2026 | 17.0 | 20.0 | 0.001185944716 | 0.532173 | 55.56 | 1000.0 | 9000.0 | 180 | false |
530+
| 10 January 2026 | 18.0 | 11.0 | 0.000653823564 | 0.265288 | 30.56 | 1000.0 | 9000.0 | 328 | true |
517531
And Working Capital Loan period payment rate in effect is "20"
518532
# The correction is scoped to 10 January onwards: period 8 is untouched, period 9 moves from the mistaken 30.56 to
519533
# 47.22, and the 20 January segment keeps its rate but is re-derived from the balance the corrected segment leaves.
@@ -598,6 +612,14 @@ Feature: Working Capital Period Payment Rate
598612
| 88 | 2026-03-30 | 55.56 | 5725.86 | 6.85 | 384.94 |
599613
| 89 | 2026-03-31 | 69.44 | 5664.89 | 8.47 | 376.47 |
600614
| 164 | 2026-06-14 | 69.44 | 825.40 | 1.32 | 7.96 |
615+
And Working capital loan account has the correct period payment rate history data:
616+
| effectiveDate | previousRate | asBookedPreviousRate | newRate | eir | calculatedAnnualEIR | dailyPaymentAmount | discountAmount | outstandingBalanceAtSplit | segmentTerm | reversed |
617+
| 31 March 2026 | 20.0 | 20.0 | 25.0 | 0.001479040398 | 0.702438 | 69.44 | 384.94 | 5725.86 | 89 | false |
618+
| 10 January 2026 | 18.0 | 18.0 | 13.0 | 0.000772167662 | 0.320319 | 36.11 | 1000.0 | 9000.0 | 277 | false |
619+
| 15 January 2026 | 13.0 | 11.0 | 19.0 | 0.001126887806 | 0.499979 | 52.78 | 1000.0 | 9000.0 | 190 | false |
620+
| 31 March 2026 | 20.0 | 20.0 | 15.0 | 0.000891376695 | 0.378165 | 41.67 | 384.94 | 5725.86 | 147 | true |
621+
| 20 January 2026 | 19.0 | 11.0 | 20.0 | 0.001185944716 | 0.532173 | 55.56 | 1000.0 | 9000.0 | 180 | false |
622+
| 10 January 2026 | 18.0 | 18.0 | 11.0 | 0.000653823564 | 0.265288 | 30.56 | 1000.0 | 9000.0 | 328 | true |
601623
Then Admin closes the Working Capital loan with a full repayment on "20 January 2026"
602624

603625
@TestRailId:C93989
@@ -631,6 +653,10 @@ Feature: Working Capital Period Payment Rate
631653
| 1 | 2026-01-02 | 47.22 | 8952.91 | 0.13 | 11.87 |
632654
| 221 | 2026-08-10 | 52.78 | 8781.12 | 0.14 | 11.42 |
633655
| 388 | 2027-01-24 | 31.06 | 0.00 | 0.00 | 0.00 |
656+
And Working capital loan account has the correct period payment rate history data:
657+
| effectiveDate | previousRate | newRate | eir | calculatedAnnualEIR | dailyPaymentAmount | discountAmount | outstandingBalanceAtSplit | segmentTerm | reversed |
658+
| 10 August 2026 | 15.0 | 19.0 | 0.000015517569 | 0.005602 | 52.78 | 11.56 | 8833.76 | 168 | false |
659+
| 01 August 2026 | 17.0 | 15.0 | 0.000012268024 | 0.004426 | 41.67 | 12.0 | 9000.0 | 217 | false |
634660
Then Admin closes the Working Capital loan with a full repayment on "06 August 2026"
635661

636662
@TestRailId:C93990
@@ -700,6 +726,10 @@ Feature: Working Capital Period Payment Rate
700726
| 185 | 2026-07-05 | 55.56 | 671.78 | 0.86 | 5.25 | | | | |
701727
| 186 | 2026-07-06 | 55.56 | 617.02 | 0.80 | 4.45 | | | | |
702728
| 198 | 2026-07-18 | 10.33 | 0.00 | 0.00 | 0.00 | | | | |
729+
And Working capital loan account has the correct period payment rate history data:
730+
| effectiveDate | previousRate | newRate | eir | calculatedAnnualEIR | dailyPaymentAmount | discountAmount | outstandingBalanceAtSplit | segmentTerm | reversed |
731+
| 10 January 2026 | 18.0 | 11.0 | 0.000653823564 | 0.265288 | 30.56 | 1000.0 | 9000.0 | 328 | false |
732+
| 20 January 2026 | 11.0 | 20.0 | 0.001185944716 | 0.532173 | 55.56 | 1000.0 | 9000.0 | 180 | false |
703733
Then Admin closes the Working Capital loan with a full repayment on "20 January 2026"
704734

705735
@TestRailId:C93991
@@ -750,6 +780,9 @@ Feature: Working Capital Period Payment Rate
750780
| 19 | 2026-01-20 | 41.67 | 8958.33 | 0.00 | 0.00 | | | | |
751781
| 20 | 2026-01-21 | 41.67 | 8916.66 | 0.00 | 0.00 | | | | |
752782
| 225 | 2026-08-14 | 41.67 | 374.31 | 0.00 | 0.00 | | | | |
783+
And Working capital loan account has the correct period payment rate history data:
784+
| effectiveDate | previousRate | newRate | eir | calculatedAnnualEIR | dailyPaymentAmount | discountAmount | outstandingBalanceAtSplit | segmentTerm | reversed |
785+
| 20 January 2026 | 18.0 | 15.0 | 0 | 0.000000 | 41.67 | 0.0 | 9000.0 | 216 | false |
753786
When Admin sets the business date to "25 January 2026"
754787
And Admin runs inline COB job for Working Capital Loan by loanId
755788
And Working Capital Loan period payment rate in effect is "15"
@@ -1837,6 +1870,9 @@ Feature: Working Capital Period Payment Rate
18371870
| 04 January 2026 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | false |
18381871
| 04 January 2026 | Discount Fee Amortization | 8.45 | | | | false |
18391872
| 21 January 2026 | Repayment | 55.56 | 55.56 | 0.0 | 0.0 | false |
1873+
And Working capital loan account has the correct period payment rate history data:
1874+
| effectiveDate | previousRate | newRate | eir | calculatedAnnualEIR | dailyPaymentAmount | discountAmount | outstandingBalanceAtSplit | segmentTerm | reversed |
1875+
| 20 January 2026 | 18.0 | 20.0 | 0.009339534392 | 27.406802 | 55.56 | 91.55 | 958.45 | 19 | false |
18401876
Then Admin closes the Working Capital loan with a full repayment on "21 January 2026"
18411877

18421878
@TestRailId:C94031
@@ -1942,6 +1978,9 @@ Feature: Working Capital Period Payment Rate
19421978
| 01 January 2026 | Disbursement | 1000.0 | 1000.0 | 0.0 | 0.0 | false |
19431979
| 01 January 2026 | Discount Fee | 100.0 | 100.0 | 0.0 | 0.0 | false |
19441980
| 21 January 2026 | Repayment | 55.56 | 55.56 | 0.0 | 0.0 | false |
1981+
And Working capital loan account has the correct period payment rate history data:
1982+
| effectiveDate | previousRate | newRate | eir | calculatedAnnualEIR | dailyPaymentAmount | discountAmount | outstandingBalanceAtSplit | segmentTerm | reversed |
1983+
| 20 January 2026 | 18.0 | 20.0 | 0.009340544948 | 27.417042 | 55.56 | 100.0 | 1000.0 | 20 | false |
19451984
Then Admin closes the Working Capital loan with a full repayment on "21 January 2026"
19461985

19471986
@TestRailId:C94032

0 commit comments

Comments
 (0)