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.

improve discountCodes: true include

Steven Tey722bf81585e8
diff --git a/apps/web/lib/api/programs/get-program-enrollment-or-throw.ts b/apps/web/lib/api/programs/get-program-enrollment-or-throw.ts
index 390dc6c368..815a0aa58d 100644
--- a/apps/web/lib/api/programs/get-program-enrollment-or-throw.ts
+++ b/apps/web/lib/api/programs/get-program-enrollment-or-throw.ts
@@ -23,15 +23,6 @@ export async function getProgramEnrollmentOrThrow<
},
}
: false,
- discountCodes: include.discountCodes
- ? {
- where: {
- discountId: {
- not: null,
- },
- },
- }
- : false,
};
const programEnrollment = programId.startsWith("prog_")
diff --git a/apps/web/lib/rewardful/import-campaigns.ts b/apps/web/lib/rewardful/import-campaigns.ts
index 1b6bc91f2d..7c7fa1970c 100644
--- a/apps/web/lib/rewardful/import-campaigns.ts
+++ b/apps/web/lib/rewardful/import-campaigns.ts
@@ -162,6 +162,8 @@ export async function importCampaigns(payload: RewardfulImportPayload) {
);
}
+ // Note: Interestingly, Rewardful's API can sometimes return `stripe_coupon_id: null`
+ // even when the campaign has a valid Stripe coupon. In these cases we'd need to manually recreate the discount on Dub.
if (!createdGroup.discountId && campaign.stripe_coupon_id) {
let dubDiscountAttrs: DubDiscountAttributes | undefined;