The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
small final updates
Steven Tey0f1432c08150
diff --git a/apps/web/app/(ee)/api/cron/invoices/retry-failed/route.ts b/apps/web/app/(ee)/api/cron/invoices/retry-failed/route.tsindex 6df7761818..cca2d10cb3 100644--- a/apps/web/app/(ee)/api/cron/invoices/retry-failed/route.ts+++ b/apps/web/app/(ee)/api/cron/invoices/retry-failed/route.ts@@ -42,24 +42,29 @@ export async function POST(req: Request) {});if (!invoice) {+ console.log(`Invoice ${invoiceId} not found.`);return new Response(`Invoice ${invoiceId} not found.`);}if (invoice.status !== "failed") {+ console.log(`Invoice ${invoiceId} is not failed.`);return new Response(`Invoice ${invoiceId} is not failed.`);}if (invoice.failedAttempts >= 3) {+ console.log(`Invoice ${invoiceId} has reached max failed attempts of 3.`);return new Response(`Invoice ${invoiceId} has reached max failed attempts of 3.`,);}if (invoice.type !== "domainRenewal") {+ console.log(`Only domain renewals can be retried at this time.`);return new Response(`Only domain renewals can be retried at this time.`);}if (!invoice.workspace.stripeId) {+ console.log(`Workspace ${invoice.workspace.id} has no stripeId.`);return new Response(`Workspace ${invoice.workspace.id} has no stripeId.`);}diff --git a/apps/web/app/(ee)/api/stripe/webhook/charge-failed.ts b/apps/web/app/(ee)/api/stripe/webhook/charge-failed.tsindex 669bf9d3dc..6cd19e3826 100644--- a/apps/web/app/(ee)/api/stripe/webhook/charge-failed.ts+++ b/apps/web/app/(ee)/api/stripe/webhook/charge-failed.ts@@ -216,7 +216,10 @@ async function processDomainRenewalInvoice({ invoice }: { invoice: Invoice }) {const workspaceOwners = workspace.users.filter(({ user }) => user.email);- // Domain renewal failed 3 times, turn off auto-renew for the domains+ // Domain renewal failed 3 times:+ // 1. Turn off auto-renew for the domains on Dynadot+ // 2. Disable auto-renew for the domains on Dub+ // 3. Send email to the workspace usersif (invoice.failedAttempts >= 3) {await Promise.allSettled(domains.map((domain) =>@@ -227,6 +230,20 @@ async function processDomainRenewalInvoice({ invoice }: { invoice: Invoice }) {),);+ const updateDomains = await prisma.registeredDomain.updateMany({+ where: {+ slug: {+ in: domains.map(({ slug }) => slug),+ },+ },+ data: {+ autoRenewalDisabledAt: new Date(),+ },+ });+ console.log(+ `Updated autoRenewalDisabledAt for ${updateDomains.count} domains.`,+ );+if (workspaceOwners.length > 0) {await resend?.batch.send(workspaceOwners.map(({ user }) => ({