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.

only send reminders for production programs

Steven Tey52f33e598ef0
diff --git a/apps/web/app/(ee)/api/cron/payouts/reminders/program-owners/route.ts b/apps/web/app/(ee)/api/cron/payouts/reminders/program-owners/route.ts
index f9705603c4..75a39579a0 100644
--- a/apps/web/app/(ee)/api/cron/payouts/reminders/program-owners/route.ts
+++ b/apps/web/app/(ee)/api/cron/payouts/reminders/program-owners/route.ts
@@ -29,6 +29,7 @@ export const GET = withCron(async () => {
gt: 0,
},
deactivatedAt: null,
+ environment: "production",
},
});
@@ -44,6 +45,7 @@ export const GET = withCron(async () => {
notIn: programsWithCustomMinPayouts.map((p) => p.id),
},
deactivatedAt: null,
+ environment: "production",
},
partner: {
payoutsEnabledAt: {
diff --git a/apps/web/lib/payouts/send-payout-reminder.ts b/apps/web/lib/payouts/send-payout-reminder.ts
index a102886e78..e4519de631 100644
--- a/apps/web/lib/payouts/send-payout-reminder.ts
+++ b/apps/web/lib/payouts/send-payout-reminder.ts
@@ -4,7 +4,7 @@ import { PAYOUT_SUPPORTED_COUNTRIES } from "@/lib/constants/payouts-supported-co
import { queueBatchEmail } from "@/lib/email/queue-batch-email";
import { prisma } from "@/lib/prisma";
import ConnectPayoutReminder from "@dub/email/templates/connect-payout-reminder";
-import { ACME_PROGRAM_ID, DEMO_PROGRAM_ID, pluck } from "@dub/utils";
+import { pluck } from "@dub/utils";
import {
Partner,
PayoutStatus,
@@ -15,13 +15,6 @@ import {
const BATCH_SIZE = 500;
-const EXCLUDED_PROGRAM_IDS = [
- ACME_PROGRAM_ID,
- DEMO_PROGRAM_ID,
- // programs that are in the migration process
- "prog_xxx",
-];
-
type PartnerPayoutReminder = {
partner: Pick<Partner, "id" | "name"> & {
email: string;
@@ -47,8 +40,8 @@ function payoutReminderWhere({
PayoutStatus.failed,
],
},
- programId: {
- notIn: EXCLUDED_PROGRAM_IDS,
+ amount: {
+ gte: MIN_PAYOUT_AMOUNT_FOR_REMINDERS,
},
...(afterPartnerId && {
partnerId: {
@@ -85,8 +78,9 @@ function payoutReminderWhere({
},
],
},
- amount: {
- gte: MIN_PAYOUT_AMOUNT_FOR_REMINDERS,
+ program: {
+ deactivatedAt: null,
+ environment: "production",
},
programEnrollment: {
// - Internal programs always pay through Dub, so those partners still need