customerLedgerTotals() sums the user-independent Stripe ledger for one buyer by ANY of their customer id(s) OR email(s) — so subscription payments (which product_purchases stores as amount=0) and deleted- or guest-customer charges are still attributed. ledgerAmountByCustomer() returns [customer_id => amount] for per-user rollups in one query. Both are additive and filter on ledgerRevenueTypes(); empty identity returns zero rather than matching everything. Covered by two new LedgerMetricsTest cases (full suite 1458 green). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| LedgerMetricsTest.php | ||