Ralph Hopman created FINERACT-2565:
--------------------------------------
Summary: Batch API support for disburseToSavings,
paySavingsAccountCharge, createAccountTransfer
Key: FINERACT-2565
URL: https://issues.apache.org/jira/browse/FINERACT-2565
Project: Apache Fineract
Issue Type: Improvement
Components: Savings
Reporter: Ralph Hopman
Assignee: Ralph Hopman
The Fineract Batch API allows multiple API calls to be executed in a single
HTTP request via {{{}POST /v1/batch{}}}. Each request entry is routed to a
{{CommandStrategy}} based on its relative URL and HTTP method. Several common
loan and savings operations are currently missing from the batch routing table:
* *Disburse a loan to a linked savings account* ({{{}POST
loans/\{loanId}?command=disburseToSavings{}}})
* *Pay or waive a savings account charge* ({{{}POST
savingsaccounts/\{savingsAccountId}/charges/\{savingsAccountChargeId}?command=paycharge{}}}
and {{{}?command=waive{}}})
* *Create an account transfer* ({{{}POST accounttransfers{}}})
Attempting to include any of these in a batch request results in a {{501 Not
Implemented}} response from the {{UnknownCommandStrategy}} fallback.
h2. Proposed Solution
Implement and register the following new {{CommandStrategy}} beans:
h3. DisburseToSavingsCommandStrategy
* Handles {{POST loans/\{loanId}?command=disburseToSavings}}
* Extracts {{loanId}} from the URL path segment and delegates to
{{LoansApiResource#stateTransitions(loanId, "disburseToSavings", body)}}
h3. PaySavingsAccountChargeCommandStrategy
* Handles {{{}POST
savingsaccounts/\{savingsAccountId}/charges/\{savingsAccountChargeId}?command={command{}}}}
* Supported commands: {{{}paycharge{}}}, {{waive}}
* Extracts {{{}savingsAccountId{}}}, {{{}savingsAccountChargeId{}}}, and
{{command}} from the URL and delegates to
{{SavingsAccountChargesApiResource#payOrWaiveSavingsAccountCharge}}
* Returns {{501}} if no {{?command=}} query parameter is present
h3. CreateAccountTransferCommandStrategy
* Handles {{POST accounttransfers}}
* Builds a {{createAccountTransfer}} {{CommandWrapper}} and passes the raw
request body directly to
{{{}PortfolioCommandSourceWritePlatformService#logCommandSource{}}}, bypassing
the DTO round-trip in {{AccountTransfersApiResource}}
h3. CommandStrategyProvider registration
All three strategies will be registered in {{CommandStrategyProvider}}
alongside the existing routes.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)