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 `SEPA_ENABLED_WORKSPACE_IDS` (#4356)

Steven Tey154412bc8978
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.ts
index 2de6675303..1c2bd21f49 100644
--- a/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.ts
+++ b/apps/web/app/api/workspaces/[idOrSlug]/billing/payment-methods/route.ts
@@ -5,6 +5,7 @@ import {
DIRECT_DEBIT_PAYMENT_METHOD_TYPES,
DIRECT_DEBIT_PAYMENT_TYPES_INFO,
PAYMENT_METHOD_TYPES,
+ SEPA_ENABLED_WORKSPACE_IDS,
} from "@/lib/constants/payouts";
import { stripe } from "@/lib/stripe";
import {
@@ -134,7 +135,11 @@ export const POST = withWorkspace(
return NextResponse.json({ url });
}
- if (method === "sepa_debit" && workspace.plan !== "enterprise") {
+ if (
+ method === "sepa_debit" &&
+ workspace.plan !== "enterprise" &&
+ !SEPA_ENABLED_WORKSPACE_IDS.has(workspace.id)
+ ) {
throw new DubApiError({
code: "forbidden",
message: "SEPA Debit is only available on the Enterprise plan.",
diff --git a/apps/web/lib/constants/partner-profile.ts b/apps/web/lib/constants/partner-profile.ts
index 9c6eaf49d8..01b735dc04 100644
--- a/apps/web/lib/constants/partner-profile.ts
+++ b/apps/web/lib/constants/partner-profile.ts
@@ -7,7 +7,7 @@ export const MAX_PARTNER_LINKS_FOR_LOCAL_FILTERING = 100; // if over 100 links w
export const LARGE_PROGRAM_IDS = ["prog_1K0QHV7MP3PR05CJSCF5VN93X"];
export const LARGE_PROGRAM_MIN_TOTAL_COMMISSIONS_CENTS = 500000; // $5000
-export const EXCLUDED_PROGRAM_IDS = [
+export const PARTNER_NETWORK_EXCLUDED_PROGRAM_IDS = [
ACME_PROGRAM_ID,
"prog_1K0QHV7MP3PR05CJSCF5VN93X",
"prog_1JWVR53QX1NM7NDEK62E3J19H",
diff --git a/apps/web/lib/constants/payouts.ts b/apps/web/lib/constants/payouts.ts
index 60e810b6d3..22d55c8f5b 100644
--- a/apps/web/lib/constants/payouts.ts
+++ b/apps/web/lib/constants/payouts.ts
@@ -9,8 +9,8 @@ export const ALLOWED_MIN_PAYOUT_AMOUNTS = [0, 1000, 2000, 5000, 10000];
const EXTENDED_MIN_PAYOUT_AMOUNT_CENTS = 20000; // $200
const EXTENDED_MIN_PAYOUT_WORKSPACE_IDS = new Set<string>([
- "clsvopiw0000ejy0grp821me0",
ACME_WORKSPACE_ID,
+ "clsvopiw0000ejy0grp821me0",
]);
export function getAllowedMinPayoutAmounts(workspaceId: string): number[] {
@@ -23,6 +23,11 @@ export function getAllowedMinPayoutAmounts(workspaceId: string): number[] {
return ALLOWED_MIN_PAYOUT_AMOUNTS;
}
+export const SEPA_ENABLED_WORKSPACE_IDS = new Set<string>([
+ ACME_WORKSPACE_ID,
+ "ws_1KNN3RC8XVQEHTZBQ9XQVNHEB",
+]);
+
export const PAYOUTS_SHEET_ITEMS_LIMIT = 10;
export const ELIGIBLE_PAYOUTS_MAX_PAGE_SIZE = 500;
export const CUTOFF_PERIOD_MAX_PAYOUTS = 1000;
diff --git a/apps/web/lib/network/get-network-approval-requirements.ts b/apps/web/lib/network/get-network-approval-requirements.ts
index 8001106520..db8d4d2e27 100644
--- a/apps/web/lib/network/get-network-approval-requirements.ts
+++ b/apps/web/lib/network/get-network-approval-requirements.ts
@@ -1,6 +1,6 @@
import { toCentsNumber } from "@dub/utils";
import {
- EXCLUDED_PROGRAM_IDS,
+ PARTNER_NETWORK_EXCLUDED_PROGRAM_IDS,
PARTNER_NETWORK_MIN_COMMISSIONS_CENTS,
} from "../constants/partner-profile";
import { PARTNER_PLATFORM_FIELDS } from "../partners/partner-platforms";
@@ -18,7 +18,7 @@ export const partnerHasEarnedCommissions = (
return (
programEnrollments.filter(
(pe) =>
- !EXCLUDED_PROGRAM_IDS.includes(pe.programId) &&
+ !PARTNER_NETWORK_EXCLUDED_PROGRAM_IDS.includes(pe.programId) &&
pe.status === "approved" &&
toCentsNumber(pe.totalCommissions) >=
PARTNER_NETWORK_MIN_COMMISSIONS_CENTS,
diff --git a/apps/web/scripts/dub-partner-rewind.ts b/apps/web/scripts/dub-partner-rewind.ts
index defb4af0bd..e2391a213f 100644
--- a/apps/web/scripts/dub-partner-rewind.ts
+++ b/apps/web/scripts/dub-partner-rewind.ts
@@ -1,4 +1,4 @@
-import { EXCLUDED_PROGRAM_IDS } from "@/lib/constants/partner-profile";
+import { PARTNER_NETWORK_EXCLUDED_PROGRAM_IDS } from "@/lib/constants/partner-profile";
import { prisma } from "@/lib/prisma";
import { chunk, toCentsNumber } from "@dub/utils";
import "dotenv-flow/config";
@@ -10,7 +10,7 @@ async function main() {
by: ["partnerId"],
where: {
programId: {
- notIn: EXCLUDED_PROGRAM_IDS,
+ notIn: PARTNER_NETWORK_EXCLUDED_PROGRAM_IDS,
},
totalCommissions: {
gte: REWIND_EARNINGS_MINIMUM,
diff --git a/apps/web/scripts/send-batch-emails.ts b/apps/web/scripts/send-batch-emails.ts
index 0f8d8b3917..87ecc84859 100644
--- a/apps/web/scripts/send-batch-emails.ts
+++ b/apps/web/scripts/send-batch-emails.ts
@@ -1,4 +1,4 @@
-import { EXCLUDED_PROGRAM_IDS } from "@/lib/constants/partner-profile";
+import { PARTNER_NETWORK_EXCLUDED_PROGRAM_IDS } from "@/lib/constants/partner-profile";
import { prisma } from "@/lib/prisma";
import DubLaunchWeekDay5 from "@dub/email/templates/broadcasts/launch-week-day-5";
import { chunk } from "@dub/utils";
@@ -31,7 +31,7 @@ async function main() {
programs: {
where: {
programId: {
- in: EXCLUDED_PROGRAM_IDS,
+ in: PARTNER_NETWORK_EXCLUDED_PROGRAM_IDS,
},
},
},
diff --git a/apps/web/ui/modals/add-payment-method-modal.tsx b/apps/web/ui/modals/add-payment-method-modal.tsx
index 45e0b20caf..e7d5389add 100644
--- a/apps/web/ui/modals/add-payment-method-modal.tsx
+++ b/apps/web/ui/modals/add-payment-method-modal.tsx
@@ -1,6 +1,9 @@
"use client";
-import { DIRECT_DEBIT_PAYMENT_TYPES_INFO } from "@/lib/constants/payouts";
+import {
+ DIRECT_DEBIT_PAYMENT_TYPES_INFO,
+ SEPA_ENABLED_WORKSPACE_IDS,
+} from "@/lib/constants/payouts";
import useWorkspace from "@/lib/swr/use-workspace";
import { X } from "@/ui/shared/icons";
import { AnimatedSizeContainer, GreekTemple, Modal } from "@dub/ui";
@@ -36,7 +39,7 @@ function AddPaymentMethodModalInner({
setShowAddPaymentMethodModal: Dispatch<SetStateAction<boolean>>;
}) {
const router = useRouter();
- const { slug, plan } = useWorkspace();
+ const { id: workspaceId, slug, plan } = useWorkspace();
const [isLoading, setIsLoading] = useState(false);
const addPaymentMethod = async (type: Stripe.PaymentMethod.Type) => {
@@ -117,7 +120,10 @@ function AddPaymentMethodModalInner({
className="group flex flex-col items-center justify-end gap-4 rounded-lg bg-neutral-200/40 p-8 px-2 py-4 transition-colors duration-100 hover:bg-neutral-200/60 disabled:cursor-not-allowed disabled:opacity-50"
onClick={() => addPaymentMethod(type)}
disabled={
- isLoading || (enterpriseOnly && plan !== "enterprise")
+ isLoading ||
+ (enterpriseOnly &&
+ plan !== "enterprise" &&
+ !SEPA_ENABLED_WORKSPACE_IDS.has(workspaceId || ""))
}
>
<span