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.

add comments

Steven Tey437acc6cbc96
diff --git a/apps/web/lib/partners/create-partner-commission.ts b/apps/web/lib/partners/create-partner-commission.ts
index 865870c977..5368ed31ca 100644
--- a/apps/web/lib/partners/create-partner-commission.ts
+++ b/apps/web/lib/partners/create-partner-commission.ts
@@ -66,6 +66,8 @@ export const createPartnerCommission = async ({
});
if (firstCommission) {
+ // for reward types with a max duration, we need to check if the first commission is within the max duration
+ // if its beyond the max duration, we should not create a new commission
if (typeof reward.maxDuration === "number") {
// One-time sale reward
if (reward.maxDuration === 0) {
@@ -91,6 +93,7 @@ export const createPartnerCommission = async ({
}
}
+ // if first commission is fraud or canceled, we should not create a new commission
if (
firstCommission.status === "fraud" ||
firstCommission.status === "canceled"