Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public void createWorkingCapitalLoanProductWithBreachIdAndOverrides() {

@When("Admin creates a Working Capital Loan Product with custom breach config and overrides enabled:")
public void createWorkingCapitalLoanProductWithCustomBreachConfig(final DataTable table) {
final Map<String, String> data = table.asMaps().get(0);
final Map<String, String> data = table.asMaps().getFirst();

final String breachName = "WC Breach " + Utils.randomStringGenerator("", 10);
final WorkingCapitalBreachRequest breachRequest = new WorkingCapitalBreachRequest().name(breachName)
Expand Down Expand Up @@ -332,6 +332,47 @@ public void createWorkingCapitalLoanProductWithCustomBreachConfig(final DataTabl
checkWorkingCapitalLoanProductCreate();
}

@When("Admin creates a Working Capital Loan Product with breach and near breach config and overrides enabled:")
public void createWorkingCapitalLoanProductWithBreachAndNearBreachConfig(final DataTable table) {
final Map<String, String> data = table.asMaps().getFirst();

final String breachName = "WC Breach " + Utils.randomStringGenerator("", 10);
final WorkingCapitalBreachRequest breachRequest = new WorkingCapitalBreachRequest().name(breachName)
.breachFrequency(Integer.valueOf(data.get("breachFrequency"))).breachFrequencyType(data.get("breachFrequencyType"))
.breachAmountCalculationType(data.get("breachAmountCalculationType"))
.breachAmount(new BigDecimal(data.get("breachAmount")));
final CommandProcessingResult breachCreateResponse = ok(
() -> fineractFeignClient.workingCapitalBreaches().createWorkingCapitalBreach(breachRequest));
final Long breachId = breachCreateResponse.getResourceId();
testContext().set(TestContextKey.WORKING_CAPITAL_BREACH_ID, breachId);

final WorkingCapitalNearBreachRequest nearBreachRequest = new WorkingCapitalNearBreachRequest()
.nearBreachName("WC Near Breach " + Utils.randomStringGenerator("", 10))
.nearBreachFrequency(Integer.valueOf(data.get("nearBreachFrequency")))
.nearBreachFrequencyType(data.get("nearBreachFrequencyType"))
.nearBreachThreshold(new BigDecimal(data.get("nearBreachThreshold")));
final CommandProcessingResult nearBreachCreateResponse = ok(
() -> fineractFeignClient.workingCapitalNearBreaches().createWorkingCapitalNearBreach(nearBreachRequest));
final Long nearBreachId = nearBreachCreateResponse.getResourceId();
testContext().set(TestContextKey.WORKING_CAPITAL_NEAR_BREACH_ID, nearBreachId);

final String graceDaysStr = data.get("delinquencyGraceDays");
final Integer graceDays = graceDaysStr != null && !graceDaysStr.isEmpty() ? Integer.valueOf(graceDaysStr) : null;

final String name = DefaultWorkingCapitalLoanProduct.WCLP.getName() + Utils.randomStringGenerator("_", 10);
final PostWorkingCapitalLoanProductsRequest request = workingCapitalRequestFactory
.defaultWorkingCapitalLoanProductAllowAttributesOverrideRequest() //
.name(name) //
.breachId(breachId) //
.nearBreachId(nearBreachId) //
.delinquencyGraceDays(graceDays);

final PostWorkingCapitalLoanProductsResponse response = createWorkingCapitalLoanProduct(request);
testContext().set(TestContextKey.WORKING_CAPITAL_LOAN_PRODUCT_CREATE_RESPONSE, response);
testContext().set(TestContextKey.WORKING_CAPITAL_LOAN_PRODUCT_CREATE_REQUEST, request);
checkWorkingCapitalLoanProductCreate();
}

@When("Admin creates a new Working Capital Loan Product with external-id")
public void createWorkingCapitalLoanProductWithExternalId() {
final String workingCapitalProductDefaultName = DefaultWorkingCapitalLoanProduct.WCLP.getName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ Feature: Working Capital Delinquency Reschedule Action
| 1 | 01 January 2026 | 30 January 2026 | 100 | 0 | 100 | |
Then WC loan delinquency actions contain 2 actions

@TestRailId:C76652
Scenario: Verify that reschedule with no parameters is rejected
When Admin sets the business date to "01 January 2026"
When Admin creates a client with random data
Expand All @@ -500,6 +501,7 @@ Feature: Working Capital Delinquency Reschedule Action
When Admin runs inline COB job for Working Capital Loan
Then Admin fails to create WC delinquency reschedule action with no parameters with error containing "At least one of payment"

@TestRailId:C76653
Scenario: Verify that reschedule with minimumPayment but without minimumPaymentType is rejected
When Admin sets the business date to "01 January 2026"
When Admin creates a client with random data
Expand All @@ -515,6 +517,7 @@ Feature: Working Capital Delinquency Reschedule Action
| minimumPayment |
| 5 |

@TestRailId:C76654
Scenario: Verify that reschedule with frequency but without frequencyType is rejected
When Admin sets the business date to "01 January 2026"
When Admin creates a client with random data
Expand All @@ -530,6 +533,7 @@ Feature: Working Capital Delinquency Reschedule Action
| frequency |
| 30 |

@TestRailId:C76655
Scenario: Verify that reschedule with invalid minimumPaymentType is rejected
When Admin sets the business date to "01 January 2026"
When Admin creates a client with random data
Expand All @@ -545,6 +549,7 @@ Feature: Working Capital Delinquency Reschedule Action
| minimumPayment | minimumPaymentType |
| 5 | INVALID |

@TestRailId:C76656
Scenario: Verify that FLAT reschedule with COB generates periods with flat amount
When Admin sets the business date to "01 January 2026"
When Admin creates a client with random data
Expand All @@ -568,6 +573,7 @@ Feature: Working Capital Delinquency Reschedule Action
| 3 | 02 March 2026 | 31 March 2026 | 150 | 0 | 150 | false |
| 4 | 01 April 2026 | 30 April 2026 | 150 | 0 | 150 | |

@TestRailId:C76657
Scenario: Verify that reschedule with FLAT minimumPaymentType uses flat amount
When Admin sets the business date to "01 January 2026"
When Admin creates a client with random data
Expand All @@ -589,6 +595,8 @@ Feature: Working Capital Delinquency Reschedule Action
| action | startDate | minimumPayment | minimumPaymentType | frequency | frequencyType |
| RESCHEDULE | 01 January 2026 | 150 | FLAT | 30 | DAYS |

@Skip
@TestRailId:C76658
Scenario: Verify that reschedule with payment group only keeps original frequency
When Admin sets the business date to "01 January 2026"
When Admin creates a client with random data
Expand Down Expand Up @@ -618,6 +626,8 @@ Feature: Working Capital Delinquency Reschedule Action
| 7 | 30 June 2026 | 29 July 2026 | 100 | 0 | 100 | false |
| 8 | 30 July 2026 | 28 August 2026 | 100 | 0 | 100 | |

@Skip
@TestRailId:C76659
Scenario: Verify that reschedule with frequency group only keeps original payment
When Admin sets the business date to "01 January 2026"
When Admin creates a client with random data
Expand Down
Loading
Loading