Skip to content

Commit e8e9fb1

Browse files
MarianaDmytrivBinariksadamsaghy
authored andcommitted
FINERACT-2413: e2e tests for re-amortization reverse-replay handling
1 parent 9e396b2 commit e8e9fb1

File tree

2 files changed

+318
-0
lines changed

2 files changed

+318
-0
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@ public void createLoanReAmortization() {
6868
testContext().set(TestContextKey.LOAN_REAMORTIZATION_RESPONSE, response);
6969
}
7070

71+
@When("Admin creates a Loan re-amortization transaction on {string} date")
72+
public void createLoanReAmortization(final String date) {
73+
PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
74+
long loanId = loanResponse.getLoanId();
75+
76+
PostLoansLoanIdTransactionsRequest reAmortizationRequest = LoanRequestFactory.defaultLoanReAmortizationRequest().startDate(date);
77+
78+
PostLoansLoanIdTransactionsResponse response = ok(() -> fineractClient.loanTransactions().executeLoanTransaction(loanId,
79+
reAmortizationRequest, Map.of("command", "reAmortize")));
80+
testContext().set(TestContextKey.LOAN_REAMORTIZATION_RESPONSE, response);
81+
}
82+
7183
@When("Admin creates a Loan re-amortization transaction on current business date with reAmortizationInterestHandling {string}")
7284
public void createLoanReAmortizationWithInterestHandling(final String reAmortizationInterestHandling) {
7385
final PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
@@ -81,6 +93,19 @@ public void createLoanReAmortizationWithInterestHandling(final String reAmortiza
8193
testContext().set(TestContextKey.LOAN_REAMORTIZATION_RESPONSE, response);
8294
}
8395

96+
@When("Admin creates a Loan re-amortization transaction on {string} date with reAmortizationInterestHandling {string}")
97+
public void createLoanReAmortizationWithInterestHandling(final String date, final String reAmortizationInterestHandling) {
98+
final PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
99+
final Long loanId = loanResponse.getLoanId();
100+
101+
final PostLoansLoanIdTransactionsRequest reAmortizationRequest = LoanRequestFactory.defaultLoanReAmortizationRequest()
102+
.reAmortizationInterestHandling(reAmortizationInterestHandling).startDate(date);
103+
104+
final PostLoansLoanIdTransactionsResponse response = ok(() -> fineractClient.loanTransactions().executeLoanTransaction(loanId,
105+
reAmortizationRequest, Map.of("command", "reAmortize")));
106+
testContext().set(TestContextKey.LOAN_REAMORTIZATION_RESPONSE, response);
107+
}
108+
84109
@When("When Admin creates a Loan re-amortization transaction on current business date by loan external ID")
85110
public void createLoanReAmortizationByLoanExternalId() {
86111
PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);

0 commit comments

Comments
 (0)