Skip to content

Add anti-abuse rules to referral program display - #2670

Merged
MusabShakeel576 merged 1 commit into
masterfrom
claude/modest-mccarthy-vtyy1l
Oct 11, 2026
Merged

MusabShakeel576 merged 1 commit into
masterfrom
claude/modest-mccarthy-vtyy1l

Conversation

@MusabShakeel576

@MusabShakeel576 MusabShakeel576 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

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 ReferralRewardListItem and ReferralSummary types to include:

    • minPurchaseUsd: Minimum purchase amount for transactions to count
    • minMerchantSpendUsd: Minimum spend required per merchant
    • activityMinPurchaseUsd: Post-qualification purchase requirement
    • excludedSpendUsd: Spend excluded by rules (cash, transfers, top-ups, etc.)
    • merchantsBelowMinimum: Count of merchants not yet meeting minimum
    • awaitingActivity: Flag indicating friend needs one more purchase before payout
  • ReferralFriendRow component:

    • Added rule notes display showing why progress is lower (e.g., "1 merchant needs $10+ to count", "$212.67 doesn't count")
    • Added activity requirement messaging for qualified friends awaiting final purchase
    • Displays these notes in secondary text with appropriate styling
  • ReferralProgramContentNew component:

    • Updated qualification checklist to show per-merchant spending requirements when available
    • Added detailed rules explanation in the "How it works" section covering:
      • Per-merchant minimums
      • Excluded transaction types (cash withdrawals, transfers, top-ups, game credit, gambling, government payments)
      • Post-qualification activity requirement
  • ReferralProgramContent component (legacy):

    • Similar updates to qualification rules display
    • Added activity requirement messaging for new users
  • CashbackDetailsCard: Updated exclusion list to include wallet top-ups and gambling

  • Test coverage: Added comprehensive test suite for ReferralFriendRow covering:

    • Merchant minimum spend messaging
    • Excluded spend display
    • Post-qualification activity requirements
    • Conditional display based on actual values

Implementation Details

  • Rules are only displayed when the backend reports them (graceful degradation for older backends)
  • Rule notes use compact formatting with bullet separators for space efficiency
  • Activity requirement messaging uses a distinct color (rewards tone) to highlight urgency
  • All new fields are optional to maintain backward compatibility with backends that don't yet support these rules

https://claude.ai/code/session_01YD4isVxJqr1GgGTR5diGCu


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

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
@vercel

vercel Bot commented Oct 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated
solid-app Ignored Ignored Oct 8, 2026 12:59pm UTC
solid-app-staging Ignored Ignored Oct 8, 2026 12:59pm UTC

Request Review

@claude

claude Bot commented Oct 8, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@MusabShakeel576
MusabShakeel576 merged commit 7c0f81a into master Oct 11, 2026
5 checks passed
@MusabShakeel576
MusabShakeel576 deleted the claude/modest-mccarthy-vtyy1l branch October 11, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants