FINERACT-1724: Batch API support for Loan chargeback and fineract client adjustments

This commit is contained in:
Arnold Galovics
2022-11-24 19:08:21 +01:00
committed by Arnold Gálovics
parent 729316e4a0
commit 1899b517b4
8 changed files with 165 additions and 5 deletions
@@ -94,7 +94,7 @@ public class CommandStrategyProvider {
"getChargeByIdCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\?(\\w+(\\=[\\w]+))").method("POST").build(),
"createTransactionLoanCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\/\\d+").method("POST").build(),
commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\/\\d+(\\?command=[\\w]+)?").method("POST").build(),
"adjustTransactionCommandStrategy");
commandStrategies.put(CommandContext.resource("clients\\/\\d+\\?command=activate").method("POST").build(),
"activateClientCommandStrategy");
@@ -59,7 +59,15 @@ public class AdjustTransactionCommandStrategy implements CommandStrategy {
// Get the loan and transaction ids for use in loanTransactionsApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
Long loanId = Long.parseLong(pathParameters.get(1));
Long transactionId = Long.parseLong(pathParameters.get(3));
final String transactionIdPathParameter = pathParameters.get(3);
Long transactionId;
if (transactionIdPathParameter.contains("?")) {
transactionId = Long.parseLong(pathParameters.get(3).substring(0, pathParameters.get(3).indexOf("?")));
} else {
transactionId = Long.parseLong(pathParameters.get(3));
}
Map<String, String> queryParameters = CommandStrategyUtils.getQueryParameters(relativeUrl);
String command = queryParameters.get("command");
@@ -976,6 +976,8 @@ final class LoansApiResourceSwagger {
public GetDelinquencyRangesResponse delinquencyRange;
@Schema(example = "false")
public Boolean fraud;
@Schema(example = "250.000000")
public Double totalOverpaid;
}
@Schema(description = "GetLoansResponse")
@@ -1049,6 +1051,8 @@ final class LoansApiResourceSwagger {
public List<PostLoansDisbursementData> disbursementData;
@Schema(description = "Maximum allowed outstanding balance")
public BigDecimal maxOutstandingLoanBalance;
@Schema(example = "[2011, 10, 20]")
public LocalDate repaymentsStartingFromDate;
}
@Schema(description = "PostLoansResponse")
@@ -1175,6 +1175,10 @@ final class LoanProductsApiResourceSwagger {
public GetLoanCharge charge;
public GetLoanAccountingMappings.GetLoanIncomeFromFeeAccount incomeAccount;
@Schema(example = "10")
public Long chargeId;
@Schema(example = "39")
public Long incomeAccountId;
}
@Schema(example = "11")