Files
bookspec/examples/p3-party-reversed-card-payment.toml
T
swaitsandClaude Opus 5.5 52555262a8 P3: party totals by what moved the money, once (defects 14, 11, 24)
Each party's part of an entry is signed as its own account would show it,
with a direction and its cash and in-kind amounts; a reversal is its
original negated. Totals on a cash or all basis: for a member, all equals
the members' equity statement and cash the K-1's cash. Money is cash,
cards and the financing accounts, and a liability credit never pays its
own creditor (creditor_of), so accruals and declared distributions count
once. tin_last4 from the TIN or W-9 facts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T3gXMVt7XJPi6ens1or9Dj
2026-10-21 12:12:26 -06:00

100 lines
2.6 KiB
TOML

# P3 defect 14, the second bug found in design (wanderbooks P3 brief
# §1.4): a member pays the card from their own funds; reversing it read
# as a second payment. Regression test: ledger-core
# tests/spec_party_totals.rs
# defect14_a_reversed_member_card_payment_nets_to_zero. The shape:
# bookspec/README.md (`after = N` asks a query after event N).
id = "p3-party-reversed-card-payment"
title = "A reversed payment of one liability by another nets to zero"
rule = """
A reversal's part for each party is its original's negated, never read
from the reversal's own lines. A member paying the company's card from
their own funds (Dr card / Cr due to members), tagged with the card's
issuer, is paid to the issuer; its reversal takes that back, so the pair
nets to zero; reversing the reversal pays it again.
"""
status = "AUTHORITY"
sources = [
"Pacioli, Summa (1494), Geijsbeek tr.: a mistake is corrected by the opposite entry (wanderbooks docs/spec/sources/pacioli-1494.md, rules.md B-9)",
]
tags = ["parties", "reversals", "liabilities"]
[setup]
currency = "USD"
fiscal_year_start = "01-01"
basis = "accrual"
rounding = "half-even"
cash_accounts = ["1000"]
financing_accounts = ["2100"]
[[setup.accounts]]
code = "1000"
name = "Checking"
type = "asset"
[[setup.accounts]]
code = "2050"
name = "Business Card"
type = "liability"
[[setup.accounts]]
code = "2100"
name = "Due to Members"
type = "liability"
[[setup.parties]]
name = "Harbor Bank"
roles = ["financial_institution"]
[[events]]
date = "2026-06-01"
description = "A member pays the card from their own funds"
parties = [{ party = "Harbor Bank" }]
lines = [
{ account = "2050", side = "debit", amount = "100.00" },
{ account = "2100", side = "credit", amount = "100.00" },
]
[[events]]
date = "2026-06-02"
description = "Reversed"
reverses = 1
[[events]]
date = "2026-06-03"
description = "The reversal reversed"
reverses = 2
[[expect]]
query = "party_part"
entry = 1
party = "Harbor Bank"
values = { resolved = "100.00", direction = "paid", cash = "100.00", in_kind = "0.00" }
[[expect]]
query = "party_part"
entry = 2
party = "Harbor Bank"
values = { resolved = "-100.00", direction = "received", cash = "-100.00", in_kind = "0.00" }
# After the reversal: nothing paid (before P3: 200.00, the reversal read
# as a second payment).
[[expect]]
query = "party_totals"
after = 2
party = "Harbor Bank"
basis = "cash"
from = "2026-01-01"
to = "2026-12-31"
values = { paid = "0.00", received = "0.00" }
[[expect]]
query = "party_totals"
after = 3
party = "Harbor Bank"
basis = "cash"
from = "2026-01-01"
to = "2026-12-31"
values = { paid = "100.00", received = "0.00" }