Skip to content

FINERACT-2256: New command processing - Product Mix (org.apache.fineract.portfolio.loanproduct.productmix)#5622

Open
leonardoalunno wants to merge 1 commit intoapache:developfrom
leonardoalunno:FINERACT-2256-product-mix
Open

FINERACT-2256: New command processing - Product Mix (org.apache.fineract.portfolio.loanproduct.productmix)#5622
leonardoalunno wants to merge 1 commit intoapache:developfrom
leonardoalunno:FINERACT-2256-product-mix

Conversation

@leonardoalunno
Copy link

@leonardoalunno leonardoalunno commented Mar 15, 2026

Description

Describe the changes made and why they were made.

Ignore if these details are present on the associated Apache Fineract JIRA ticket.

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per https://github.com/apache/fineract/#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 for verifying the changes made.
  • Follow coding conventions at 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
  • Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)

FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.

@leonardoalunno leonardoalunno changed the title FINERACT-2256: migrate product mix to command pipeline FINERACT-2256: New command processing - Product Mix Mar 15, 2026
@leonardoalunno leonardoalunno changed the title FINERACT-2256: New command processing - Product Mix FINERACT-2256: New command processing - Product Mix (org.apache.fineract.portfolio.loanproduct.productmix) Mar 16, 2026
@leonardoalunno leonardoalunno force-pushed the FINERACT-2256-product-mix branch 2 times, most recently from 8571fd6 to b273343 Compare March 17, 2026 11:19
Copilot AI review requested due to automatic review settings March 17, 2026 11:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the Product Mix (loan product restriction rules) write-path to the new typed command processing pipeline (org.apache.fineract.command.*), replacing the legacy JsonCommand/CommandWrapper approach.

Changes:

  • Reworked Product Mix create/update/delete endpoints to send typed commands through CommandPipeline.
  • Updated handlers and write service APIs to accept typed request payloads (ProductMixCommandRequest, ProductMixDeleteRequest) instead of JsonCommand.
  • Refactored Product Mix validation away from JSON parsing toward list-based validation and added bean validation annotations to ProductMixRequest.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/service/ProductMixWritePlatformServiceJpaRepositoryImpl.java Updates write service methods to accept typed requests and adds a new typed delete operation.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/service/ProductMixWritePlatformService.java Updates service interface method signatures to typed requests.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/serialization/ProductMixDataValidator.java Replaces JSON-driven validation with List<Long> validation helpers.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/handler/CreateProductMixCommandHandler.java Migrates create handling to CommandHandler + resilience4j retry.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/handler/UpdateProductMixCommandHandler.java Migrates update handling to CommandHandler + resilience4j retry.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/handler/DeleteProductMixCommandHandler.java Migrates delete handling to CommandHandler + resilience4j retry.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/data/ProductMixRequest.java Adds Jakarta bean validation constraints for request body payloads.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/data/ProductMixDeleteRequest.java Introduces a typed delete request payload record.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/data/ProductMixCommandRequest.java Introduces a typed create/update request payload record.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/command/CreateProductMixCommand.java Introduces typed create command.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/command/UpdateProductMixCommand.java Introduces typed update command.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/command/DeleteProductMixCommand.java Introduces typed delete command.
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/api/ProductMixApiResource.java Switches REST endpoints from legacy command logging to CommandPipeline dispatch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 88 to 90
final Map<String, Object> changes = new LinkedHashMap<>();
changes.put("restrictedProductsForMix", restrictedProductsAsMap.keySet());
changes.put("restrictedProductsForMix", new ArrayList<>(restrictedProductsAsMap.keySet()));
changes.put("removedProductsForMix", removedRestrictions);
Comment on lines +1 to +5
package org.apache.fineract.portfolio.loanproduct.productmix.data;

import java.io.Serial;
import java.io.Serializable;
import lombok.Builder;
public void validateForCreate(final String json) {
if (StringUtils.isBlank(json)) {
throw new InvalidJsonException();
if (CollectionUtils.isEmpty(restrictedProducts)) {
Comment on lines +76 to +79
final Long productId = request.productId();
final Set<Long> restrictedIds = Set.copyOf(request.restrictedProducts());

final Set<String> restrictedIds = new HashSet<>(Arrays.asList(command.arrayValueOfParameterNamed("restrictedProducts")));
this.productMixDataValidator.validateRestrictedProductsForCreate(request.restrictedProducts());
@leonardoalunno leonardoalunno force-pushed the FINERACT-2256-product-mix branch from b273343 to 809bb71 Compare March 17, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants