Repository navigation
Add anti-abuse rules to referral program display - #2670
Merged
Merged
Conversation
The backend now counts referral spend under anti-abuse rules: excluded
merchants (cash, transfers, wallet top-ups, QR transfers, game credit,
gambling…) and purchases under $2 don't count, a merchant counts toward the
target only with $10+ spent there, and a qualified friend must make one
more $10+ purchase before payout or the reward is cancelled.
- Types: summary.qualification gains minPurchaseUsd, minMerchantSpendUsd
and activityMinPurchaseUsd; each friend row gains excludedSpendUsd,
merchantsBelowMinimum and awaitingActivity. All optional, so an older
backend renders as before.
- Friend row: a spending friend shows why progress reads low ("1 merchant
needs $10+ to count · $212.67 doesn't count"); a qualified friend still
owing the purchase shows "Needs one more $10+ purchase to unlock".
- How-it-works copy (both referral sheets) names the per-merchant minimum,
the excluded purchase types and the post-qualifying purchase — only when
the backend reports the rule, so the app never promises one that is not
enforced.
- Cashback ineligible note now mentions wallet top-ups and gambling.
- Test for the friend-row notes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YD4isVxJqr1GgGTR5diGCu
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for displaying anti-abuse rules in the referral program, including per-merchant spending minimums, purchase exclusions, and post-qualification activity requirements. The backend now communicates these rules, and the UI displays them contextually to help referrers understand why their friends' progress may appear lower than expected spending.
Key Changes
Type definitions: Extended
ReferralRewardListItemandReferralSummarytypes to include:minPurchaseUsd: Minimum purchase amount for transactions to countminMerchantSpendUsd: Minimum spend required per merchantactivityMinPurchaseUsd: Post-qualification purchase requirementexcludedSpendUsd: Spend excluded by rules (cash, transfers, top-ups, etc.)merchantsBelowMinimum: Count of merchants not yet meeting minimumawaitingActivity: Flag indicating friend needs one more purchase before payoutReferralFriendRow component:
ReferralProgramContentNew component:
ReferralProgramContent component (legacy):
CashbackDetailsCard: Updated exclusion list to include wallet top-ups and gambling
Test coverage: Added comprehensive test suite for
ReferralFriendRowcovering:Implementation Details
https://claude.ai/code/session_01YD4isVxJqr1GgGTR5diGCu
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.