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.

Keep sandbox payouts and Connect deauthorize off live workspaces.

Kiran K59a65f6c8521
diff --git a/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/route.ts b/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/route.ts
index 96d7ce0f80..1f4f17e237 100644
--- a/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/route.ts
+++ b/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/route.ts
@@ -142,8 +142,7 @@ export const POST = withCron(async ({ rawBody }) => {
]
: []),
- // Queue external payouts (doesn't rely on fundsAvailable)
- queueExternalPayouts(invoice),
+ ...(isProductionWorkspace ? [queueExternalPayouts(invoice)] : []),
// For non-production workspaces, mock the payout completion
...(!isProductionWorkspace
diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/account-application-deauthorized.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/account-application-deauthorized.ts
index e503be5de8..866c63efe1 100644
--- a/apps/web/app/(ee)/api/stripe/integration/webhook/account-application-deauthorized.ts
+++ b/apps/web/app/(ee)/api/stripe/integration/webhook/account-application-deauthorized.ts
@@ -5,15 +5,14 @@ import { WebhookHandlerInput, WebhookHandlerResponse } from "./types";
// Handle event "account.application.deauthorized"
export async function accountApplicationDeauthorized({
- event,
mode,
workspace,
}: WebhookHandlerInput<Stripe.AccountApplicationDeauthorizedEvent>): Promise<WebhookHandlerResponse> {
const stripeAccountId = workspace.stripeConnectId!;
- if (mode === "test") {
+ if (mode !== "live") {
return {
- response: `Stripe Connect account ${stripeAccountId} deauthorized in test mode. Skipping...`,
+ response: `Stripe Connect account ${stripeAccountId} deauthorized in ${mode} mode. Skipping...`,
};
}
diff --git a/apps/web/app/(ee)/api/stripe/webhook/utils/update-workspace-plan.ts b/apps/web/app/(ee)/api/stripe/webhook/utils/update-workspace-plan.ts
index 49d007c729..c474fbbbf4 100644
--- a/apps/web/app/(ee)/api/stripe/webhook/utils/update-workspace-plan.ts
+++ b/apps/web/app/(ee)/api/stripe/webhook/utils/update-workspace-plan.ts
@@ -278,7 +278,7 @@ export async function updateWorkspacePlan({
console.log(`Reactivated program for workspace ${workspace.id}.`);
}
- await Promise.all([
+ await Promise.allSettled([
queueCreateStagingWorkspace(updatedWorkspace),
syncStagingWorkspaceJob.dispatch({
action: "sync-workspace",
diff --git a/apps/web/app/app.dub.co/(auth)/invites/[code]/page.tsx b/apps/web/app/app.dub.co/(auth)/invites/[code]/page.tsx
index c668d590d0..d070ab3308 100644
--- a/apps/web/app/app.dub.co/(auth)/invites/[code]/page.tsx
+++ b/apps/web/app/app.dub.co/(auth)/invites/[code]/page.tsx
@@ -81,6 +81,12 @@ async function VerifyInvite({ code }: { code: string }) {
// check if user is already in the workspace
if (workspace.users.length > 0) {
+ await syncStagingWorkspaceJob.dispatch({
+ action: "add-member",
+ workspaceId: workspace.id,
+ userId: session.user.id,
+ });
+
redirect(`/${workspace.slug}`);
}