Wallets — system description

Data model of wallets and their entries, the role of the central wallet service, rules of manual correction, content scope and permission keys.

Overview

List of money balances (wallets): balance, reserved amount and entries (journal) of a client's or user's wallet. A wallet is money, not a quota. Entries are kept by the system's central wallet service (top-up, payment, reservation, reversal, expiry); this module displays them and records manual corrections.

Data model

Table names carry the installation's own prefix in the database.

TablePurposeMain fields
walletthe walletowner type (client or user), owner, currency, balance, reserved amount, status
wallet_transactionwallet entry (journal)event, amount, currency, source type, reference, state, expiry, date, executing user
companyname and company group of a client ownerfiltering and display

Process

  1. List: filter by company group, owner type, owner, currency, status; sort by owner, balance or currency; per row balance, reserved, negative flag, number of entries.
  2. Opening the entries: only for a permitted wallet.
  3. Manual correction: the correction method of the central service writes with event MANUAL_ADJUSTMENT, source source_type = manual, the given reference and the executing user; a negative amount goes through only if the balance covers it.

Permissions

  • Layer 1: the manual correction does not check modify permission on the path.
  • Layer 2: list, topup (manual credit and debit), debug. The menu item is shown when the list function is assigned. None of the keys is in the function catalogue, so in practice only the super admin gets them.
  • Layer 3: a non-super user sees only client wallets of permitted companies; user wallets are visible only to the super admin; entries and corrections also run only on permitted wallets.

Known limitations

  • The manual correction endpoint checks the function permission and the content scope, but not the modify permission of the path.
Related topics: wallet content scope permissions