FINERACT-2413: e2e tests for re-amortization reverse-replay handling

This commit is contained in:
MarianaDmytrivBinariks
2025-12-18 12:37:52 +01:00
committed by Adam Saghy
parent 9e396b26a4
commit e8e9fb139d
2 changed files with 318 additions and 0 deletions
@@ -68,6 +68,18 @@ public class LoanReAmortizationStepDef extends AbstractStepDef {
testContext().set(TestContextKey.LOAN_REAMORTIZATION_RESPONSE, response);
}
@When("Admin creates a Loan re-amortization transaction on {string} date")
public void createLoanReAmortization(final String date) {
PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
long loanId = loanResponse.getLoanId();
PostLoansLoanIdTransactionsRequest reAmortizationRequest = LoanRequestFactory.defaultLoanReAmortizationRequest().startDate(date);
PostLoansLoanIdTransactionsResponse response = ok(() -> fineractClient.loanTransactions().executeLoanTransaction(loanId,
reAmortizationRequest, Map.of("command", "reAmortize")));
testContext().set(TestContextKey.LOAN_REAMORTIZATION_RESPONSE, response);
}
@When("Admin creates a Loan re-amortization transaction on current business date with reAmortizationInterestHandling {string}")
public void createLoanReAmortizationWithInterestHandling(final String reAmortizationInterestHandling) {
final PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
@@ -81,6 +93,19 @@ public class LoanReAmortizationStepDef extends AbstractStepDef {
testContext().set(TestContextKey.LOAN_REAMORTIZATION_RESPONSE, response);
}
@When("Admin creates a Loan re-amortization transaction on {string} date with reAmortizationInterestHandling {string}")
public void createLoanReAmortizationWithInterestHandling(final String date, final String reAmortizationInterestHandling) {
final PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
final Long loanId = loanResponse.getLoanId();
final PostLoansLoanIdTransactionsRequest reAmortizationRequest = LoanRequestFactory.defaultLoanReAmortizationRequest()
.reAmortizationInterestHandling(reAmortizationInterestHandling).startDate(date);
final PostLoansLoanIdTransactionsResponse response = ok(() -> fineractClient.loanTransactions().executeLoanTransaction(loanId,
reAmortizationRequest, Map.of("command", "reAmortize")));
testContext().set(TestContextKey.LOAN_REAMORTIZATION_RESPONSE, response);
}
@When("When Admin creates a Loan re-amortization transaction on current business date by loan external ID")
public void createLoanReAmortizationByLoanExternalId() {
PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);