feat(shop-sales): ledger contracts + docs for consumer PSP sales tracking

platform/order + platform/event gain the sale.paid and refund.issued wire
contracts (per-rate VatBuckets, PSP provider, timestamps) that drive the
ledger's SHOP-/REFUND- vouchers (go-cart-actor 2b819bd). docs/status.md
records the shop-sales + PSP settlement stack (tickets 17 + 18); the
wayfinder ledger tracker gains the two closed tickets and their Decisions
entries. Bumps go-cart-actor + backoffice (PSP float stat).

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
mats committed 2026-08-17 20:01:58 +02:00
1 parent 16655e8dbc
commit 7c2a34cc7a
3 files changed
+107

No files matched your search

+45
View File
@@ -74,3 +74,48 @@ func TestInvoicePaidRoundTrip(t *testing.T) {
}
}
func TestSalePaidRoundTrip(t *testing.T) {
in := SalePaid{
OrderID: "ord-1",
PaymentMethod: "stripe",
AmountIncVat: 14995,
VatBuckets: []VatBucket{{RateBp: 2500, ExVat: 11996, Vat: 2999}},
CapturedAtMs: 1234567890,
}
raw, err := in.Encode()
if err != nil {
t.Fatalf("encode: %v", err)
}
out, err := DecodeSalePaid(raw)
if err != nil {
t.Fatalf("decode: %v", err)
}
if out.OrderID != in.OrderID || out.PaymentMethod != in.PaymentMethod || out.AmountIncVat != in.AmountIncVat || out.CapturedAtMs != in.CapturedAtMs {
t.Fatalf("round-trip mismatch: got %+v, want %+v", out, in)
}
if len(out.VatBuckets) != 1 || out.VatBuckets[0].RateBp != 2500 || out.VatBuckets[0].Vat != 2999 {
t.Fatalf("bucket mismatch: %+v", out.VatBuckets)
}
}
func TestRefundIssuedRoundTrip(t *testing.T) {
in := RefundIssued{
OrderID: "ord-1",
RefundID: "re_123",
AmountIncVat: 7498,
VatBuckets: []VatBucket{{RateBp: 2500, ExVat: 5998, Vat: 1500}},
RefundedAtMs: 1234567990,
}
raw, err := in.Encode()
if err != nil {
t.Fatalf("encode: %v", err)
}
out, err := DecodeRefundIssued(raw)
if err != nil {
t.Fatalf("decode: %v", err)
}
if out.OrderID != in.OrderID || out.RefundID != in.RefundID || out.AmountIncVat != in.AmountIncVat {
t.Fatalf("round-trip mismatch: got %+v, want %+v", out, in)
}
}