The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Refactor chargeFailed function to move invoiceId check before logging error message
Kiran Ka8795394ea19
diff --git a/apps/web/app/(ee)/api/stripe/webhook/charge-failed.ts b/apps/web/app/(ee)/api/stripe/webhook/charge-failed.tsindex 7b13f4a0ba..a742e9e693 100644--- a/apps/web/app/(ee)/api/stripe/webhook/charge-failed.ts+++ b/apps/web/app/(ee)/api/stripe/webhook/charge-failed.ts@@ -16,17 +16,17 @@ export async function chargeFailed(event: Stripe.Event) {failure_message: failedReason,} = charge;+ if (!invoiceId) {+ console.log("No transfer group found, skipping...");+ return;+ }+await log({message: `Partner payout failed for invoice ${invoiceId}.`,type: "errors",mention: true,});- if (!invoiceId) {- console.log("No transfer group found, skipping...");- return;- }-// Mark the invoice as failedconst invoice = await prisma.invoice.update({where: {