-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Connect PayPal button #2472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connect PayPal button #2472
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
WalkthroughThe changes update the payout connection logic and UI for partners. The provider selection is now dynamically determined based on the partner's country, toggling between Stripe and PayPal. Button rendering is streamlined, removing explicit text and variant props in some places, while the button's text is now set contextually within its component logic. Additionally, domain constants are used in PayPal callback URLs and OAuth redirect URIs instead of hardcoded strings. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant WebApp
participant Server
participant Stripe
participant PayPal
User->>WebApp: Clicks "Connect Payout" button
WebApp->>Server: Fetch user session and partner info
Server-->>WebApp: Returns partner country and payout status
alt Country supported by Stripe
WebApp->>Stripe: Initiate Stripe connection
Stripe-->>WebApp: Stripe connection flow
else Country not supported by Stripe
WebApp->>PayPal: Initiate PayPal connection
PayPal-->>WebApp: PayPal connection flow
end
WebApp-->>User: Show connection result
Poem
π Recent review detailsConfiguration used: CodeRabbit UI π Files selected for processing (4)
β Files skipped from review due to trivial changes (1)
π§ Files skipped from review as they are similar to previous changes (1)
𧰠Additional context used𧬠Code Graph Analysis (1)apps/web/ui/partners/payout-methods-dropdown.tsx (1)
β° Context from checks skipped due to timeout of 90000ms (1)
π Additional comments (3)
β¨ Finishing Touches
πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables the PayPal connection flow by uncommenting and integrating the PayPal branch in the payout button logic, and updates component usage across various pages.
- Uncomments and activates the PayPal flow in ConnectPayoutButton.
- Adjusts button text based on the country support for payouts.
- Updates the verify page to fetch session and partner details for proper provider selection.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/web/ui/partners/connect-payout-button.tsx | Uncomments PayPal flow and updates text property; potential duplicate call to executeStripeAsync. |
| apps/web/ui/layout/sidebar/payout-stats.tsx | Removes explicit text prop from ConnectPayoutButton. |
| apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/verify/page.tsx | Uncomments and implements session and partner fetching for provider selection. |
| apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-stats-and-settings.tsx | Removes explicit text prop from ConnectPayoutButton. |
Comments suppressed due to low confidence (1)
apps/web/ui/partners/connect-payout-button.tsx:54
- The unconditional call to executeStripeAsync() after the if-else block appears redundant and may lead to duplicate calls when the payout method is already handled. Consider removing this call to ensure only the intended payout action is executed.
await executeStripeAsync();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (4)
apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-stats-and-settings.tsx(1 hunks)apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/verify/page.tsx(2 hunks)apps/web/ui/layout/sidebar/payout-stats.tsx(1 hunks)apps/web/ui/partners/connect-payout-button.tsx(2 hunks)
π§° Additional context used
𧬠Code Graph Analysis (2)
apps/web/ui/layout/sidebar/payout-stats.tsx (1)
apps/web/ui/partners/connect-payout-button.tsx (1)
ConnectPayoutButton(12-74)
apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-stats-and-settings.tsx (1)
apps/web/ui/partners/connect-payout-button.tsx (1)
ConnectPayoutButton(12-74)
π Additional comments (6)
apps/web/ui/layout/sidebar/payout-stats.tsx (1)
95-95: LGTM! Text logic centralized in ConnectPayoutButton.Removing the explicit
textprop is appropriate since theConnectPayoutButtoncomponent now handles text determination internally based on the partner's country and supported payout method.apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-stats-and-settings.tsx (1)
27-27: LGTM! Consistent with centralization pattern.Removing both
textandvariantprops is consistent with centralizing the button's appearance and text logic within theConnectPayoutButtoncomponent itself.apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/verify/page.tsx (2)
1-4: LGTM! Necessary imports for dynamic provider selection.The added imports (
getSession,prisma,CONNECT_SUPPORTED_COUNTRIES) are appropriate for implementing dynamic payout provider selection based on the partner's country.
109-118: LGTM! Dynamic provider selection improves flexibility.The implementation correctly determines the payout provider based on the partner's country support rather than hardcoding "stripe". This aligns well with the ConnectPayoutButton's logic that also uses
CONNECT_SUPPORTED_COUNTRIESto determine button text and functionality.apps/web/ui/partners/connect-payout-button.tsx (2)
7-7: LGTM! Cleaned up unused import.Removing the
COUNTRIESimport is appropriate since onlyCONNECT_SUPPORTED_COUNTRIESis used for the country-based logic.
65-70: LGTM! Dynamic button text based on country support.The text logic correctly displays "Connect PayPal" for countries not in
CONNECT_SUPPORTED_COUNTRIESand "Connect bank account" for supported countries. This aligns well with the conditional payout method execution logic.
|
@CodeRabbit final review |
|
Tip For best results, initiate chat on the files or code changes. π§© Analysis chain@steven-tey I'll conduct a comprehensive final review of this PayPal connection implementation. Let me examine the key changes first. π Script executed: Length of output: 2358 π Script executed: Length of output: 4585 π Script executed: Length of output: 2450 π Script executed: Length of output: 100 π Script executed: Length of output: 84 π Script executed: Length of output: 91 π Script executed: Length of output: 36392 π Script executed: Length of output: 33798 π Script executed: Length of output: 6996 π Script executed: Length of output: 2683 π Script executed: Length of output: 14047 @steven-tey Here's my comprehensive final review of the PayPal connection implementation: β Excellent Implementation - Ready for ProductionThis PR represents a well-architected solution for dynamic payout provider selection. The implementation demonstrates strong engineering principles and attention to detail. ποΈ Architecture Strengths
π Security & OAuth ImplementationThe PayPal OAuth flow is properly implemented with:
π― User Experience
π¦ Code Quality
Minor NotesThe TODO comments I found are for future enhancements (email notifications, verification checks) and don't impact the core functionality. The implementation is production-ready as-is. π RecommendationLGTM - Approve and Merge This is a high-quality implementation that:
The PayPal integration will significantly expand Dub's global reach for partner payouts. Well done! π |
Summary by CodeRabbit
New Features
Bug Fixes
Style
Chores