askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
payments.json · 2.0 KB · 33 lines
| 1 | { |
| 2 | "name": "payments", |
| 3 | "title": "Payments", |
| 4 | "version": 1, |
| 5 | "storage": "append", |
| 6 | "description": "Money received against an invoice. Append-only (money moves, never mutates -- docs/logic-decisions.md #3): a bounced check is a status transition on the same movement, a correction is a refund record, never an edit to the amount. Rollups on invoices exclude bounced payments.", |
| 7 | "fields": [ |
| 8 | {"name": "id"}, |
| 9 | {"name": "invoice_id", "required": true, "label": "Invoice", |
| 10 | "relation": {"collection": "invoices", "display_field": "number"}}, |
| 11 | {"name": "amount_cents", "type": "integer", "required": true, "label": "Amount (cents)"}, |
| 12 | {"name": "method", "type": "enum", "label": "Method", "default": "transfer", |
| 13 | "enum": ["cash", "check", "card", "transfer", "other"]}, |
| 14 | {"name": "received_on", "type": "date", "required": true, "label": "Received"}, |
| 15 | {"name": "reference", "type": "text", "label": "Reference", |
| 16 | "validation": {"max_length": 120}}, |
| 17 | {"name": "notes", "type": "textarea", "label": "Notes"}, |
| 18 | {"name": "status", "type": "enum", "default": "received", "label": "Status", |
| 19 | "enum": ["received", "bounced"], |
| 20 | "transitions": {"received": [{"to": "bounced", "when": {"owner_id": "$user_id"}}], "bounced": []}}, |
| 21 | {"name": "refunded_cents", "type": "computed", "label": "Refunded (cents)", |
| 22 | "rollup": {"collection": "refunds", "fk_field": "payment_id", "op": "sum", "field": "amount_cents"}}, |
| 23 | {"name": "owner_id", "type": "text"}, |
| 24 | {"name": "created_at", "type": "datetime", "read_only": true, "label": "Created"} |
| 25 | ], |
| 26 | "forms": {"default": {"fields": ["invoice_id", "amount_cents", "method", "received_on", "reference", "notes"]}}, |
| 27 | "views": {"list_mode": "table", |
| 28 | "list_fields": ["invoice_id", "amount_cents", "method", "received_on", "status"], |
| 29 | "filter_fields": ["status", "method"], |
| 30 | "related": [{"collection": "refunds", "fk_field": "payment_id"}]}, |
| 31 | "search": {"fields": ["reference", "notes"]}, |
| 32 | "hooks": {"before_write": "hook_payments"} |
| 33 | } |