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.

Guard sandbox payout completion and shorten mock charge delay

Kiran K8e8920d5df25
diff --git a/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.ts b/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.ts
index f834049d17..54997f032a 100644
--- a/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.ts
+++ b/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.ts
@@ -308,13 +308,13 @@ export async function processPayouts({
}
// Non-production workspaces skip the Stripe payment intent above.
- // Simulate that flow here with a 2-minute delay so
+ // Simulate that flow here with a 1-minute delay so
// sandbox payouts behave like a settled ACH charge.
if (!isProductionWorkspace) {
await qstash.publishJSON({
url: `${APP_DOMAIN_WITH_NGROK}/api/cron/payouts/charge-succeeded`,
method: "POST",
- delay: 2 * 60,
+ delay: 1 * 60,
flowControl: {
key: invoice.id,
rate: 1,
diff --git a/apps/web/lib/hooks/use-dashboard-banner-visible.ts b/apps/web/lib/hooks/use-dashboard-banner-visible.ts
index e6096e07af..f143be3646 100644
--- a/apps/web/lib/hooks/use-dashboard-banner-visible.ts
+++ b/apps/web/lib/hooks/use-dashboard-banner-visible.ts
@@ -15,11 +15,12 @@ export function useDashboardBannerVisible() {
const isProductionWorkspace = environment === WorkspaceEnvironment.production;
- // Only visible in production workspaces
+ // Visible in production workspaces
const isUpgradeBannerVisible =
(exceededEvents || exceededLinks || exceededPayouts || !!paymentFailedAt) &&
isProductionWorkspace;
+ // Visible in non-production workspaces
const isEnvironmentBannerVisible = !isProductionWorkspace;
const hasBanner =
diff --git a/apps/web/lib/sandbox/mock-payout-completion.ts b/apps/web/lib/sandbox/mock-payout-completion.ts
index 8956367e27..44d8b7e6d8 100644
--- a/apps/web/lib/sandbox/mock-payout-completion.ts
+++ b/apps/web/lib/sandbox/mock-payout-completion.ts
@@ -55,6 +55,15 @@ export async function mockPayoutCompletion({
return;
}
+ const program = payouts[0].program;
+
+ if (program.workspace.environment === WorkspaceEnvironment.production) {
+ console.error(
+ `Skipping the payout completion for production workspace ${program.workspaceId}.`,
+ );
+ return;
+ }
+
const payoutIds = payouts.map((p) => p.id);
const commissions = await prisma.commission.findMany({