fix(cashier): post closure interest for real when the checkbox is ticked

Ticking "Close this account" on the Transaction Entry Action popup called
GET /clerk/closure-requests/preview/{id} -- a dry run that computed the
payout and immediately rolled it back, so the account's own balance stayed
unchanged until a manager later approved the closure.

Wired to the new POST /clerk/closure-requests/post-interest/{id} instead
(see the matching backend commit), which posts the interest for real and
returns the account's actual resulting balance. Renamed
ClerkClosureRequestService#preview to #postClosureInterest to match, and
reworded the popup copy and loading state so it no longer implies posting
happens later at Save ("posted to the account as of ..." instead of
"calculated to ... and posted the moment you press Save").

Also corrected a stale comment on the balance-check bypass for a pending
closure: it used to justify the bypass by saying interest was NOT YET
posted, which stopped being true the moment the checkbox itself started
posting it for real.
This commit is contained in:
2026-09-03 10:46:27 +05:30
parent d90719ad8d
commit 17942509de
3 changed files with 46 additions and 21 deletions
@@ -48,11 +48,11 @@ export class ClerkClosureRequestService {
return this.http.get(`/clerk/closure-requests/${id}`);
}
/** Preview of what the member would receive on closure. The backend dry-runs the very same
* interest posting that closing the account will perform, then rolls it back — so the figure
* matches the real payout to the paisa. Nothing is persisted. */
preview(savingsAccountId: number): Observable<any> {
return this.http.get(`/clerk/closure-requests/preview/${savingsAccountId}`);
/** Posts every rupee of interest the member has earned up to today straight onto the account —
* the same posting close() itself performs — and returns the resulting real balance. Not a dry
* run: ticking "Close this account" is meant to credit the interest immediately, not estimate it. */
postClosureInterest(savingsAccountId: number): Observable<any> {
return this.http.post(`/clerk/closure-requests/post-interest/${savingsAccountId}`, {});
}
approve(id: number): Observable<any> {