Skip to content

Commit 92310fe

Browse files
committed
FINERACT-2181: added e2e test for validation of teschedule loan with interest rate change from / to zero
1 parent 64b5399 commit 92310fe

File tree

3 files changed

+142
-2
lines changed

3 files changed

+142
-2
lines changed

fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/LoanRescheduleErrorMessage.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ public enum LoanRescheduleErrorMessage {
2222

2323
LOAN_CHARGED_OFF("Loan: %s reschedule installment is not allowed. Loan Account is Charged-off"), //
2424
LOAN_RESCHEDULE_DATE_NOT_IN_FUTURE("Loan Reschedule From date (%s) for Loan: %s should be in the future."), //
25-
LOAN_LOCKED_BY_COB("Loan is locked by the COB job. Loan ID: %s");//
25+
LOAN_LOCKED_BY_COB("Loan is locked by the COB job. Loan ID: %s"), //
26+
LOAN_RESCHEDULE_NOT_ALLOWED_FROM_ZERO_TO_NEW_INTEREST_RATE("Loan rescheduling is not allowed from interest rate 0 (zero)"), //
27+
LOAN_RESCHEDULE_NOT_ALLOWED_FROM_CURRENT_INTEREST_RATE_TO_ZERO("The parameter `newInterestRate` must be greater than 0.");//
2628

2729
private final String messageTemplate;
2830

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ public void createLoanRescheduleError(int errorCodeExpected, String errorMessage
146146
String rescheduleFromDateFormatted = localDate.format(FORMATTER_HU);
147147
String errorMessageExpected = "";
148148
int expectedParameterCount = loanRescheduleErrorMessage.getExpectedParameterCount();
149-
if (expectedParameterCount == 1) {
149+
if (expectedParameterCount == 0) {
150+
errorMessageExpected = loanRescheduleErrorMessage.getMessageTemplate();
151+
} else if (expectedParameterCount == 1) {
150152
errorMessageExpected = loanRescheduleErrorMessage.getValue(loanId);
151153
} else if (expectedParameterCount == 2) {
152154
errorMessageExpected = loanRescheduleErrorMessage.getValue(rescheduleFromDateFormatted, loanId);

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

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,3 +919,139 @@ Feature: LoanReschedule
919919
And Loan Transactions tab has the following data:
920920
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
921921
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
922+
923+
@TestRailId:C3809
924+
Scenario: Verify change interest rate with 0->4 reschedule scenario - UC1
925+
When Admin sets the business date to "01 April 2025"
926+
When Admin creates a client with random data
927+
When Admin creates a fully customized loan with the following data:
928+
| 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 |
929+
| LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE | 01 April 2025 | 1000 | 0 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
930+
And Admin successfully approves the loan on "01 April 2025" with "1000" amount and expected disbursement date on "01 April 2025"
931+
When Admin successfully disburse the loan on "01 April 2025" with "1000" EUR transaction amount
932+
Then Loan Repayment schedule has 4 periods, with the following data for periods:
933+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
934+
| | | 01 April 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
935+
| 1 | 30 | 01 May 2025 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 |
936+
| 2 | 31 | 01 June 2025 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 |
937+
| 3 | 30 | 01 July 2025 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 |
938+
| 4 | 31 | 01 August 2025 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 |
939+
Then Loan Repayment schedule has the following data in Total row:
940+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
941+
| 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 |
942+
Then Loan Transactions tab has the following data:
943+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
944+
| 01 April 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
945+
When Admin sets the business date to "01 May 2025"
946+
And Admin runs inline COB job for Loan
947+
And Customer makes "AUTOPAY" repayment on "01 May 2025" with 250.0 EUR transaction amount
948+
Then Loan Repayment schedule has 4 periods, with the following data for periods:
949+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
950+
| | | 01 April 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
951+
| 1 | 30 | 01 May 2025 | 01 May 2025 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 |
952+
| 2 | 31 | 01 June 2025 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 |
953+
| 3 | 30 | 01 July 2025 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 |
954+
| 4 | 31 | 01 August 2025 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 |
955+
Then Loan Repayment schedule has the following data in Total row:
956+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
957+
| 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 |
958+
Then Loan Transactions tab has the following data:
959+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
960+
| 01 April 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
961+
| 01 May 2025 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | false |
962+
When Admin sets the business date to "05 May 2025"
963+
And Admin runs inline COB job for Loan
964+
# --- Loan reschedule: Interest rate modification effective from next day ---
965+
#When Admin attempt Loan reschedule with changing interest rate to zero following data validation error should occur
966+
Then Loan reschedule with the following data results a 400 error and "LOAN_RESCHEDULE_NOT_ALLOWED_FROM_ZERO_TO_NEW_INTEREST_RATE" error message
967+
| rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate |
968+
| 06 May 2025 | 05 May 2025 | | | | | 4 |
969+
When Admin sets the business date to "06 May 2025"
970+
And Customer makes "AUTOPAY" repayment on "06 May 2025" with 100.0 EUR transaction amount
971+
Then Loan Repayment schedule has 4 periods, with the following data for periods:
972+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
973+
| | | 01 April 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
974+
| 1 | 30 | 01 May 2025 | 01 May 2025 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 |
975+
| 2 | 31 | 01 June 2025 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 100.0 | 100.0 | 0.0 | 150.0 |
976+
| 3 | 30 | 01 July 2025 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 |
977+
| 4 | 31 | 01 August 2025 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 |
978+
Then Loan Repayment schedule has the following data in Total row:
979+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
980+
| 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 350.0 | 100.0 | 0.0 | 650.0 |
981+
Then Loan Transactions tab has the following data:
982+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
983+
| 01 April 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
984+
| 01 May 2025 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | false |
985+
| 06 May 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 650.0 | false | false |
986+
Then Loan status will be "ACTIVE"
987+
988+
@TestRailId:C3810
989+
Scenario: Verify change interest rate with 4->0 reschedule scenario - UC2
990+
When Admin sets the business date to "01 April 2025"
991+
When Admin creates a client with random data
992+
When Admin creates a fully customized loan with the following data:
993+
| 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 |
994+
| LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE | 01 April 2025 | 1000 | 4 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
995+
And Admin successfully approves the loan on "01 April 2025" with "1000" amount and expected disbursement date on "01 April 2025"
996+
When Admin successfully disburse the loan on "01 April 2025" with "1000" EUR transaction amount
997+
Then Loan Repayment schedule has 4 periods, with the following data for periods:
998+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
999+
| | | 01 April 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
1000+
| 1 | 30 | 01 May 2025 | | 751.24 | 248.76 | 3.33 | 0.0 | 0.0 | 252.09 | 0.0 | 0.0 | 0.0 | 252.09 |
1001+
| 2 | 31 | 01 June 2025 | | 501.65 | 249.59 | 2.5 | 0.0 | 0.0 | 252.09 | 0.0 | 0.0 | 0.0 | 252.09 |
1002+
| 3 | 30 | 01 July 2025 | | 251.23 | 250.42 | 1.67 | 0.0 | 0.0 | 252.09 | 0.0 | 0.0 | 0.0 | 252.09 |
1003+
| 4 | 31 | 01 August 2025 | | 0.0 | 251.23 | 0.84 | 0.0 | 0.0 | 252.07 | 0.0 | 0.0 | 0.0 | 252.07 |
1004+
Then Loan Repayment schedule has the following data in Total row:
1005+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
1006+
| 1000.0 | 8.34 | 0.0 | 0.0 | 1008.34 | 0.0 | 0.0 | 0.0 | 1008.34 |
1007+
Then Loan Transactions tab has the following data:
1008+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
1009+
| 01 April 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
1010+
When Admin sets the business date to "01 May 2025"
1011+
And Admin runs inline COB job for Loan
1012+
And Customer makes "AUTOPAY" repayment on "01 May 2025" with 252.09 EUR transaction amount
1013+
Then Loan Repayment schedule has 4 periods, with the following data for periods:
1014+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
1015+
| | | 01 April 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
1016+
| 1 | 30 | 01 May 2025 | 01 May 2025 | 751.24 | 248.76 | 3.33 | 0.0 | 0.0 | 252.09 | 252.09 | 0.0 | 0.0 | 0.0 |
1017+
| 2 | 31 | 01 June 2025 | | 501.65 | 249.59 | 2.5 | 0.0 | 0.0 | 252.09 | 0.0 | 0.0 | 0.0 | 252.09 |
1018+
| 3 | 30 | 01 July 2025 | | 251.23 | 250.42 | 1.67 | 0.0 | 0.0 | 252.09 | 0.0 | 0.0 | 0.0 | 252.09 |
1019+
| 4 | 31 | 01 August 2025 | | 0.0 | 251.23 | 0.84 | 0.0 | 0.0 | 252.07 | 0.0 | 0.0 | 0.0 | 252.07 |
1020+
Then Loan Repayment schedule has the following data in Total row:
1021+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
1022+
| 1000.0 | 8.34 | 0.0 | 0.0 | 1008.34 | 252.09 | 0.0 | 0.0 | 756.25 |
1023+
Then Loan Transactions tab has the following data:
1024+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
1025+
| 01 April 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
1026+
| 30 April 2025 | Accrual | 3.22 | 0.0 | 3.22 | 0.0 | 0.0 | 0.0 | false | false |
1027+
| 01 May 2025 | Repayment | 252.09 | 248.76 | 3.33 | 0.0 | 0.0 | 751.24 | false | false |
1028+
When Admin sets the business date to "05 May 2025"
1029+
And Admin runs inline COB job for Loan
1030+
# --- Loan reschedule: Interest rate modification effective from next day ---
1031+
#When Admin attempt Loan reschedule with changing interest rate from zero to 4 following data validation error should occur
1032+
Then Loan reschedule with the following data results a 400 error and "LOAN_RESCHEDULE_NOT_ALLOWED_FROM_CURRENT_INTEREST_RATE_TO_ZERO" error message
1033+
| rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate |
1034+
| 06 May 2025 | 05 May 2025 | | | | | 0 |
1035+
When Admin sets the business date to "06 May 2025"
1036+
And Customer makes "AUTOPAY" repayment on "06 May 2025" with 100.0 EUR transaction amount
1037+
Then Loan Repayment schedule has 4 periods, with the following data for periods:
1038+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
1039+
| | | 01 April 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
1040+
| 1 | 30 | 01 May 2025 | 01 May 2025 | 751.24 | 248.76 | 3.33 | 0.0 | 0.0 | 252.09 | 252.09 | 0.0 | 0.0 | 0.0 |
1041+
| 2 | 31 | 01 June 2025 | | 501.37 | 249.87 | 2.22 | 0.0 | 0.0 | 252.09 | 100.0 | 100.0 | 0.0 | 152.09 |
1042+
| 3 | 30 | 01 July 2025 | | 250.95 | 250.42 | 1.67 | 0.0 | 0.0 | 252.09 | 0.0 | 0.0 | 0.0 | 252.09 |
1043+
| 4 | 31 | 01 August 2025 | | 0.0 | 250.95 | 0.84 | 0.0 | 0.0 | 251.79 | 0.0 | 0.0 | 0.0 | 251.79 |
1044+
Then Loan Repayment schedule has the following data in Total row:
1045+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
1046+
| 1000.0 | 8.06 | 0.0 | 0.0 | 1008.06 | 352.09 | 100.0 | 0.0 | 655.97 |
1047+
Then Loan Transactions tab has the following data:
1048+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
1049+
| 01 April 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
1050+
| 30 April 2025 | Accrual | 3.22 | 0.0 | 3.22 | 0.0 | 0.0 | 0.0 | false | false |
1051+
| 01 May 2025 | Repayment | 252.09 | 248.76 | 3.33 | 0.0 | 0.0 | 751.24 | false | false |
1052+
| 01 May 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
1053+
| 02 May 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false |
1054+
| 03 May 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false |
1055+
| 04 May 2025 | Accrual | 0.08 | 0.0 | 0.08 | 0.0 | 0.0 | 0.0 | false | false |
1056+
| 06 May 2025 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 651.24 | false | false |
1057+
Then Loan status will be "ACTIVE"

0 commit comments

Comments
 (0)