feat(billing): settle from trusted product principal - #5263
feat(billing): settle from trusted product principal#5263jeanduplessis wants to merge 2 commits into
Conversation
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Executive SummaryThe new unconditional Kilo Pass invoice settlement call will spam admin Slack with a "missed service fee" alert for every legacy invoice until the 2026-09-01 fee activation, and the PR also removes ~370 lines of still-relevant webhook dispatch tests. Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (23 files)
Fix these issues in Kilo Cloud Previous Review Summaries (2 snapshots, latest commit bd77e1d)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit bd77e1d)Status: 3 Issues Found | Recommendation: Address before merge Executive SummaryThe new unconditional Kilo Pass invoice settlement call will spam admin Slack with a "missed service fee" alert for every legacy invoice until the 2026-09-01 fee activation, and the PR also removes ~370 lines of still-relevant webhook dispatch tests. Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (20 files)
Fix these issues in Kilo Cloud Previous review (commit 6f363aa)Status: 3 Issues Found | Recommendation: Address before merge Executive SummaryThe new unconditional Kilo Pass invoice settlement call will spam admin Slack with a "missed service fee" alert for every legacy invoice until the 2026-09-01 fee activation, and the PR also removes ~370 lines of still-relevant webhook dispatch tests. Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (20 files)
Reviewed by grok-4.6 · Input: 65.2K · Output: 9.7K · Cached: 125.4K Review guidance: REVIEW.md from base branch |
842d6ec to
ce00251
Compare
bd77e1d to
c83e1e2
Compare
ce00251 to
1e58993
Compare
Stop treating Stripe gross paid amounts as product value. Settlement now reads a trusted principal, classifiers ignore fee lines, and Impact Kilo Pass sales use the product amount. No fee is charged yet.
1e58993 to
68aaf4a
Compare
c83e1e2 to
484f4d4
Compare
|
Superseded by #5383, which consolidates the complete service-fee implementation into one PR against main. |
Summary
Makes existing settlement paths derive credits, entitlements, affiliate value, and emails from trusted product principal rather than gross Stripe payment amounts.
Why this change is needed
Once a service fee is added, gross paid is no longer equal to the product purchased. Charging first would risk over-crediting users, inflating Kilo Pass value, and paying affiliate commission on Kilo's fee. This safety slice changes those assumptions before any fee path is activated.
How this is addressed
Stack: #5236 → #5262 → #5263 (this PR) → #5264 → #5265 → #5266.
Human Verification
No new product or browser verification was performed while publishing this PR. Focused regression tests in the diff cover legacy settlement, line classification, affiliate amounts, and email contracts.
Reviewer Notes
Human Reviewer Flags
Code Reviewer Agent
Code Reviewer Notes