The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update create-partner-commission.ts
Kiran Ka42f96c3ff67
diff --git a/apps/web/lib/partners/create-partner-commission.ts b/apps/web/lib/partners/create-partner-commission.tsindex 63008ff051..18fcd3b159 100644--- a/apps/web/lib/partners/create-partner-commission.ts+++ b/apps/web/lib/partners/create-partner-commission.ts@@ -252,8 +252,9 @@ export const createPartnerCommission = async ({});const isClawback = earnings < 0;+ const shouldTriggerWorkflow = !isClawback;- // Make sure totalCommissions is up to date before firing the webhook+ // Make sure totalCommissions is up to date before firing the webhook & executing workflowsconst { totalCommissions } = await syncTotalCommissions({partnerId,programId,@@ -294,11 +295,12 @@ export const createPartnerCommission = async ({: Promise.resolve(),]);- await executeWorkflows({- trigger: WorkflowTrigger.commissionEarned,- programId,- partnerId,- });+ shouldTriggerWorkflow &&+ executeWorkflows({+ trigger: WorkflowTrigger.commissionEarned,+ programId,+ partnerId,+ });})(),);