Skip to content

FINERACT-2400: Transfer available savings balance when a standing instruction cannot be covered in full - #6421

Open
Abhishek6122008 wants to merge 1 commit into
apache:developfrom
Abhishek6122008:feature/FINERACT-2400-partial-standing-instruction-transfer
Open

FINERACT-2400: Transfer available savings balance when a standing instruction cannot be covered in full#6421
Abhishek6122008 wants to merge 1 commit into
apache:developfrom
Abhishek6122008:feature/FINERACT-2400-partial-standing-instruction-transfer

Conversation

@Abhishek6122008

@Abhishek6122008 Abhishek6122008 commented Sep 8, 2026

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.
  • If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.

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

… 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
Abhishek6122008 force-pushed the feature/FINERACT-2400-partial-standing-instruction-transfer branch from 13baf7a to 021c65e Compare September 8, 2026 18:50
@Abhishek6122008
Abhishek6122008 marked this pull request as draft September 9, 2026 04:21
@Abhishek6122008
Abhishek6122008 marked this pull request as ready for review September 10, 2026 10:07
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