Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t.sh
26 linesCodeBlameRaw
1-- Payments made safe for live money.
2
3-- Each dispute of a workspace's payment, as Stripe last said it stands:
4-- open (the bank has not decided), won, or lost. Kept so an event that
5-- arrives late or twice acts on where the dispute is now, and a lost one
6-- takes its credit back once (the ledger's `dispute/<id>` entry).
7CREATE TABLE IF NOT EXISTS disputes (
8 dispute_id TEXT PRIMARY KEY,
9 workspace TEXT NOT NULL,
10 charge_id TEXT NOT NULL,
11 -- open, won or lost.
12 status TEXT NOT NULL,
13 -- What a lost dispute took back off the balance (positive).
14 reversed_micros INTEGER NOT NULL DEFAULT 0,
15 updated_at TEXT NOT NULL
16);
17CREATE INDEX IF NOT EXISTS disputes_by_workspace ON disputes (workspace, status);
18
19-- What lost disputes took back that the workspace has not paid again yet.
20-- Its stop for a dispute lifts only once this is paid and no dispute is
21-- open: a smaller, unrelated payment does not lift it.
22ALTER TABLE limits ADD COLUMN dispute_owed_micros INTEGER NOT NULL DEFAULT 0;
23
24-- month_closes.status gains 'retrying': the card processor did not answer,
25-- or failed, while the month was closed. The next run tries again, those
26-- tried longest ago first, rather than recording that nothing was owed.