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.

Update import-referrals.ts

Steven Teyec4964522469
diff --git a/apps/web/lib/rewardful/import-referrals.ts b/apps/web/lib/rewardful/import-referrals.ts
index 53ae06d3b4..e8416a49d0 100644
--- a/apps/web/lib/rewardful/import-referrals.ts
+++ b/apps/web/lib/rewardful/import-referrals.ts
@@ -105,12 +105,13 @@ async function createReferral({
program: Program;
campaignId: string;
}) {
+ const referralId = referral.customer ? referral.customer.email : referral.id;
if (
referral.affiliate?.campaign?.id &&
referral.affiliate.campaign.id !== campaignId
) {
console.log(
- `Referral ${referral.customer.email} not in campaign ${campaignId} (they're in ${referral.affiliate.campaign.id}). Skipping...`,
+ `Referral ${referralId} not in campaign ${campaignId} (they're in ${referral.affiliate.campaign.id}). Skipping...`,
);
return;
}
@@ -126,7 +127,7 @@ async function createReferral({
if (!link) {
console.log(
- `Link not found for referral ${referral.customer.email} (token: ${referral.link.token}), skipping...`,
+ `Link not found for referral ${referralId} (token: ${referral.link.token}), skipping...`,
);
return;
}
@@ -136,7 +137,7 @@ async function createReferral({
!referral.stripe_customer_id.startsWith("cus_")
) {
console.log(
- `No Stripe customer ID provided for referral ${referral.customer.email}, skipping...`,
+ `No Stripe customer ID provided for referral ${referralId}, skipping...`,
);
return;
}