Skip to content

Commit b2b663e

Browse files
committed
feat(billing): convert referral bonuses from monthly recurring to one-time
- Add is_recurring column to referral table with migration and backfill - Update calculateTotalReferralBonus to filter by is_recurring=true AND status=completed - Update redeemReferralCode to grant one-time credits with expiresAt: null - Add CreditExpirationBucket type and breakdownByExpiration/principalsByExpiration to CreditBalance - Extract createInitialCreditBalance helper to eliminate DRY violation - Update UsageDisplay to use data-driven expiration buckets - Update UI messaging to remove per month references - Add expiration-buckets tests including edge cases for zero/negative balances
1 parent f6c3e7b commit b2b663e

File tree

15 files changed

+3458
-124
lines changed

15 files changed

+3458
-124
lines changed

cli/src/commands/referral.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export async function handleReferralCode(referralCode: string): Promise<{
5050
const postUserMessage: PostUserMessageFn = (prev) => [
5151
...prev,
5252
getSystemMessage(
53-
`🎉 Noice, you've earned an extra ${creditsRedeemed} credits!\n\n` +
54-
`(pssst: you can also refer new users and earn ${CREDITS_REFERRAL_BONUS} credits for each referral at: ${env.NEXT_PUBLIC_CODEBUFF_APP_URL}/referrals)`,
53+
`🎉 Noice, you've earned ${creditsRedeemed} bonus credits!\n\n` +
54+
`(pssst: you can also refer new users and earn ${CREDITS_REFERRAL_BONUS} credits per referral at: ${env.NEXT_PUBLIC_CODEBUFF_APP_URL}/referrals)`,
5555
),
5656
]
5757
return { postUserMessage }

0 commit comments

Comments
 (0)