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 Tey223f1921bc6f
diff --git a/apps/web/lib/rewardful/import-referrals.ts b/apps/web/lib/rewardful/import-referrals.ts
index 1bf400796a..f3c58343eb 100644
--- a/apps/web/lib/rewardful/import-referrals.ts
+++ b/apps/web/lib/rewardful/import-referrals.ts
@@ -160,7 +160,11 @@ async function createReferral({
prisma.customer.create({
data: {
id: customerId,
- name: referral.customer.name,
+ name:
+ // if name is null/undefined or starts with cus_, use email as name
+ !referral.customer.name || referral.customer.name.startsWith("cus_")
+ ? referral.customer.email
+ : referral.customer.name,
email: referral.customer.email,
projectId: workspace.id,
projectConnectId: workspace.stripeConnectId,