Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 signup: the person chooses the password and name on the confirm page 83c7aa6 2 weeks, 5 days ago History
wallet_entries.json · 3.7 KB · 103 lines
1{
2 "name": "wallet_entries",
3 "title": "Wallet Entries",
4 "version": 2,
5 "storage": "append",
6 "description": "Every movement of a wallet's balance, append-only: this ledger IS the balance (wallets.balance_minor is a rollup over it), so an entry is never edited or deleted -- a mistaken charge is corrected by a compensating entry that says so, exactly as refunds correct payments and reversing journals correct postings (docs/logic-decisions.md #3). amount_minor is signed: credits positive, debits negative, in the wallet denomination's smallest unit. generated_from carries provenance for machine-written entries (a Stripe top-up stamps its event, an auto-replenishment stamps its charge), which is what makes redelivery and re-runs safe by construction rather than by a dedup table. The reason a customer can always be shown WHY their balance is what it is: every entry names its kind, its amount, and what caused it.",
7 "hooks": {
8 "before_write": "hook_wallet_entries"
9 },
10 "fields": [
11 {
12 "name": "id"
13 },
14 {
15 "name": "wallet_id",
16 "required": true,
17 "label": "Wallet",
18 "relation": {
19 "collection": "wallets",
20 "display_field": "owner_id"
21 }
22 },
23 {
24 "name": "amount_minor",
25 "type": "integer",
26 "required": true,
27 "label": "Amount",
28 "help": "Signed: a credit is positive, a debit negative. Integer minor units, never a float."
29 },
30 {
31 "name": "kind",
32 "type": "enum",
33 "required": true,
34 "default": "debit",
35 "label": "Kind",
36 "enum": [
37 "topup",
38 "auto_topup",
39 "debit",
40 "refund",
41 "promo",
42 "adjustment",
43 "hold",
44 "release"
45 ],
46 "help": "topup: the customer paid. auto_topup: the saved card was charged by the threshold rule. debit: usage drawn down. refund/promo/adjustment: money back, granted, or corrected. hold: money RESERVED against a commitment that has not executed yet (negative, so the balance gate fires at the moment of commitment rather than the moment of spending -- a template run queued against 5 cents of balance must be refused before the provider is paid real money, not billed after). release: a hold handed back at settlement, always in full, always paired to its hold by generated_from marker. The actual charge for a settled commitment is an ORDINARY debit, deliberately: a released hold must never read as a refund in the reports that already exist, because a hold is not a debit that got undone -- it is money that was never spent, and the ledger should say so."
47 },
48 {
49 "name": "description",
50 "type": "text",
51 "label": "Description",
52 "help": "What this was for, in words the customer would accept on a statement."
53 },
54 {
55 "name": "reference",
56 "type": "text",
57 "label": "Reference",
58 "help": "The thing that caused it: a task id, an invoice number, a provider charge."
59 },
60 {
61 "name": "generated_from",
62 "type": "text",
63 "label": "Generated From",
64 "help": "Provenance for machine-written entries (stripe_evt/..., auto_topup/...). Its presence is what makes a replay a no-op instead of a second charge."
65 },
66 {
67 "name": "owner_id",
68 "type": "text",
69 "label": "Owner"
70 },
71 {
72 "name": "created_at",
73 "type": "datetime",
74 "read_only": true,
75 "label": "Recorded"
76 }
77 ],
78 "forms": {
79 "default": {
80 "fields": [
81 "wallet_id",
82 "amount_minor",
83 "kind",
84 "description",
85 "reference"
86 ]
87 }
88 },
89 "views": {
90 "list_mode": "table",
91 "list_fields": [
92 "created_at",
93 "kind",
94 "amount_minor",
95 "description",
96 "reference"
97 ],
98 "filter_fields": [
99 "wallet_id",
100 "kind"
101 ]
102 }
103}