[ledger] Sharing: budget.shared (never the default budget); shared_payment needs an explicit payment.assigned
This commit is contained in:
@@ -13,6 +13,7 @@ is a log of its own (one MLS group): its members see exactly what was put into i
|
||||
|:--|:--|:--|
|
||||
| `payment.shared` | shared budget | a member put one payment into this budget: `payment, budget, amount, date, merchant, category, origin`. Creates the payment in this log, or reassigns it after an unshare |
|
||||
| `payment.unshared` | shared budget | takes it out again (it stays in the log, unassigned) |
|
||||
| `budget.shared` | personal | a shared budget (created here or joined): like `budget.created`, but **never the default budget** |
|
||||
| `split.created` | either | `split, payment, payer, shares: [{person, name, amount}]`. Rejected unless the shares sum **exactly** to the payment's amount, every amount has the payment's sign, people are unique, and the payer is one of them |
|
||||
| `split.settled` | either | `split, person, how` (`qr`, `marked`). Rejected for an unknown split or person, the payer, or a second settlement |
|
||||
| `capture.token_added` / `capture.token_revoked` | personal | a phone's capture token: only its SHA-256 (`token`), a `name` and the `kind` (`iphone`, `android`). The token itself lives in Custos |
|
||||
@@ -21,6 +22,9 @@ is a log of its own (one MLS group): its members see exactly what was put into i
|
||||
|
||||
`apply()` stays total: anything that does not fit is recorded in `state.rejected` with the reason.
|
||||
|
||||
**Only an explicit `payment.assigned` shares a payment** (`share::shared_payment`). A payment that falls into
|
||||
a budget as the default is never sent anywhere.
|
||||
|
||||
### The split rule
|
||||
`split_equal(total, people)`: the people are **sorted by id and deduplicated first**, then split with
|
||||
equal weights by the day-1 largest-remainder `split()`. Every device computes the same shares in whatever
|
||||
|
||||
Reference in New Issue
Block a user