(root)/ – Rev 36429
Rev 36428 |
Rev 36430 |
Go to most recent revision |
Last modification |
Compare with Previous |
View Log
| RSS feed
Last modification
- Rev 36429 2026-04-29 18:41:19
- Author: amit
- Log message:
- Fix credit limit settlement not happening on billing and post-billing cancellation
createLoanForBilling has REQUIRES_NEW (added for lock isolation against
order row locks held by the billing method). Inside that new transaction it
queried orders to find which were just billed — but the billing timestamps
set in the suspended outer transaction are invisible, so the condition
always evaluates FALSE when all orders are billed in one call. The limit
block is never converted to a loan and never released.
Fix: remove the order query. The caller already passes invoiceAmount (sum
of walletAmount for the billed orders). Use it directly with Math.min to
cap at pendingAmount. REQUIRES_NEW kept for lock isolation.
Also: cancelInvoiceFully and applyInvoiceReturnViaCreditNote (post-billing
invoice cancellation/return paths) credit the partner wallet but never
settle the non-limit loan created during billing. Added settleLoan call
after wallet credit in both paths, guarded by settledOn == null check.
Data defect: 95 stuck limit blocks totaling Rs 56.95 lakh across partners.
Most have no actual loan created. Needs one-time remediation via
fixBlockedCredit() in ScheduledTasks.