feat: Add email template for failed team subscription payments#24518
feat: Add email template for failed team subscription payments#24518joeauyeung wants to merge 130 commits intomainfrom
Conversation
- Created TeamSubscriptionPaymentFailedEmail React component - Added sendTeamSubscriptionPaymentFailedEmail service method - Added translation strings for email content - Includes billing portal link and support contact info Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…d orgs - Renamed files from team-subscription to subscription - Changed 'teamName' to 'entityName' to support both teams and organizations - Updated translation keys to be more generic (subscription_payment_failed_*) - Updated email manager export to sendSubscriptionPaymentFailedEmail Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Added sendPaymentFailedEmail() method to InternalTeamBilling class - Retrieves subscription from Stripe to get customer ID - Generates Stripe billing portal URL automatically - Sends email using sendSubscriptionPaymentFailedEmail service - Updated TeamBillingInput to include 'name' field for email content Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
- Updated /api/email route to support multiple email templates via query parameter - Added SubscriptionPaymentFailedEmail preview with customizable entityName and billingPortalUrl - Removed standalone email-preview endpoint in favor of unified /api/email route Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
…-subscription-payment-failed-email-1760634153
`permissionRepository.getUsersWithPermissionInTeam`
Devin AI is resolving merge conflictsThis PR has merge conflicts with the Devin will:
If you prefer to resolve conflicts manually, you can close the Devin session and handle it yourself. |
…760634153 Resolved merge conflicts in: - packages/features/pbac/infrastructure/repositories/__tests__/PermissionRepository.integration-test.ts (kept both getUsersWithPermissionInTeam and getTeamIdsWithPermissions test suites) Fixed type errors: - Added missing import for PermissionCheckService in TeamBillingService.ts - Added 'name' property to TeamBillingInput type in ITeamBillingService.ts Co-Authored-By: unknown <>
…-1760634153 Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
E2E results are ready! |
…issionInTeam Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
…' of https://git-manager.devin.ai/proxy/github.com/calcom/cal.com into devin/team-subscription-payment-failed-email-1760634153
… changes Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
…issionInTeam Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Stacked on #24803
What does this PR do?
Implements email notification infrastructure for failed subscription payments on team/organization accounts. Creates a generic email template and adds a method to
TeamBillingServicethat automatically generates Stripe billing portal URLs and sends notifications to admins.Key changes:
TeamBillingService.sendPaymentFailedEmails()method with automatic billing portal URL generationBillingPortalService.processBillingPortalWithoutPermissionChecks()for system-triggered emailsPermissionCheckService.getUsersWithPermissionForTeam()to find users with billing permissionsTeamBillingInputto includenamefieldsendPaymentFailedEmails()method needs to be called from webhook handlers separatelyhttps://www.loom.com/share/c121e89183a9422f9377a61b7a43d82e
Requested by: joe@cal.com (@joeauyeung)
Devin session: https://app.devin.ai/sessions/d8234d8242e74f2eb84a59a412ff847e
Updates since last revision
TeamRepository.test.tsunit test - addedname: trueto expected select to match implementationHuman Review Checklist
Critical items to verify:
Type safety concerns:
TFunctiontype from next-i18next matches the translation function actually used in the codebasenametoTeamBillingInput(search for places that construct this type)Integration correctness:
${WEBAPP_URL}/settings/teams/${teamId}/billing) is appropriateSecurity considerations:
processBillingPortalWithoutPermissionChecks- intentionally bypasses permissions for system emails, ensure it's not exposed inappropriatelyTesting requirements:
sendPaymentFailedEmails(), verify email content and billing portal link workHow should this be tested?
Prerequisites:
STRIPE_PRIVATE_KEY)Manual test:
Mandatory Tasks
Checklist