Notify partners via email when a stablecoin payout fails or is returned - #4264
Open
devkiran wants to merge 2 commits into
Open
Notify partners via email when a stablecoin payout fails or is returned#4264devkiran wants to merge 2 commits into
devkiran wants to merge 2 commits into
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📝 WalkthroughWalkthroughChangesStablecoin payout notifications
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant OutboundPaymentWebhook
participant notifyPartnerStablecoinPayoutFailed
participant PartnerStablecoinPayoutFailed
OutboundPaymentWebhook->>notifyPartnerStablecoinPayoutFailed: invoke after failed payout update
notifyPartnerStablecoinPayoutFailed->>PartnerStablecoinPayoutFailed: provide aggregated payout and partner data
PartnerStablecoinPayoutFailed-->>notifyPartnerStablecoinPayoutFailed: render notification email
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/web/app/`(ee)/api/stripe/connect/v2/webhook/utils/notify-partner-stablecoin-payout-failed.ts:
- Around line 84-87: Update the logging in the stablecoin payout failure
notification flow to remove partner.email and the full emailResponse from
console.log. Use the available non-PII payout identifier and log only a minimal
delivery status, preserving the existing notification behavior and avoiding
provider metadata.
- Around line 65-82: Update notifyPartnerStablecoinPayoutFailed to atomically
claim or create a unique durable notification/outbox record keyed by
outboundPaymentId before calling sendEmail. Return without sending when the
claim already exists, mark the claim delivered only after successful email
delivery, and preserve retryability by leaving failed sends uncompleted so
webhook replays can retry without duplicating successful emails.
- Around line 43-59: Prevent cross-partner aggregation in the notification flow
around payouts.findMany and notifyPartnerStablecoinPayoutFailed: either enforce
a durable uniqueness constraint on the stripePayoutId/partner combination, or
scope the query and aggregation to a single partner before using
payouts[0].partner, totalAmount, and programs. Ensure one partner’s payout data
can never be included in another partner’s email.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b8045399-4735-4a95-aebb-90566c8f6fce
📒 Files selected for processing (4)
apps/web/app/(ee)/api/stripe/connect/v2/webhook/outbound-payment-failed.tsapps/web/app/(ee)/api/stripe/connect/v2/webhook/outbound-payment-returned.tsapps/web/app/(ee)/api/stripe/connect/v2/webhook/utils/notify-partner-stablecoin-payout-failed.tspackages/email/src/templates/partner-stablecoin-payout-failed.tsx
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 by CodeRabbit