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.

merged from main

Steven Teyf458acb098c4
diff --cc apps/web/app/api/stripe/webhook/charge-succeeded.ts
index 690f52553c,9b3979d967..7e9ff15f11
--- a/apps/web/app/api/stripe/webhook/charge-succeeded.ts
+++ b/apps/web/app/api/stripe/webhook/charge-succeeded.ts
@@@ -1,8 -1,9 +1,8 @@@
import { limiter } from "@/lib/cron/limiter";
import { stripe } from "@/lib/stripe";
+ import { sendEmail } from "@dub/email";
+ import { PartnerPayoutSent } from "@dub/email/templates/partner-payout-sent";
import { prisma } from "@dub/prisma";
- import { sendEmail } from "emails";
- import PartnerPayoutSent from "emails/partner-payout-sent";
-import { formatDate } from "@dub/utils";
import Stripe from "stripe";
export async function chargeSucceeded(event: Stripe.Event) {
diff --cc apps/web/lib/actions/partners/confirm-payouts.ts
index 7de4028344,808e46b492..bae5c33558
--- a/apps/web/lib/actions/partners/confirm-payouts.ts
+++ b/apps/web/lib/actions/partners/confirm-payouts.ts
@@@ -9,10 -7,7 +9,10 @@@ import
MIN_PAYOUT_AMOUNT,
} from "@/lib/partners/constants";
import { stripe } from "@/lib/stripe";
++import { sendEmail } from "@dub/email";
++import { PartnerPayoutConfirmed } from "@dub/email/templates/partner-payout-confirmed";
import { prisma } from "@dub/prisma";
+import { waitUntil } from "@vercel/functions";
- import { sendEmail } from "emails";
- import PartnerPayoutConfirmed from "emails/partner-payout-confirmed";
import z from "zod";
import { authActionClient } from "../safe-action";
diff --cc packages/email/src/templates/partner-payout-confirmed.tsx
index 83df507490,0000000000..f5421d05c7
mode 100644,000000..100644
--- a/packages/email/src/templates/partner-payout-confirmed.tsx
+++ b/packages/email/src/templates/partner-payout-confirmed.tsx
@@@ -1,108 -1,0 +1,108 @@@
+import { currencyFormatter, DUB_WORDMARK, formatDate } from "@dub/utils";
+import {
+ Body,
+ Container,
+ Head,
+ Heading,
+ Html,
+ Img,
+ Link,
+ Preview,
+ Section,
+ Tailwind,
+ Text,
+} from "@react-email/components";
- import Footer from "./components/footer";
++import { Footer } from "../components/footer";
+
+// Send this email when the payout is confirmed when payment is send using ACH
- export default function PartnerPayoutConfirmed({
++export function PartnerPayoutConfirmed({
+ email = "[email protected]",
+ program = {
+ id: "prog_d8pl69xXCv4AoHNT281pHQdo",
+ name: "Acme",
+ logo: DUB_WORDMARK,
+ },
+ payout = {
+ id: "po_8VuCr2i7WnG65d4TNgZO19fT",
+ amount: 490,
+ startDate: new Date("2024-11-01"),
+ endDate: new Date("2024-11-30"),
+ },
+}: {
+ email: string;
+ program: {
+ id: string;
+ name: string;
+ logo: string | null;
+ };
+ payout: {
+ id: string;
+ amount: number;
+ startDate: Date;
+ endDate: Date;
+ };
+}) {
+ const saleAmountInDollars = currencyFormatter(payout.amount / 100, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ });
+
+ const startDate = formatDate(payout.startDate, {
+ year: "numeric",
+ month: "short",
+ day: "numeric",
+ });
+
+ const endDate = formatDate(payout.endDate, {
+ year: "numeric",
+ month: "short",
+ day: "numeric",
+ });
+
+ return (
+ <Html>
+ <Head />
+ <Preview>Your payout is being processed</Preview>
+ <Tailwind>
+ <Body className="mx-auto my-auto bg-white font-sans">
+ <Container className="mx-auto my-10 max-w-[500px] rounded border border-solid border-gray-200 px-10 py-5">
+ <Section className="my-8">
+ <Img
+ src={program.logo || "https://assets.dub.co/logo.png"}
+ height="32"
+ alt={program.name}
+ />
+ </Section>
+
+ <Heading className="mx-0 p-0 text-lg font-medium text-black">
+ Your payout is being processed!
+ </Heading>
+
+ <Text className="text-sm leading-6 text-gray-600">
+ <strong className="text-black">{program.name}</strong> has
+ initiated a payout of{" "}
+ <strong className="text-black">{saleAmountInDollars}</strong> for
+ affiliate sales made from{" "}
+ <strong className="text-black">{startDate}</strong> to{" "}
+ <strong className="text-black">{endDate}</strong>.
+ </Text>
+ <Text className="text-sm leading-6 text-gray-600">
+ The payout is currently being processed and is expected to be
+ credited to your account within 4 business days.
+ </Text>
+
+ <Section className="mb-12 mt-8">
+ <Link
+ className="rounded-md bg-neutral-900 px-4 py-3 text-[12px] font-medium text-white no-underline"
+ href={`https://partners.dub.co/settings/payouts?payoutId=${payout.id}`}
+ >
+ View payout
+ </Link>
+ </Section>
+ <Footer email={email} />
+ </Container>
+ </Body>
+ </Tailwind>
+ </Html>
+ );
+}