Skip to content

FINERACT-2455: Working Capital product near breach configuration#5740

Open
alberto-art3ch wants to merge 1 commit intoapache:developfrom
openMF:FINERACT-2455/working-capital-product-near-breach-configuration
Open

FINERACT-2455: Working Capital product near breach configuration#5740
alberto-art3ch wants to merge 1 commit intoapache:developfrom
openMF:FINERACT-2455/working-capital-product-near-breach-configuration

Conversation

@alberto-art3ch
Copy link
Copy Markdown
Contributor

Description

User should be able to configure near breach at the product level(similar to Breach configuration), now with the next attributes:

  • Near Breach Threshold (% field)
  • Near Breach Evaluation Frequency
  • Near Breach Evaluation Frequency Type (DAYS, MONTHS, YEARS)

FINERACT-2455

Checklist

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

  • Write the commit message as per our guidelines
  • 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 our 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". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.

Your assigned reviewer(s) will follow our guidelines for code reviews.

@alberto-art3ch alberto-art3ch force-pushed the FINERACT-2455/working-capital-product-near-breach-configuration branch 5 times, most recently from a6f5a4d to 3f5d710 Compare April 8, 2026 05:05
@adamsaghy
Copy link
Copy Markdown
Contributor

@alberto-art3ch please rebase

@alberto-art3ch alberto-art3ch force-pushed the FINERACT-2455/working-capital-product-near-breach-configuration branch from 3f5d710 to a8de8ab Compare April 9, 2026 01:02
@alberto-art3ch
Copy link
Copy Markdown
Contributor Author

@alberto-art3ch please rebase

Done! Please review

@alberto-art3ch alberto-art3ch force-pushed the FINERACT-2455/working-capital-product-near-breach-configuration branch 2 times, most recently from cfc10f4 to 21f037c Compare April 9, 2026 18:29
Copy link
Copy Markdown
Contributor

@galovics galovics left a comment

Choose a reason for hiding this comment

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

Builds are failing, pls fix them.

@alberto-art3ch alberto-art3ch force-pushed the FINERACT-2455/working-capital-product-near-breach-configuration branch from 21f037c to 726b5bc Compare April 9, 2026 20:18
@alberto-art3ch
Copy link
Copy Markdown
Contributor Author

Builds are failing, pls fix them.

Done! Please review

@alberto-art3ch alberto-art3ch force-pushed the FINERACT-2455/working-capital-product-near-breach-configuration branch from 726b5bc to e956b9a Compare April 10, 2026 18:43
public class WorkingCapitalNearBreachNotFoundException extends AbstractPlatformResourceNotFoundException {

public WorkingCapitalNearBreachNotFoundException(final Long breachId) {
super("error.msg.wcl.breach.not.found", "Working Capital Near Breach with id " + breachId + " was not found.", breachId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The error code is the same as for breach. It probably should be error.msg.wcl.near.breach.not.found

}

if (this.value != null) {
final BigDecimal number = BigDecimal.valueOf(Double.parseDouble(this.value.toString()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This can be simplified to new BigDecimal(this.value.toString())

if (nearBreachId != null) {
final WorkingCapitalBreachData breachData = workingCapitalBreachReadPlatformService.retrieveOne(breachId);
final WorkingCapitalNearBreachData nearBreachData = workingCapitalNearBreachReadPlatformService.retrieveOne(nearBreachId);
if (FrequencyTypeUtil.compareFrequencies(nearBreachData.getFrequency(), nearBreachData.getFrequencyType().getCode(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we support partial updates? If yes, then we are losing this check, because at the beginning we check whether nearBreachIdParamName exists. On a partial update that changes only breachId (to a breach with a shorter frequency), the existing nearBreach on the product is not re-validated.

private final WorkingCapitalNearBreachReadPlatformService readPlatformService;

public WorkingCapitalNearBreachRequest validateAndParse(@NotNull final JsonCommand command) {
final DataValidatorBuilder dataValidator = new DataValidatorBuilder(new ArrayList<>()).resource("workingCapitalBreach.create");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe should be workingCapitalNearBreach.create

@Path("{breachId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(operationId = "retrieveWorkingCapitalNearBreach", summary = "Retrieve Working Capital Breach")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missed Near for summary

@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(operationId = "createWorkingCapitalNearBreach", summary = "Create Working Capital Breach")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missed Near for summary

@Path("{breachId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(operationId = "updateWorkingCapitalNearBreach", summary = "Update Working Capital Breach")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missed Near for summary

@Path("{breachId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(operationId = "deleteWorkingCapitalNearBreach", summary = "Delete Working Capital Breach")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missed Near for summary

@alberto-art3ch alberto-art3ch force-pushed the FINERACT-2455/working-capital-product-near-breach-configuration branch from e956b9a to 5ec60de Compare April 15, 2026 02:06
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.

4 participants