oleksii-novikov-onix opened a new pull request, #6423:
URL: https://github.com/apache/fineract/pull/6423
## Description
Working Capital COB business steps could not be configured.
ConfigJobParameterServiceImpl checked every update against one list of
available steps, built once at startup for the Loan family
(afterPropertiesSet() cached the result for LOAN). The job name from the
request was not used to pick the step family, so any payload containing a
Working Capital step was rejected with "... Business steps are not configurable
for this job.", including every PUT to
/jobs/WORKING_CAPITAL_LOAN_CLOSE_OF_BUSINESS/steps.
The fix resolves the step family per job. BusinessStepCategoryService now
describes one family: its category, its COB job name and its business step base
type. ConfigJobParameterServiceImpl injects all implementations and looks up
the one whose job name matches the request.
WorkingCapitalLoanBusinessStepCategoryServiceImpl registers the Working Capital
family, LoanBusinessStepCategoryServiceImpl keeps the Loan one.
The same change closes two related defects.
Loan steps could be saved onto the Working Capital job, because they passed
the check against the cached Loan list. The result was a configuration that
never ran. The execution map is built by intersecting the configured step names
with the beans of the job's own family, so it came out empty, the batch job
stopped in the partitioner, and inline COB failed with "Execution map is
empty!".
A request that carried valid Loan step names was accepted under any job name
and wrote rows into m_batch_business_steps that no job would ever read. Unknown
job names now return 400.
Removing the startup cache also removes an applicationContext.getBean() call
during context refresh and a mutable field shared between requests. Available
steps are resolved per request instead.
API behaviour
GET /jobs/{jobName}/available-steps now also accepts a COB job name such as
WORKING_CAPITAL_LOAN_CLOSE_OF_BUSINESS. The old category name (loan, any case)
still works, and the response still echoes back the value that was passed in.
PUT /jobs/{jobName}/steps returns 400 for a name that is not a configurable
COB job. A category name like loan used to be accepted here together with valid
Loan steps, and wrote rows under that name which no job ever executed.
Testing
Six scenarios were added to WorkingCapital_COB.feature: available steps for
the WC job name, the WC job rejecting a Loan step, the Loan job rejecting a WC
step, an unknown job name being rejected, a reorder of all eight WC steps read
back through the API, and a WC COB run on a reordered configuration. Scenarios
that touch the configuration save it before and restore it after, so a failure
cannot leak into the rest of the suite.
BusinessConfigurationApiTest needed no changes.
shouldReturnApplyChargeToOverdueLoanStepConfigByJobCategory still sends the
category name loan and still gets it back as the response jobName.
Checklist
## Checklist
Please make sure these boxes are checked before submitting your pull request
- thanks!
- [ ] Write the commit message as per [our
guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
- [ ] Acknowledge that we will not review PRs that are not passing the build
_("green")_ - it is your responsibility to get a proposed PR to pass the build,
not primarily the project's maintainers.
- [ ] Create/update [unit or integration
tests](https://fineract.apache.org/docs/current/#_testing) for verifying the
changes made.
- [ ] Follow our [coding
conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions).
- [ ] Add required Swagger annotation and update API documentation at
fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with
details of any API changes
- [ ] [This PR must not be a "code
dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit).
Large changes can be made in a branch, with assistance. Ask for help on the
[developer mailing list](https://fineract.apache.org/#contribute).
- [ ] If merging this PR resolves a JIRA issue, I will mark that issue as
resolved and set "Fix Version/s" appropriately.
- [ ] I followed the [AI
Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy).
Your assigned reviewer(s) will follow our [guidelines for code
reviews](https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]