FINERACT-2081: Allow loan charge-off via batch api

This commit is contained in:
adam.magyari
2025-02-13 09:51:58 +01:00
committed by Adam Saghy
parent 2ce1ece4ae
commit e2157501c0
6 changed files with 90 additions and 3 deletions
@@ -65,7 +65,7 @@ public class CreateTransactionByLoanExternalIdCommandStrategy implements Command
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final String loanExternalId = pathParameters.get(2);
final Pattern commandPattern = Pattern.compile("^?command=[a-zA-Z]+");
final Pattern commandPattern = Pattern.compile("^?command=[a-zA-Z\\-]+");
final Matcher commandMatcher = commandPattern.matcher(pathParameters.get(3));
if (!commandMatcher.find()) {
@@ -64,7 +64,7 @@ public class CreateTransactionLoanCommandStrategy implements CommandStrategy {
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long loanId = Long.parseLong(pathParameters.get(1));
final Pattern commandPattern = Pattern.compile("^?command=[a-zA-Z]+");
final Pattern commandPattern = Pattern.compile("^?command=[a-zA-Z\\-]+");
final Matcher commandMatcher = commandPattern.matcher(pathParameters.get(2));
if (!commandMatcher.find()) {
@@ -140,6 +140,8 @@ public class CommandStrategyProviderTest {
mock(CreateTransactionLoanCommandStrategy.class)),
Arguments.of("loans/123/transactions?command=chargeRefund", HttpMethod.POST, "createTransactionLoanCommandStrategy",
mock(CreateTransactionLoanCommandStrategy.class)),
Arguments.of("loans/123/transactions?command=charge-off", HttpMethod.POST, "createTransactionLoanCommandStrategy",
mock(CreateTransactionLoanCommandStrategy.class)),
Arguments.of("loans/123/transactions/123", HttpMethod.POST, "adjustLoanTransactionCommandStrategy",
mock(AdjustLoanTransactionCommandStrategy.class)),
Arguments.of("loans/123/transactions/123?command=chargeback", HttpMethod.POST, "adjustLoanTransactionCommandStrategy",