accounts.hrl 1.0 KB

123456789101112131415161718192021222324252627
  1. -type currency() :: internal | quota | game_points | money | bonus.
  2. -type account_id() :: {string(), currency()}. %% {username, currency}.
  3. -type transaction_id() :: string().
  4. -record(account, {
  5. id :: account_id(),
  6. debet :: integer(),
  7. credit :: integer(),
  8. last_change :: integer() }).
  9. -record(tx_payment,{ id :: integer() }).
  10. -record(tx_admin_change,{ reason :: binary() }).
  11. -record(tx_default_assignment,{ }).
  12. -type transaction_info() :: #tx_payment{} | #tx_admin_change{} | #tx_default_assignment{}.
  13. -record(user_transaction, {user,top}).
  14. -record(transaction, {
  15. id :: transaction_id(),
  16. commit_time :: erlang:now(),
  17. amount :: integer(), %% amount to move between accounts
  18. remitter :: account_id(), %% accout that gives money/points
  19. acceptor :: account_id(), %% account receive money/points
  20. currency :: currency(), %% some of the points or money
  21. info :: transaction_info(),
  22. next,
  23. prev }).