Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/common/types/stripe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export const invoiceLinkPostRequestSchema = z.object({
invoiceId: z.string().min(1),
invoiceAmountUsd: z.number().min(50),
Copy link
Contributor

@coderabbitai coderabbitai bot Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Schema mismatch with frontend validation.

The backend schema enforces a minimum of 50 (dollars) for invoiceAmountUsd, but the frontend validation in CreateLink.tsx (line 52) allows amounts as low as $0.50. This mismatch will cause the backend to reject valid frontend submissions, resulting in runtime errors and poor UX.

Apply this diff to align the backend schema with the frontend validation:

-  invoiceAmountUsd: z.number().min(50),
+  invoiceAmountUsd: z.number().min(0.5),

Alternatively, if $50 is the correct minimum, update the frontend validation:

In src/ui/pages/stripe/CreateLink.tsx:

       invoiceAmountUsd: (value) =>
-        value < 0.5 ? "Amount must be at least $0.50" : null,
+        value < 50 ? "Amount must be at least $50.00" : null,

And update the placeholder:

-          placeholder="100"
-          min={0.5}
+          placeholder="100"
+          min={50}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
invoiceAmountUsd: z.number().min(50),
invoiceAmountUsd: z.number().min(0.5),
🤖 Prompt for AI Agents
In src/common/types/stripe.ts around line 10, the zod schema sets
invoiceAmountUsd to a minimum of 50 which conflicts with the frontend allowing
$0.50; change the schema to z.number().min(0.5) to match the frontend validation
(or alternatively, if $50 is intended, update src/ui/pages/stripe/CreateLink.tsx
validation and its placeholder to enforce and display $50 minimum) — ensure
types, tests, and any API docs are updated accordingly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashleyyli please reconcile now that we're here. We want it to be 50 cents

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

contactName: z.string().min(1),
contactEmail: z.string().email()
contactEmail: z.string().email(),
achPaymentsEnabled: z.optional(z.boolean()).default(false),
});

export type PostInvoiceLinkRequest = z.infer<
Expand All @@ -33,4 +34,4 @@ export const invoiceLinkGetResponseSchema = z.array(
);

export type GetInvoiceLinksResponse = z.infer<
typeof invoiceLinkGetResponseSchema>;
typeof invoiceLinkGetResponseSchema>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix formatting issue flagged by ESLint.

Apply this diff:

-  typeof invoiceLinkGetResponseSchema>;
+  typeof invoiceLinkGetResponseSchema
+>;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
typeof invoiceLinkGetResponseSchema>;
typeof invoiceLinkGetResponseSchema
>;
🧰 Tools
🪛 ESLint

[error] 37-37: Insert

(prettier/prettier)

🤖 Prompt for AI Agents
In src/common/types/stripe.ts around line 37, fix the ESLint formatting problem
on the type line by correcting the trailing punctuation and spacing so the
generic/type expression is formatted consistently with project style (remove the
stray/misplaced semicolon or extra whitespace around the closing angle bracket),
then run or apply eslint --fix / prettier to ensure the file matches project
formatting.

12 changes: 12 additions & 0 deletions src/ui/pages/stripe/CreateLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Text,
TextInput,
NumberInput,
Switch,
Title,
Modal,
Anchor,
Expand Down Expand Up @@ -42,6 +43,7 @@ export const StripeCreateLinkPanel: React.FC<StripeCreateLinkPanelProps> = ({
invoiceAmountUsd: 100,
contactName: "",
contactEmail: "",
achPaymentsEnabled: false,
},
validate: {
invoiceId: (value) =>
Expand All @@ -52,6 +54,8 @@ export const StripeCreateLinkPanel: React.FC<StripeCreateLinkPanelProps> = ({
value.length < 1 ? "Contact Name is required" : null,
contactEmail: (value) =>
/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) ? null : "Invalid email",
achPaymentsEnabled: (value) =>
value ? "Feature not yet available" : null,
},
});

Expand Down Expand Up @@ -110,6 +114,14 @@ export const StripeCreateLinkPanel: React.FC<StripeCreateLinkPanelProps> = ({
{...form.getInputProps("contactEmail")}
required
/>
<Switch
mt="lg"
mb="lg"
label="Enable ACH Payment (upcoming)"
description="Accept only bank transfer payments for this link"
disabled
{...form.getInputProps("achPaymentsEnabled")}
/>

<Button type="submit" fullWidth mt="md" disabled={isLoading}>
{isLoading ? "Creating..." : "Create Link"}{" "}
Expand Down
Loading