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.

skip accountApplicationDeauthorized in test mode

Steven Tey6320dd2b32d9
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 607124b29c..550116531a 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
@@ -1,11 +1,19 @@
+import { StripeMode } from "@/lib/types";
import { prisma } from "@dub/prisma";
import { STRIPE_INTEGRATION_ID } from "@dub/utils";
import type Stripe from "stripe";
// Handle event "account.application.deauthorized"
-export async function accountApplicationDeauthorized(event: Stripe.Event) {
+export async function accountApplicationDeauthorized(
+ event: Stripe.Event,
+ mode: StripeMode,
+) {
const stripeAccountId = event.account;
+ if (mode === "test") {
+ return `Stripe Connect account ${stripeAccountId} deauthorized in test mode. Skipping...`;
+ }
+
const workspace = await prisma.project.findUnique({
where: {
stripeConnectId: stripeAccountId,
diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts
index ddc1c1091d..1b91d0dc4d 100644
--- a/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts
+++ b/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts
@@ -85,7 +85,7 @@ export const POST = withAxiom(async (req: Request) => {
switch (event.type) {
case "account.application.deauthorized":
- response = await accountApplicationDeauthorized(event);
+ response = await accountApplicationDeauthorized(event, mode);
break;
case "charge.refunded":
response = await chargeRefunded(event, mode);