FINERACT-2400: Transfer available savings balance when a standing instruction cannot be covered in full - #6421
Open
Abhishek6122008 wants to merge 1 commit into
Conversation
… instruction cannot be covered in full The standing instructions job was all-or-nothing: when the linked savings account could not cover the amount due, transferFunds threw InsufficientAccountBalanceException, the run was recorded as failed and nothing at all was collected. On a 40,000 installment with 39,900 available, the lender recovered zero. Standing instructions can now opt into partial collection through a new allow_partial_transfer flag. It defaults to false, so existing instructions and the one created automatically on disbursement keep the current behaviour. When the flag is set and the from account is a savings account, the job limits the transfer to SavingsAccount#getWithdrawableBalance, which already accounts for the minimum required balance where enforced, overdraft headroom, on-hold funds and hold amounts, and skips the instruction when nothing is available. The account is assembled in the job and handed to the transfer, so reading the balance costs no extra fetch. A partly covered run is recorded as 'partial' rather than 'success', with the amount actually transferred. Clamping only ever lowers an amount that would otherwise have been rejected, so a transfer that still fails falls through to the existing failed history row.
Abhishek6122008
force-pushed
the
feature/FINERACT-2400-partial-standing-instruction-transfer
branch
from
September 8, 2026 18:50
13baf7a to
021c65e
Compare
Abhishek6122008
marked this pull request as draft
September 9, 2026 04:21
Abhishek6122008
marked this pull request as ready for review
September 10, 2026 10:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!
Your assigned reviewer(s) will follow our guidelines for code reviews.