Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

update the payout UI

Kiran Ke971f84d0b5a
diff --git a/apps/web/app/api/paypal/callback/route.ts b/apps/web/app/api/paypal/callback/route.ts
index 27c813988f..9b33894003 100644
--- a/apps/web/app/api/paypal/callback/route.ts
+++ b/apps/web/app/api/paypal/callback/route.ts
@@ -68,6 +68,7 @@ export const GET = async (req: Request) => {
},
data: {
paypalEmail: paypalUser.email,
+ payoutsEnabledAt: new Date(),
},
});
} catch (e: any) {
diff --git a/apps/web/app/partners.dub.co/(dashboard)/settings/payouts/payout-stats-and-settings.tsx b/apps/web/app/partners.dub.co/(dashboard)/settings/payouts/payout-stats-and-settings.tsx
index 9d13f6689c..07910ca05a 100644
--- a/apps/web/app/partners.dub.co/(dashboard)/settings/payouts/payout-stats-and-settings.tsx
+++ b/apps/web/app/partners.dub.co/(dashboard)/settings/payouts/payout-stats-and-settings.tsx
@@ -54,14 +54,26 @@ export function PayoutStatsAndSettings() {
currency: "USD",
}}
/>
- {bankAccount && Object.keys(bankAccount).length > 0 && (
+
+ {partner.payoutMethod === "stripe" &&
+ bankAccount &&
+ Object.keys(bankAccount).length > 0 && (
+ <div className="text-sm">
+ <p className="text-neutral-600">{bankAccount.bank_name}</p>
+ <div className="flex items-center gap-1.5 font-mono text-neutral-400">
+ <MatrixLines className="size-3" />
+ {bankAccount.routing_number}
+ <MatrixLines className="size-3" />
+ ••••{bankAccount.last4}
+ </div>
+ </div>
+ )}
+
+ {partner.payoutMethod === "paypal" && (
<div className="text-sm">
- <p className="text-neutral-600">{bankAccount.bank_name}</p>
+ <p className="text-neutral-600">PayPal</p>
<div className="flex items-center gap-1.5 font-mono text-neutral-400">
- <MatrixLines className="size-3" />
- {bankAccount.routing_number}
- <MatrixLines className="size-3" />
- ••••{bankAccount.last4}
+ {partner.paypalEmail}
</div>
</div>
)}
diff --git a/apps/web/lib/swr/use-partner-profile.ts b/apps/web/lib/swr/use-partner-profile.ts
index b4b6c6442f..04a384275e 100644
--- a/apps/web/lib/swr/use-partner-profile.ts
+++ b/apps/web/lib/swr/use-partner-profile.ts
@@ -27,8 +27,17 @@ export default function usePartnerProfile() {
},
);
+ const payoutMethod = partner?.stripeConnectId
+ ? "stripe"
+ : partner?.paypalEmail
+ ? "paypal"
+ : null;
+
return {
- partner,
+ partner: {
+ ...partner,
+ payoutMethod,
+ },
error,
loading: status === "loading" || isLoading,
mutate,