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 program marketplace help article + fix backfill script

Steven Tey8c5712e2d501
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/page.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/page.tsx
index 2ae69a05a9..ff973e6489 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/page.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/page.tsx
@@ -4,7 +4,14 @@ import { ProgramMarketplacePageClient } from "./page-client";
export default function PartnersDashboard() {
return (
- <PageContent title="Program Marketplace">
+ <PageContent
+ title="Program Marketplace"
+ titleInfo={{
+ title:
+ "Explore the Dub program marketplace to discover new programs, learn what rewards they offer, and apply to the ones that fit your content and audience.",
+ href: "https://dub.co/help/article/program-marketplace",
+ }}
+ >
<PageWidthWrapper>
<ProgramMarketplacePageClient />
</PageWidthWrapper>
diff --git a/apps/web/scripts/stripe/backfill-trace-id.ts b/apps/web/scripts/stripe/backfill-trace-id.ts
index bb4d5b86e9..07075542d7 100644
--- a/apps/web/scripts/stripe/backfill-trace-id.ts
+++ b/apps/web/scripts/stripe/backfill-trace-id.ts
@@ -1,4 +1,5 @@
import { prisma } from "@dub/prisma";
+import { chunk } from "@dub/utils";
import "dotenv-flow/config";
import { stripeConnectClient } from "./connect-client";
@@ -8,7 +9,14 @@ async function main() {
stripePayoutId: {
not: null,
},
- stripePayoutTraceId: null,
+ OR: [
+ {
+ status: "sent",
+ },
+ {
+ stripePayoutTraceId: null,
+ },
+ ],
},
include: {
partner: {
@@ -17,33 +25,48 @@ async function main() {
},
},
},
- take: 20,
+ orderBy: {
+ paidAt: "asc",
+ },
});
- await Promise.all(
- payouts.map(async (payout) => {
- try {
- const stripePayout = await stripeConnectClient.payouts.retrieve(
- payout.stripePayoutId!,
- {
- stripeAccount: payout.partner.stripeConnectId!,
- },
- );
- const { status, trace_id } = stripePayout;
- console.log(
- `${payout.id} - ${status} - ${JSON.stringify(trace_id, null, 2)}`,
- );
- if (trace_id?.value) {
- await prisma.payout.update({
- where: { id: payout.id },
- data: { stripePayoutTraceId: trace_id.value },
- });
+ const chunks = chunk(payouts, 20);
+ for (let i = 0; i < chunks.length; i++) {
+ const chunk = chunks[i];
+ console.log(`Processing chunk ${i + 1} of ${chunks.length}`);
+ await Promise.all(
+ chunk.map(async (payout) => {
+ try {
+ const stripePayout = await stripeConnectClient.payouts.retrieve(
+ payout.stripePayoutId!,
+ {
+ stripeAccount: payout.partner.stripeConnectId!,
+ },
+ );
+ const { status, trace_id } = stripePayout;
+ const stripePayoutTraceId = trace_id?.value;
+ if (
+ (status === "paid" && payout.status !== "completed") ||
+ (stripePayoutTraceId &&
+ payout.stripePayoutTraceId !== stripePayoutTraceId)
+ ) {
+ const res = await prisma.payout.update({
+ where: { id: payout.id },
+ data: {
+ status: status === "paid" ? "completed" : undefined,
+ stripePayoutTraceId,
+ },
+ });
+ console.log(
+ `Updated payout ${payout.id} to ${res.status} - ${res.stripePayoutTraceId}`,
+ );
+ }
+ } catch (error) {
+ // console.error(error.message);
}
- } catch (error) {
- console.error(error.message);
- }
- }),
- );
+ }),
+ );
+ }
}
main();