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.

Merge branch 'main' into improve-payout-flow

Steven Teyd5b1cfe17f03
diff --cc apps/web/lib/actions/partners/confirm-payouts.ts
index 771ff40cfd,808e46b492..7de4028344
--- a/apps/web/lib/actions/partners/confirm-payouts.ts
+++ b/apps/web/lib/actions/partners/confirm-payouts.ts
@@@ -108,14 -67,18 +108,23 @@@ export const confirmPayoutsAction = aut
(total, payout) => total + payout.amount,
0,
);
- const fee = amount * DUB_PARTNERS_PAYOUT_FEE;
+
+ const fee =
+ paymentMethod.type === "card"
+ ? amount * DUB_PARTNERS_PAYOUT_FEE_CARD
+ : amount * DUB_PARTNERS_PAYOUT_FEE_ACH;
+
const total = amount + fee;
+ // Generate the next invoice number
+ const totalInvoices = await tx.invoice.count({
+ where: {
+ workspaceId: workspace.id,
+ },
+ });
+ const paddedNumber = String(totalInvoices + 1).padStart(4, "0");
+ const invoiceNumber = `${workspace.invoicePrefix}-${paddedNumber}`;
+
const invoice = await tx.invoice.create({
data: {
id: createId({ prefix: "inv_" }),