Repository navigation
feat(billing): show affiliates their referrals and earnings - #4281
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
|
Warning Review limit reached
This review includes 14 billable files and costs up to $3.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 21 minutes for your next included review. View limit details
|
23866e7 to
05315db
Compare
a5f3c68 to
09361ae
Compare
|
@claude review |
There was a problem hiding this comment.
An organization admin can view or raise the monthly spending cap at claude.ai/admin-settings/usage, on the Claude Code Review row under Services. The cap resets at the start of the next billing period.
Once the cap resets or is raised, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
05315db to
d76364a
Compare
09361ae to
8edad2e
Compare
d76364a to
8490638
Compare
8edad2e to
cc2e62b
Compare
8490638 to
67c3b38
Compare
cc2e62b to
9781445
Compare
67c3b38 to
340549c
Compare
9781445 to
0bfe132
Compare
0bfe132 to
2b128f4
Compare
2b128f4 to
ebc50cc
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4281 +/- ##
==========================================
+ Coverage 94.94% 95.13% +0.19%
==========================================
Files 2158 2048 -110
Lines 62945 60121 -2824
Branches 15758 15192 -566
==========================================
- Hits 59763 57198 -2565
+ Misses 2855 2612 -243
+ Partials 327 311 -16
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
1d12490 to
5dd55fa
Compare
5dd55fa to
c826540
Compare
fe9526c to
b9df7d6
Compare
Extends GET /v1/affiliates/me with signup/paying-user counts and commission totals, plus a list of recent commission entries, and renders both on the Referrals page. - add ReferralRepository.countByAffiliate / countPayingByAffiliate - add StripeTransactionRepository.sumAffiliateCommissionNet / findAffiliateCommissions - AffiliateService.getProfile returns stats and commissions, built only from counts and sums so no referred user's identity leaks - ReferralsPage renders a stats row and a commission history table with the empty-state copy, reversed amounts shown as a deduction
…ering Adds column-header and zero-reversal assertions to ReferralsPage so the table's structure and the no-deduction case are pinned, not just the reversed-amount path.
Commissions are filed under the affiliate's personal organization, but the earnings queries went through the organization-scoped repository. With organizations on and a team active, the Referrals page showed no earnings. The two commission reads now opt out of organization scoping under a registered "affiliate-earnings" reason and still filter by the affiliate's own user id. The paying-referrals count now follows the commission rule: a referred user counts once their personal organization, or a team they created, settles a card payment, whichever member paid. A payment for a team they only joined no longer counts. Refs CON-1193
b9df7d6 to
c508f05
Compare
Why
Closes CON-1193. Affiliates need to see what their link is doing, both to trust the program and to keep promoting Console.
What
GET /v1/affiliates/meaddsstats(sign-ups, referred users who paid by card, total commission, commission this calendar month in UTC) and the 100 most recent commission entries (date, amount, amount taken back). Totals are net of reversals.Testing
Repository integration specs (counts, distinct paying users, other affiliates excluded, sums with reversals, the month boundary), service and page specs, and functional specs that check the response holds no referred-user identity and still shows the earnings while a team is active. Mutation score on changed lines: API 100%, deploy-web 87.5%.
Screenshots
Rendered from the real components with test data. The figures are fixture values, not totals of the rows.
A newly approved affiliate:
Dark mode: