Skip to content

Commit a349027

Browse files
committed
FINERACT-2455: Added e2e tests for WC - Disbursement and Undo Disbursement Transactions
1 parent c25a27a commit a349027

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,13 @@ public void disburseWCLoanFailureWithNotApproved(String actualDisbursementDate,
752752
.contains(ErrorMessageHelper.disburseNotApprovedFailure(SUBMITTED_AND_PENDING_APPROVAL.name()));
753753
}
754754

755+
@Then("Admin fails to disburse the Working Capital loan on {string} with {string} EUR transaction amount because of loan status {string} with status code {int}")
756+
public void disburseWCLoanFailureDueToStatus(String actualDisbursementDate, String transactionAmount, String loanStatus,
757+
int statusCode) {
758+
disburseWCLoanFailure(actualDisbursementDate, transactionAmount, statusCode,
759+
ErrorMessageHelper.disburseNotApprovedFailure(loanStatus));
760+
}
761+
755762
@Then("Admin fails to disburse the Working Capital loan on {string} with {string} EUR transaction amount with invalid data outcomes with error message {string}")
756763
public void disburseWCLoanFailureWithInvalidData(String actualDisbursementDate, String transactionAmount,
757764
String errorMessageDescription) {
@@ -939,6 +946,15 @@ private List<String> fetchValuesOfWorkingCapitalLoan(final List<String> header,
939946
: new Utils.DoubleFormatter(response.getPeriodPaymentRate().doubleValue()).format());
940947
case "discount" -> actualValues.add(
941948
response.getDiscount() == null ? "null" : new Utils.DoubleFormatter(response.getDiscount().doubleValue()).format());
949+
case "totalPaidPrincipal" ->
950+
actualValues.add(response.getBalance() == null || response.getBalance().getTotalPaidPrincipal() == null ? null
951+
: new Utils.DoubleFormatter(response.getBalance().getTotalPaidPrincipal().doubleValue()).format());
952+
case "realizedIncome" ->
953+
actualValues.add(response.getBalance() == null || response.getBalance().getRealizedIncome() == null ? null
954+
: new Utils.DoubleFormatter(response.getBalance().getRealizedIncome().doubleValue()).format());
955+
case "unrealizedIncome" ->
956+
actualValues.add(response.getBalance() == null || response.getBalance().getUnrealizedIncome() == null ? null
957+
: new Utils.DoubleFormatter(response.getBalance().getUnrealizedIncome().doubleValue()).format());
942958
default -> throw new IllegalStateException(String.format("Header name %s cannot be found", headerName));
943959
}
944960
}

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

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,19 @@ Feature: WorkingCapitalLoanAccount
789789
Then Verify Working Capital loan disbursement transaction has classification
790790
Then Working Capital loan status will be "ACTIVE"
791791

792+
@TestRailId:C74515
793+
Scenario: Verify that multi-disbursement is not allowed on WCL loan account - UC2.2
794+
When Admin sets the business date to "01 January 2026"
795+
And Admin creates a client with random data
796+
And Admin creates a working capital loan with the following data:
797+
| LoanProduct | submittedOnDate | expectedDisbursementDate | principalAmount | totalPayment | periodPaymentRate | discount |
798+
| WCLP | 01 January 2026 | 01 January 2026 | 100 | 100 | 1 | 0 |
799+
Then Working capital loan creation was successful
800+
Then Admin successfully approves the working capital loan on "01 January 2026" with "100" amount and expected disbursement date on "01 January 2026"
801+
Then Admin successfully disburse the Working Capital loan on "01 January 2026" with "100" EUR transaction amount
802+
Then Working Capital loan status will be "ACTIVE"
803+
Then Admin fails to disburse the Working Capital loan on "01 January 2026" with "50" EUR transaction amount because of loan status "ACTIVE" with status code 400
804+
792805
@TestRailId:C72373
793806
Scenario Outline: Disburse WCL loan account with invalid data outcomes with an error - UC3
794807
When Admin sets the business date to "01 January 2026"
@@ -849,6 +862,23 @@ Feature: WorkingCapitalLoanAccount
849862
| product.name | submittedOnDate | expectedDisbursementDate | status | principal | approvedPrincipal | totalPayment | periodPaymentRate | discount |
850863
| WCLP | 2026-01-01 | 2026-01-01 | Approved | 100.0 | 100.0 | 100.0 | 1.0 | 0.0 |
851864

