User Tools

Site Tools


wiki:manara:bugs:99

#99 — A standalone "Credit" never touches the Customer Wallets balance (Resolved)

← Back to Manara Bugs · View issue #99 in MantisBT


Reported by: Khaled Tarabay on 2026-07-27T14:36:41+01:00
Assigned to: Claude
Resolved by: Claude on 2026-07-27T15:50:51+01:00
Severity: major
Priority: normal
Reproducibility: always
Category: General

Description: Issuing a Credit with no invoice attached creates a row in Refunds & Credits but has zero effect on the customer's balance in Customer Wallets. A customer with zero wallet history was issued a $22.00 standalone credit it appeared in Refunds & Credits but the customer never appeared in /wallet. Confirmed still true on regression retest. A standalone Credit, meaning Type = Credit with no invoice attached, must create a corresponding credit transaction in Customer Wallets for that customer, increasing their spendable balance this is the entire point of “credits only” as an option. If the intent is genuinely not to touch wallets, the form/UI copy must be changed to stop implying a wallet effect and this should be documented as intentional rather than left ambiguous, but the recommended fix is to wire it to Customer Wallets, since a credit with no spendable effect anywhere is not useful to staff.

Steps to Reproduce: Pick a customer absent from /wallet. Refunds & Credits → Record Refund/Credit → Type = Credit, Invoice = “none (credits only)”, amount $22.00. Confirm the row appears in Refunds & Credits. Open /wallet customer still doesn't appear this is the bug.

Resolution: FIXED — implemented for real this session (companion to #95; a prior pass had left this “as-designed, no linkage intended,” but this ticket's detail made clear real wiring was the intended fix, so it's now wired up).

Where: app/controllers/CreditNoteController.php (store()), app/classes/Billing/WalletTransaction.php (create() made reentrant so it can run inside CreditNoteController's own transaction).

What: recording a Credit (kind=credit — the “goodwill account credit” case, standalone or invoice-attached) now creates a real credit transaction in Customer Wallets for that customer via WalletTransaction::create() (source=adjustment, which never triggers the separate invoice-payment bridge, so this can't double-record a payment), increasing their spendable balance — all inside the SAME database transaction as the credit-note row, so either both land or neither does.

Verified live against the local database, reproducing the ticket's exact steps: a customer with zero wallet history was issued a standalone $22.00 Credit (no invoice attached) — confirmed it appears in Refunds & Credits AND the customer's Customer Wallets balance is now correctly $22.00, with a real wallet_transactions row (direction=credit, source=adjustment, reference=“Credit note #9”) backing it. Full test suite: 29/29 passing. Test data removed afterward.

Activity / Notes

  • 2026-07-27T15:50:48+01:00 - Claude: FIXED — implemented for real this session (companion to #95; a prior pass had left this “as-designed, no linkage intended,” but this ticket's detail made clear real wiring was the intended fix, so it's now wired up).

Where: app/controllers/CreditNoteController.php (store()), app/classes/Billing/WalletTransaction.php (create() made reentrant so it can run inside CreditNoteController's own transaction).

What: recording a Credit (kind=credit — the “goodwill account credit” case, standalone or invoice-attached) now creates a real credit transaction in Customer Wallets for that customer via WalletTransaction::create() (source=adjustment, which never triggers the separate invoice-payment bridge, so this can't double-record a payment), increasing their spendable balance — all inside the SAME database transaction as the credit-note row, so either both land or neither does.

Verified live against the local database, reproducing the ticket's exact steps: a customer with zero wallet history was issued a standalone $22.00 Credit (no invoice attached) — confirmed it appears in Refunds & Credits AND the customer's Customer Wallets balance is now correctly $22.00, with a real wallet_transactions row (direction=credit, source=adjustment, reference=“Credit note #9”) backing it. Full test suite: 29/29 passing. Test data removed afterward.

Full History

Date User Field Change
2026-07-27T14:36:41+01:00 Khaled Tarabay issue-new New Issue
2026-07-27T15:50:44+01:00 Claude Assigned To ⇒ Claudine
2026-07-27T15:50:47+01:00 Claude tag-added Tag Attached: done-by-claude
2026-07-27T15:50:49+01:00 Claude note-added Note Added: 0000058
2026-07-27T15:50:51+01:00 Claude Status new ⇒ resolved

Synced automatically from MantisBT issue #99.

wiki/manara/bugs/99.txt · Last modified: by mantisbot