Skip to content

FINERACT-2455: Working Capital Loan Transaction Undo - Generic#5937

Draft
somasorosdpc wants to merge 1 commit into
apache:developfrom
openMF:FINERACT-2455/working-capital-transaction-undo-generic
Draft

FINERACT-2455: Working Capital Loan Transaction Undo - Generic#5937
somasorosdpc wants to merge 1 commit into
apache:developfrom
openMF:FINERACT-2455/working-capital-transaction-undo-generic

Conversation

@somasorosdpc

Copy link
Copy Markdown
Contributor

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 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.

@somasorosdpc somasorosdpc force-pushed the FINERACT-2455/working-capital-transaction-undo-generic branch 4 times, most recently from 153fdcd to e393d96 Compare June 9, 2026 12:40
@somasorosdpc somasorosdpc force-pushed the FINERACT-2455/working-capital-transaction-undo-generic branch from e393d96 to 91dbe49 Compare June 10, 2026 08:47
generated during loan approval/disbursement from the loan and product data.""")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Working Capital Loan not found") })
@Deprecated(forRemoval = true)

@adamsaghy adamsaghy Jun 10, 2026

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.

We have repayment, no need for this.
Should be deleted

throw new IllegalStateException("payment not found: date=" + paymentDate + " with amount=" + amount);
}
actualPayments.remove(first.get());
rebuildPayments();

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.

No need to rebuild everything... just the things after this operation...

WorkingCapitalLoanConstants.paymentDetailsParamName, WorkingCapitalLoanConstants.externalIdParameterName,
WorkingCapitalLoanConstants.discountExternalIdParameterName, WorkingCapitalLoanConstants.classificationIdParamName));

private static final Set<String> UNDO_TRANSACTION_SUPPORTED_PARAMETERS = new HashSet<>(Arrays.asList("locale", "dateFormat",

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.

id there is no transaction date or any other date, dateFormat parameter is not needed

.orElseThrow(() -> new IllegalStateException("Projected amortization schedule is not found for loan " + loan.getId()));

model.undoPayment(transactionDate, repaymentAmount);
model.recalculateNetAmortizationAndDeferredBalanceFrom(transactionDate);

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 should not be standalone operation but as side-effect of model.undoPayment

period.setBreach(null);
}
}
repository.saveAndFlush(period);

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.

Not needed

period.setDelinquentAmount(null);
period.setDelinquentDays(null);
}
loanDelinquencyRangeScheduleRepository.saveAndFlush(period);

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.

Not needed

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