Skip to content

[Bug]: Wallet balance calculation double-reserves submitted usage and can mix reservations across companies #196

@my-dev-jour

Description

@my-dev-jour

Bug Description

Wallet balance calculation subtracts pending wallet payments in a way that includes already-submitted usage, even though submitted usage is already reflected in posted state.

The reservation pass also does not appear to be scoped consistently by company.

Expected Behavior

Wallet availability should:

  • reserve only draft / truly pending wallet usage
  • remain scoped to the correct company
  • not subtract submitted wallet consumption twice

Actual Behavior

Available wallet balance can be understated because submitted usage is counted again as pending, and reservations may leak across companies.

Steps to Reproduce

  1. Set up wallet usage for a customer in a multi-company or repeated-sale scenario
  2. Submit a wallet-backed sale
  3. Check the reported wallet availability for the same customer afterward
  4. Compare the result with actual posted wallet consumption

Impact

  • valid wallet payments may be rejected
  • available wallet balance can appear lower than it really is
  • multi-company setups risk cross-company contamination of wallet reservations

Suggested Fix

  • exclude submitted invoices from pending wallet reservation logic
  • scope wallet reservation queries by company
  • align wallet availability with actual posted state instead of double-reserving

Notes

This looks independent of coupon and partial-payment issues and affects wallet-backed checkout accuracy directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions