Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

FINERACT-2929: Fix balance re-validation of undo, adjust, waive charge and pay charge after a force withdrawal - #7205

Open
nemux wants to merge 1 commit into
apache:developfrom
nemux:FINERACT-2929-v2
Open

nemux wants to merge 1 commit into
apache:developfrom
nemux:FINERACT-2929-v2

Conversation

@nemux

@nemux nemux commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up of FINERACT-2797 (#6631, merged).

After an authorized force withdrawal takes a savings account below its minimum required balance, a later undo, adjust, waive charge or pay charge on the same account fails with results.in.balance.going.negative, even after the balance has recovered. Those operations re-validate the whole history through SavingsAccount.validateAccountBalanceConstraints(String transactionAction, ...), which did not take the persisted is_force_transaction flag into account.

Changes

  • SavingsAccount: new overload of validateAccountBalanceConstraints(String, ...) that receives the force withdrawal configuration. A transaction flagged as a force withdrawal may keep the balance below the minimum required balance as long as it stays within the force withdrawal limit, the same rule applied when the withdrawal was made (isForceWithdrawalAllowed). The existing overload delegates with force withdrawal disabled, so other callers keep their behaviour.
  • SavingsAccountWritePlatformServiceJpaRepositoryImpl: undo, adjust, waive charge and both pay charge paths pass the force withdrawal configuration.
  • Adjusting a withdrawal (savings, fixed deposit, recurring deposit) now keeps the force flag of the original transaction (savingsAccountTransaction.isForceTransaction()).

Tests

New integration tests in SavingsAccountForceWithdrawalTest:

  • undo, adjust, waive charge and pay charge succeed after an earlier force withdrawal whose dip has recovered;
  • adjusting the forced withdrawal keeps it forced;
  • an undo that would take the balance beyond the force withdrawal limit is still rejected.

Notes

  • The fixed deposit and recurring deposit adjust paths only change to propagate the flag; they are not covered by the new integration tests.
  • The overdraft branch of the same validation is unchanged.

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

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.

1 participant