FINERACT-1724: Swagger enhancements + Batch API enhancements
This commit is contained in:
committed by
Arnold Gálovics
parent
6c72ee49d8
commit
532bc507b6
+4
-13
@@ -35,12 +35,11 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class CommandStrategyProvider {
|
||||
|
||||
public static final String CREATE_TRANSACTION_LOAN_COMMAND_STRATEGY = "createTransactionLoanCommandStrategy";
|
||||
private final ApplicationContext applicationContext;
|
||||
private static final Map<CommandContext, String> commandStrategies = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Constructs a CommandStrategyProvider with argument of ApplicationContext type. It also initialize
|
||||
* Constructs a CommandStrategyProvider with argument of ApplicationContext type. It also initializes
|
||||
* commandStrategies using init() function by filling it with available CommandStrategies in
|
||||
* {@link org.apache.fineract.batch.command.internal}.
|
||||
*
|
||||
@@ -56,7 +55,7 @@ public class CommandStrategyProvider {
|
||||
|
||||
/**
|
||||
* Returns an appropriate commandStrategy after determining it using the CommandContext of the request. If no such
|
||||
* Strategy is found then a default strategy is returned back.
|
||||
* Strategy is found then a default strategy is returned.
|
||||
*
|
||||
* @param commandContext
|
||||
* @return CommandStrategy
|
||||
@@ -93,16 +92,8 @@ public class CommandStrategyProvider {
|
||||
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/charges").method("GET").build(), "collectChargesCommandStrategy");
|
||||
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/charges\\/\\d+").method("GET").build(),
|
||||
"getChargeByIdCommandStrategy");
|
||||
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\?command=repayment").method("POST").build(),
|
||||
CREATE_TRANSACTION_LOAN_COMMAND_STRATEGY);
|
||||
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\?command=creditBalanceRefund").method("POST").build(),
|
||||
CREATE_TRANSACTION_LOAN_COMMAND_STRATEGY);
|
||||
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\?command=goodwillCredit").method("POST").build(),
|
||||
CREATE_TRANSACTION_LOAN_COMMAND_STRATEGY);
|
||||
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\?command=merchantIssuedRefund").method("POST").build(),
|
||||
CREATE_TRANSACTION_LOAN_COMMAND_STRATEGY);
|
||||
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\?command=payoutRefund").method("POST").build(),
|
||||
CREATE_TRANSACTION_LOAN_COMMAND_STRATEGY);
|
||||
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\?(\\w+(\\=[\\w]+))").method("POST").build(),
|
||||
"createTransactionLoanCommandStrategy");
|
||||
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\/\\d+").method("POST").build(),
|
||||
"adjustTransactionCommandStrategy");
|
||||
commandStrategies.put(CommandContext.resource("clients\\/\\d+\\?command=activate").method("POST").build(),
|
||||
|
||||
+2
@@ -212,6 +212,8 @@ final class LoanTransactionsApiResourceSwagger {
|
||||
public String receiptNumber;
|
||||
@Schema(example = "ban123")
|
||||
public String bankNumber;
|
||||
@Schema(example = "3")
|
||||
public Integer loanChargeId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -84,6 +84,8 @@ public class CommandStrategyProviderTest {
|
||||
mock(CreateTransactionLoanCommandStrategy.class)),
|
||||
Arguments.of("loans/123/transactions?command=payoutRefund", HttpMethod.POST, "createTransactionLoanCommandStrategy",
|
||||
mock(CreateTransactionLoanCommandStrategy.class)),
|
||||
Arguments.of("loans/123/transactions?command=chargeRefund", HttpMethod.POST, "createTransactionLoanCommandStrategy",
|
||||
mock(CreateTransactionLoanCommandStrategy.class)),
|
||||
Arguments.of("loans/123/transactions/123", HttpMethod.POST, "adjustTransactionCommandStrategy",
|
||||
mock(AdjustTransactionCommandStrategy.class)),
|
||||
Arguments.of("clients/456?command=activate", HttpMethod.POST, "activateClientCommandStrategy",
|
||||
|
||||
Reference in New Issue
Block a user