fix(savings): stop crediting accounts automatically on activation

Activation for Savings, RD, FD and Current accounts no longer books an
opening deposit or enforces a minimum opening balance -- accounts go
active at zero balance and a clerk deposits funds afterward as a
separate transaction, matching how these branches actually operate.

Fixed Deposit and Recurring Deposit have their own override of
activateWithBalance() that a prior fix to the shared SavingsAccount
base class missed, so they kept auto-depositing after Savings was
already fixed. Removing that auto-deposit exposed two follow-on bugs
in the FD/RD activation flow, now also fixed:
- the opening deposit's journal entries were posted twice (once by the
  deposit helper, once by the activation command's own posting call)
- FD/RD maturity amount was computed from the account's real (now
  empty) transaction history at activation and never recalculated once
  a deposit actually landed, so it showed no projected interest until
  the account was reloaded from a lucky code path
This commit is contained in:
2026-08-19 10:34:54 +05:30
parent 14b2585cf5
commit 231919b62b
9 changed files with 88 additions and 217 deletions
@@ -3008,7 +3008,10 @@ public class SavingsAccount extends AbstractAuditableWithUTCDateTimeCustom<Long>
}
public Money activateWithBalance() {
return Money.of(this.currency, this.minRequiredOpeningBalance);
// Activation never deposits money -- funding happens strictly through a separate deposit
// transaction (posted by a clerk) after the account is already active, regardless of any
// minimum required opening balance the product has configured.
return Money.zero(this.currency);
}
public void approveAndActivateApplication(final LocalDate appliedonDate, final AppUser appliedBy) {
@@ -3700,10 +3703,10 @@ public class SavingsAccount extends AbstractAuditableWithUTCDateTimeCustom<Long>
}
private Money minRequiredBalanceDerived(final MonetaryCurrency currency) {
// Minimum required balance is not enforced -- withdrawals (and every other balance check
// that goes through this) must never be blocked by a configured minimum balance. Overdraft
// headroom is a separate concept and still applies.
Money minReqBalance = Money.zero(currency);
if (this.enforceMinRequiredBalance) {
minReqBalance = minReqBalance.plus(this.minRequiredBalance);
}
if (this.allowOverdraft) {
minReqBalance = minReqBalance.minus(this.overdraftLimit);
}