leonardoalunno opened a new pull request, #5622:
URL: https://github.com/apache/fineract/pull/5622
## Overview
This PR migrates the `productmix` flow from the legacy command
infrastructure to the new `CommandPipeline`-based approach.
## What changed
- replaced usage of:
- `CommandWrapperBuilder`
- `PortfolioCommandSourceWritePlatformService`
- `NewCommandSourceHandler`
- introduced typed command requests/responses for product mix operations
- migrated create/update/delete handlers to `CommandHandler`
- switched API resource methods to use `CommandPipeline`
- removed legacy `ProductMixDataValidator`
- moved validation to:
- bean validation on request DTOs
- explicit create-time validation for empty `restrictedProducts`
## Main refactoring details
### API layer
`ProductMixApiResource` now:
- builds typed payloads
- sends commands through `CommandPipeline`
- returns `ProductMixResponse`
### Commands
Added/used:
- `CreateProductMixCommand`
- `UpdateProductMixCommand`
- `DeleteProductMixCommand`
### Request/response DTOs
- `ProductMixRequest`
- `ProductMixDeleteRequest`
- `ProductMixResponse`
### Handlers
Migrated handlers to:
- `CreateProductMixCommandHandler`
- `UpdateProductMixCommandHandler`
- `DeleteProductMixCommandHandler`
All now implement `CommandHandler<REQ, RES>`.
### Service layer
`ProductMixWritePlatformService` and its JPA implementation were updated to
work with typed request/response objects instead of `JsonCommand` /
`CommandProcessingResult`.
## Validation changes
- removed `ProductMixDataValidator`
- added bean validation to `ProductMixRequest`
- preserved create behavior by explicitly rejecting empty
`restrictedProducts` with `PlatformApiDataValidationException`
## Manual verification
Smoke-tested locally with `bootRun`.
Verified:
- `GET /fineract-provider/api/v1/loanproducts/1/productmix` returns
successfully
- `POST /fineract-provider/api/v1/loanproducts/1/productmix` with
non-existing restricted product returns expected `404`
- `PUT /fineract-provider/api/v1/loanproducts/1/productmix` with
non-existing restricted products returns expected `404`
- `DELETE /fineract-provider/api/v1/loanproducts/1/productmix` when no mix
exists returns expected `404`
Also verified:
- `spotlessCheck` passes
- `bootJar` build succeeds
## Notes
This keeps product mix behavior aligned with the new command pipeline
pattern already used in other modules.
--
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]