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.

address coderabbit feedback

Steven Tey9f742a05ceda
diff --git a/apps/web/app/(ee)/app.dub.co/invoices/[invoiceId]/partner-payout-invoice.tsx b/apps/web/app/(ee)/app.dub.co/invoices/[invoiceId]/partner-payout-invoice.tsx
index 6d1701c532..7edffced30 100644
--- a/apps/web/app/(ee)/app.dub.co/invoices/[invoiceId]/partner-payout-invoice.tsx
+++ b/apps/web/app/(ee)/app.dub.co/invoices/[invoiceId]/partner-payout-invoice.tsx
@@ -138,6 +138,14 @@ export async function PartnerPayoutInvoice({
const fastAchFee =
invoice.paymentMethod === "ach_fast" ? FAST_ACH_FEE_CENTS : 0;
+ // guard against invalid invoice amounts
+ if (invoice.amount === 0) {
+ throw new Error("Invoice amount cannot be zero");
+ }
+ if (invoice.fee < fastAchFee) {
+ throw new Error("Invoice fee cannot be less than Fast ACH fee");
+ }
+
const invoiceSummaryDetails = [
{
label: "Invoice amount",
diff --git a/apps/web/lib/zod/schemas/workspaces.ts b/apps/web/lib/zod/schemas/workspaces.ts
index dbfa7cee5c..20e49f511d 100644
--- a/apps/web/lib/zod/schemas/workspaces.ts
+++ b/apps/web/lib/zod/schemas/workspaces.ts
@@ -172,7 +172,7 @@ export const WorkspaceSchemaExtended = WorkspaceSchema.extend({
}),
),
publishableKey: z.string().nullable(),
- fastDirectDebitPayouts: z.boolean().nullable().default(false),
+ fastDirectDebitPayouts: z.boolean().default(false),
});
export const OnboardingUsageSchema = z.object({
diff --git a/apps/web/ui/partners/payout-invoice-sheet.tsx b/apps/web/ui/partners/payout-invoice-sheet.tsx
index 6fce34697c..0b51ac94af 100644
--- a/apps/web/ui/partners/payout-invoice-sheet.tsx
+++ b/apps/web/ui/partners/payout-invoice-sheet.tsx
@@ -232,7 +232,7 @@ function PayoutInvoiceSheetContent() {
? FAST_ACH_FEE_CENTS
: 0;
- const fee = amount * selectedPaymentMethod.fee + fastAchFee;
+ const fee = Math.round(amount * selectedPaymentMethod.fee + fastAchFee);
const total = amount + fee;
return {