FINERACT-2311: added e2e tests for validation of buy down fees reversal of existing transaction

This commit is contained in:
Rustam Zeinalov
2025-07-30 18:43:55 +02:00
committed by Adam Saghy
parent e46a98065e
commit 59c98b7329
3 changed files with 206 additions and 1 deletions
@@ -179,6 +179,11 @@ public final class ErrorMessageHelper {
return "Capitalized income transaction cannot be reversed when non-reversed adjustment exists for it.";
}
public static String buyDownFeeUndoFailureAdjustmentExists(Long loanId) {
String loanIdStr = String.valueOf(loanId);
return String.format("Undo Loan Transaction: %s is not allowed. Loan transaction has not reversed transaction related", loanIdStr);
}
public static String wrongAmountInRepaymentSchedule(int line, BigDecimal actual, BigDecimal expected) {
String lineToStr = String.valueOf(line);
String actualToStr = actual.toString();
@@ -538,7 +538,13 @@ public class LoanRepaymentStepDef extends AbstractStepDef {
Response<PostLoansLoanIdTransactionsResponse> transactionUndoResponse = loanTransactionsApi
.adjustLoanTransaction(loanId, targetTransaction.getId(), transactionUndoRequest, "").execute();
checkMakeTransactionForbidden(transactionUndoResponse, 403, ErrorMessageHelper.addCapitalizedIncomeUndoFailureAdjustmentExists());
if (transactionType.equals("Buy Down Fee")) {
checkMakeTransactionForbidden(transactionUndoResponse, 403,
ErrorMessageHelper.buyDownFeeUndoFailureAdjustmentExists(targetTransaction.getId()));
} else if (transactionType.equals("Capitalized Income")) {
checkMakeTransactionForbidden(transactionUndoResponse, 403,
ErrorMessageHelper.addCapitalizedIncomeUndoFailureAdjustmentExists());
}
}
@When("Customer undo {string}th {string} transaction made on {string} with linked {string} transaction")