865+
@TestRailId:C74516
866+
Scenario: Verify that undo disbursal of WCL account reverts all balance fields - UC5.1
867+
When Admin sets the business date to "01 January 2026"
868+
And Admin creates a client with random data
869+
And Admin creates a working capital loan with the following data:
870+
| LoanProduct | submittedOnDate | expectedDisbursementDate | principalAmount | totalPayment | periodPaymentRate | discount |
871+
| WCLP | 01 January 2026 | 01 January 2026 | 100 | 100 | 1 | 0 |
872+
Then Working capital loan creation was successful
873+
Then Admin successfully approves the working capital loan on "01 January 2026" with "100" amount and expected disbursement date on "01 January 2026"
874+
Then Admin successfully disburse the Working Capital loan on "01 January 2026" with "100" EUR transaction amount
875+
Then Working Capital loan status will be "ACTIVE"
876+
Then Admin successfully undo Working Capital disbursal
877+
Then Working Capital loan status will be "APPROVED"
878+
And Working capital loan account has the correct data:
879+
| product.name | submittedOnDate | expectedDisbursementDate | status | principal | approvedPrincipal | totalPayment | periodPaymentRate | discount | totalPaidPrincipal | realizedIncome | unrealizedIncome |
880+
| WCLP | 2026-01-01 | 2026-01-01 | Approved | 100.0 | 100.0 | 100.0 | 1.0 | 0.0 | 0.0 | 0.0 | 0.0 |
881+
852882
@TestRailId:C72376
853883
Scenario: Undo disbursal of WCL account that is submitted or approved is failed - UC6
854884
When Admin sets the business date to "01 January 2026"
@@ -889,6 +919,29 @@ Feature: WorkingCapitalLoanAccount
889919
| product.name | submittedOnDate | expectedDisbursementDate | status | principal | approvedPrincipal | totalPayment | periodPaymentRate | discount |
890920
| WCLP | 2026-01-01 | 2026-01-01 | Approved | 100.0 | 100.0 | 100.0 | 1.0 | 0.0 |
891921

922+
@TestRailId:C74517
923+
Scenario: Verify that WCL disbursement with classification triggers correct events on disburse and undo - UC7.1
924+
When Admin sets the business date to "01 January 2026"
925+
And Admin creates a client with random data
926+
And Admin creates a working capital loan with the following data:
927+
| LoanProduct | submittedOnDate | expectedDisbursementDate | principalAmount | totalPayment | periodPaymentRate | discount |
928+
| WCLP | 01 January 2026 | 01 January 2026 | 100 | 100 | 1 | 0 |
929+
Then Working capital loan creation was successful
930+
Then Admin successfully approves the working capital loan on "01 January 2026" with "100" amount and expected disbursement date on "01 January 2026"
931+
Then Admin successfully disburse the Working Capital loan on "01 January 2026" with "100" EUR transaction amount and valid classification
932+
Then Verify Working Capital loan disbursement transaction has classification
933+
Then Working Capital disbursal transaction business event is raised with "100" amount and reversed "false"
934+
Then Working Capital loan status will be "ACTIVE"
935+
And Working capital loan account has the correct data:
936+
| product.name | submittedOnDate | expectedDisbursementDate | status | principal | approvedPrincipal | totalPayment | periodPaymentRate | discount |
937+
| WCLP | 2026-01-01 | 2026-01-01 | Active | 100.0 | 100.0 | 100.0 | 1.0 | 0.0 |
938+
Then Admin successfully undo Working Capital disbursal
939+
Then Working Capital undo disbursal transaction business event is raised with "100" amount and reversed "true"
940+
Then Working Capital loan status will be "APPROVED"
941+
And Working capital loan account has the correct data:
942+
| product.name | submittedOnDate | expectedDisbursementDate | status | principal | approvedPrincipal | totalPayment | periodPaymentRate | discount | totalPaidPrincipal | realizedIncome | unrealizedIncome |
943+
| WCLP | 2026-01-01 | 2026-01-01 | Approved | 100.0 | 100.0 | 100.0 | 1.0 | 0.0 | 0.0 | 0.0 | 0.0 |
944+
892945
@TestRailId:C74471
893946
Scenario Outline: Verify WC Loan creation with invalid breachId results in error
894947
When Admin sets the business date to "01 January 2027"

0 commit comments

Comments
 (0)