The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
add logs
Steven Tey96c85edc3f03
diff --git a/apps/web/app/(ee)/api/stripe/connect/webhook/balance-available.ts b/apps/web/app/(ee)/api/stripe/connect/webhook/balance-available.tsindex c03004971d..71cf193f10 100644--- a/apps/web/app/(ee)/api/stripe/connect/webhook/balance-available.ts+++ b/apps/web/app/(ee)/api/stripe/connect/webhook/balance-available.ts@@ -105,7 +105,7 @@ export async function balanceAvailable(event: Stripe.Event) {// - in the "sent" status// - have a stripe transfer id (meaning it was transferred to this connected account)// - no stripe payout id (meaning it was not yet withdrawn to the connected bank account)- await prisma.payout.updateMany({+ const updatedPayouts = await prisma.payout.updateMany({where: {status: "sent",stripePayoutId: null,@@ -118,8 +118,12 @@ export async function balanceAvailable(event: Stripe.Event) {},});+ console.log(+ `Updated ${updatedPayouts.count} payouts for partner ${partner.email} (${stripeAccount}) to have the stripePayoutId: ${payout.id}`,+ );+if (partner.email) {- sendEmail({+ const sentEmail = await sendEmail({variant: "notifications",subject: "Your funds are on their way to your bank",email: partner.email,@@ -128,5 +132,9 @@ export async function balanceAvailable(event: Stripe.Event) {amount: payout.amount,}),});++ console.log(+ `Sent email to partner ${partner.email} (${stripeAccount}): ${JSON.stringify(sentEmail, null, 2)}`,+ );}}diff --git a/apps/web/app/(ee)/api/stripe/connect/webhook/payout-paid.ts b/apps/web/app/(ee)/api/stripe/connect/webhook/payout-paid.tsindex 6b3162d101..dd97cf5853 100644--- a/apps/web/app/(ee)/api/stripe/connect/webhook/payout-paid.ts+++ b/apps/web/app/(ee)/api/stripe/connect/webhook/payout-paid.ts@@ -26,7 +26,7 @@ export async function payoutPaid(event: Stripe.Event) {const stripePayout = event.data.object as Stripe.Payout;- await prisma.payout.updateMany({+ const updatedPayouts = await prisma.payout.updateMany({where: {status: "sent",stripePayoutId: stripePayout.id,@@ -35,4 +35,8 @@ export async function payoutPaid(event: Stripe.Event) {status: "completed",},});++ console.log(+ `Updated ${updatedPayouts.count} payouts for partner ${partner.email} (${stripeAccount}) to "completed" status`,+ );}