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.

fix account.application.deauthorized for stripe/connect/webhook

Steven Tey26294cacf4ff
diff --git a/apps/web/app/(ee)/api/stripe/connect/webhook/account-application-deauthorized.ts b/apps/web/app/(ee)/api/stripe/connect/webhook/account-application-deauthorized.ts
index ed6708c0d3..ac6bafa054 100644
--- a/apps/web/app/(ee)/api/stripe/connect/webhook/account-application-deauthorized.ts
+++ b/apps/web/app/(ee)/api/stripe/connect/webhook/account-application-deauthorized.ts
@@ -1,4 +1,3 @@
-import { stripe } from "@/lib/stripe";
import { prisma } from "@dub/prisma";
import type Stripe from "stripe";
@@ -19,23 +18,16 @@ export async function accountApplicationDeauthorized(event: Stripe.Event) {
return `Partner with stripeConnectId ${stripeAccount} not found, skipping...`;
}
- const stripeAccountData = await stripe.accounts.retrieve(stripeAccount);
- if (stripeAccountData.deleted) {
- console.log(
- `Connected account ${stripeAccount} deauthorized, will set stripeConnectId for partner ${partner.id} to null as well`,
- );
- }
-
await prisma.partner.update({
where: {
id: partner.id,
},
data: {
- stripeConnectId: stripeAccountData.deleted ? null : undefined,
+ stripeConnectId: null,
payoutsEnabledAt: null,
payoutMethodHash: null,
},
});
- return `Connected account ${stripeAccount} deauthorized, updated partner ${partner.email} (${partner.id})`;
+ return `Connected account ${stripeAccount} deauthorized, removed stripeConnectId for partner ${partner.email} (${partner.id})`;
}
diff --git a/apps/web/app/(ee)/api/stripe/connect/webhook/route.ts b/apps/web/app/(ee)/api/stripe/connect/webhook/route.ts
index 2ba0d48217..99acf67632 100644
--- a/apps/web/app/(ee)/api/stripe/connect/webhook/route.ts
+++ b/apps/web/app/(ee)/api/stripe/connect/webhook/route.ts
@@ -63,7 +63,7 @@ export const POST = async (req: Request) => {
}
} catch (error) {
await log({
- message: `Stripe webhook failed (${event.type}). Error: ${error.message}`,
+ message: `Stripe Connect webhook failed (${event.type}). Error: ${error.message}`,
type: "errors",
});