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

9 downloads

Install on DigitalOcean 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.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 31 minutes ago History
dbbasic-package.json · 7.9 KB · 84 lines
1{
2 "id": "app-payments",
3 "name": "Payments",
4 "version": "0.15.0",
5 "description": "Payments and refunds against invoices: append-only money movements, hook-enforced invariants (overpayment gate per app_settings policy; refund <= payment minus prior refunds; invoice_id stamped from the payment), and rollup/formula-derived paid and balance amounts on invoices. First module of the ERP tail; the stress test of the primitive stack (plan/payments-spec.md). 0.2.0 wires Stripe as a PAYMENT METHOD, never the system of record: action_stripe_checkout turns a portal token into a Checkout Session (amount computed server-side from the open balance -- a payer who could name their own price is not paying an invoice), and webhook_stripe verifies the signature over the raw bytes and writes ONE payments row, deduped on the Stripe event id because Stripe redelivers for days. Everything after that is the reaction chain any payment already triggers: the invoice flips, the books compose, the receipt sends. The predecessor's Stripe silo happened because webhook code did bespoke things; here the webhook is just another door into the one pipeline. Storage-level writes bypass the synchronous dispatcher, so a Stripe deployment must enable DBBASIC_ENABLE_CHANGE_DISPATCH -- the third instance of logic-decisions #9 buying the real fix instead of a third workaround. 0.6.0 deletes the bespoke /payments page object: it was a list and an add form with no rule in it, and is now a seeded VIEW (one `list` block: search, sort, an Add panel, owner-scoped row actions) routed through site_view_render. The money rules never lived in the page -- hook_payments, hook_refunds, the schema and the permission rules gate every surface -- so nothing is lost but the signed-out sign-in prompt. 0.6.2: a refund or a payment acts on the record it points at, and nothing asked whether the writer may. Any signed-in user could refund any customer's payment, or record a payment against anybody's invoice, because the rules checked only the new row's own owner_id (the ceilings held; whose money it was did not). refunds.payment_id and payments.invoice_id now declare relation.requires update, so over the API the writer must be allowed to update the payment or invoice -- its owner, an admin, or a role granted it -- and a payment the writer may not even see is answered like a missing one. Trusted writers (the Stripe webhook, checkout, the dispute and returns actions) write below the API and ask object_access themselves. 0.7.0: refunds are staff work. A payment is owned by whoever paid it (checkout and the Stripe webhook record it under the payer), and the registered create/read/update grant on refunds let that payer POST a refund of their own payment (201) which system_books then journalled. Registered users now READ their own refunds only; role:manager creates, reads and updates them (hook_refunds still caps the amount and limits non-admin edits to the reason); the owner fallback is off for update as well as delete. Customer-initiated money back goes through returns and disputes, which staff decide. The old grant and opt-out are in rules.json's retracted list. 0.8.0: payments are recorded by staff. The customer owns the invoice checkout or the subscription biller raises, so relation.requires: update on payments.invoice_id passed for them, and the registered create grant let them record a received payment against their own bill (201): system_invoice_status marked it paid and app-shop's fulfillment shipped, with no money having moved. Registered users now read their own payments only; role:manager creates, reads and updates them; the owner fallback is off for update as well as delete. payments.json v6 drops the owner guard on received -> bounced, which refused the staff who bounce a customer's payment. The Stripe webhook and checkout write in process and are unaffected. The old grants are retracted. 0.9.0: staff roles read the shop's records. role:cashier, role:shift_lead, role:manager and role:owner read every sale, not only rows they own: checkout files a guest sale under the shop's account, so staff saw nothing and signed in as the owner. Read only; changes go through app-counter's actions. 0.10.0: refunds v6 cite the item they correct: order_line_id, invoice_line_id, quantity, reason_code, approval_id, approved_by, goodwill_id. The refundable locked check also refuses a line not on the bill's order and a quantity that, with refunds and credit notes already citing the line, would correct more than was sold. 0.11.0: a refund citing goodwill (refunds.goodwill_id, app-counter) must cite a goodwill record that exists, and the refunds citing it are capped, inside the ledger lock, at the value a manager approved. 0.11.1: system_books no longer skips a refund silently when the books are installed but the cash or revenue (receivable on accrual) account is not set: the result is not ok and names the settings. 0.12.0: status follows the money. system_invoice_status reads object_corrections.money_status and also follows invoice_credits, so a fully refunded, bounced or deleted payment no longer leaves an invoice paid with the balance owing (findings M3, M4), and a credit note on a paid bill reads credit_owed. payments v7: the overpayment ceiling subtracts the credit notes applied to the invoice (read under the ledger lock). refunds v7: credit_note_id, the credit note whose money a refund returns, capped at its value; its units count once, on the credit note's line. 0.13.0: tax posts to Sales Tax Payable (decision 2, 2026-11-30): system_books books an issued invoice's tax (accrual) or each receipt's pro-rata share of it (cash) to payments.journal.tax_account, and takes it back on a refund or bounce; a taxed sale with no tax account mapped is not booked, and the result names the setting. 0.14.0: credit notes are journaled. On accrual, system_books books an issued credit note as DR revenue / DR Sales Tax Payable / CR receivable at the tax it states (the original rate), provenance invoices/<id>:credited; on cash basis it books nothing until the refund that pays it out, which takes back tax at the credit note's rate. A quote is never booked as a sale. 0.15.0: on accrual books an invoice line billed before its service ends (invoice_lines.service_end after the issue date) posts to payments.journal.deferred_revenue_account instead of revenue; with that account unset such an invoice is not booked and the result names the setting. Cash basis is unchanged: revenue on receipt.",
6 "compatibility": {
7 "dbbasic_object_server": ">=0.1.0"
8 },
9 "dependencies": [
10 "app-invoices",
11 "app-views"
12 ],
13 "objects": [
14 {
15 "id": "hook_payments",
16 "path": "objects/hook/payments.py"
17 },
18 {
19 "id": "hook_refunds",
20 "path": "objects/hook/refunds.py"
21 },
22 {
23 "id": "system_books",
24 "path": "objects/system/books.py"
25 },
26 {
27 "id": "system_invoice_status",
28 "path": "objects/system/invoice_status.py"
29 },
30 {
31 "id": "webhook_stripe",
32 "path": "objects/webhook/stripe.py"
33 },
34 {
35 "id": "action_stripe_checkout",
36 "path": "objects/action/stripe_checkout.py"
37 }
38 ],
39 "schemas": [
40 {
41 "collection": "payments",
42 "path": "schemas/payments.json"
43 },
44 {
45 "collection": "refunds",
46 "path": "schemas/refunds.json"
47 }
48 ],
49 "permissions": [
50 {
51 "path": "permissions/rules.json"
52 }
53 ],
54 "seed": [
55 {
56 "collection": "payments",
57 "path": "seed/payments.tsv"
58 },
59 {
60 "collection": "refunds",
61 "path": "seed/refunds.tsv"
62 },
63 {
64 "collection": "views",
65 "path": "seed/views.tsv"
66 },
67 {
68 "collection": "site_routes",
69 "path": "seed/site_routes.tsv"
70 }
71 ],
72 "migrations": [],
73 "nav": [
74 {
75 "id": "payments",
76 "label": "Payments",
77 "path": "/payments",
78 "blurb": "Money received against invoices, and refunds of it",
79 "surface": "member",
80 "group": "Money",
81 "order": 310
82 }
83 ]
84}