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.

Merge branch 'main' into webhooks-ga

Steven Teybd0246beefa5
diff --cc apps/web/app/api/stripe/webhook/customer-subscription-updated.ts
index e3eea3e8f9,a11af4d044..73e5904161
--- a/apps/web/app/api/stripe/webhook/customer-subscription-updated.ts
+++ b/apps/web/app/api/stripe/webhook/customer-subscription-updated.ts
@@@ -75,9 -75,9 +76,10 @@@ export async function customerSubscript
aiLimit: plan.limits.ai!,
tagsLimit: plan.limits.tags!,
usersLimit: plan.limits.users!,
+ paymentFailedAt: null,
},
}),
+
prisma.restrictedToken.updateMany({
where: {
projectId: workspace.id,
@@@ -86,26 -86,16 +88,35 @@@
rateLimit: plan.limits.api,
},
}),
+
+ // Disable the webhooks if the new plan does not support webhooks
+ ...(shouldDisableWebhooks
+ ? [
+ prisma.webhook.updateMany({
+ where: { projectId: workspace.id },
+ data: { disabledAt: new Date() },
+ }),
+
+ prisma.project.update({
+ where: {
+ id: workspace.id,
+ },
+ data: {
+ webhookEnabled: false,
+ },
+ }),
+ ]
+ : []),
]);
+ } else if (workspace.paymentFailedAt) {
+ await prisma.project.update({
+ where: {
+ id: workspace.id,
+ },
+ data: {
+ paymentFailedAt: null,
+ },
+ });
}
const subscriptionCanceled =