Skip to content

Conversation

@ashleyyli
Copy link
Contributor

@ashleyyli ashleyyli commented Nov 4, 2025

Switch to enable ACH for Stripe link (currently disabled)

Addresses #377

Screenshot 2025-11-04 at 17 22 23

Summary by CodeRabbit

  • New Features
    • Added ACH payment enablement option to invoice creation. A new toggle labeled "Enable ACH Payment (upcoming)" is now available in the invoice link creation form, preparing the system for full ACH payment capabilities.

@ashleyyli ashleyyli requested a review from devksingh4 November 4, 2025 23:22
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Walkthrough

A new boolean field achPaymentsEnabled is added to the Stripe invoice link request schema and TypeScript type definition. Correspondingly, a disabled form field and UI Switch component are added to the CreateLink page that displays a validation message indicating the feature is not yet available.

Changes

Cohort / File(s) Summary
Stripe Type System
src/common/types/stripe.ts
Added achPaymentsEnabled: boolean field to PostInvoiceLinkRequest schema and updated corresponding TypeScript type inference.
Invoice Link Creation UI
src/ui/pages/stripe/CreateLink.tsx
Added achPaymentsEnabled form field with initial value false, imported Switch component, and rendered disabled Switch UI labeled "Enable ACH Payment (upcoming)" with validation that returns "Feature not yet available" when enabled.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Straightforward field addition following existing type patterns in the schema
  • Standard form field integration with disabled state and placeholder validation
  • Changes are cohesive and low-risk as the feature is intentionally blocked

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Add Stripe links ACH option' accurately reflects the main changes: adding an ACH payments option to Stripe links with a form field and UI switch component.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-ach-option

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

💰 Infracost report

Monthly estimate generated

This comment will be updated when code changes.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 922d017 and bca6cae.

📒 Files selected for processing (2)
  • src/common/types/stripe.ts (2 hunks)
  • src/ui/pages/stripe/CreateLink.tsx (4 hunks)
🧰 Additional context used
🪛 ESLint
src/common/types/stripe.ts

[error] 13-13: Insert ,

(prettier/prettier)


[error] 37-37: Insert

(prettier/prettier)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run Unit Tests
  • GitHub Check: Build Application
🔇 Additional comments (4)
src/ui/pages/stripe/CreateLink.tsx (4)

9-9: LGTM: Switch import added correctly.

The Switch component import is properly added to support the new ACH payment toggle.


46-46: LGTM: Form state initialized correctly.

The achPaymentsEnabled field is correctly initialized to false, which aligns with the disabled state of the UI Switch.


57-58: Good defensive validation for upcoming feature.

The validation logic prevents form submission if achPaymentsEnabled is somehow set to true, which is good defensive coding even though the Switch is currently disabled. This ensures the feature can't be accidentally enabled through browser dev tools or other means.


117-124: LGTM: UI clearly indicates upcoming feature.

The disabled Switch with the "(upcoming)" label and descriptive text clearly communicates that this is a future feature. The component is properly bound to the form state using getInputProps.


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!

Comment on lines +12 to +13
contactEmail: z.string().email(),
achPaymentsEnabled: z.boolean()
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 issues flagged by ESLint.

The static analysis tool indicates missing trailing commas and formatting inconsistencies.

Apply this diff to fix the formatting:

-  contactEmail: z.string().email(),
-  achPaymentsEnabled: z.boolean()
+  contactEmail: z.string().email(),
+  achPaymentsEnabled: z.boolean(),
📝 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
contactEmail: z.string().email(),
achPaymentsEnabled: z.boolean()
contactEmail: z.string().email(),
achPaymentsEnabled: z.boolean(),
🧰 Tools
🪛 ESLint

[error] 13-13: Insert ,

(prettier/prettier)

🤖 Prompt for AI Agents
In src/common/types/stripe.ts around lines 12 to 13, the object schema lines are
missing trailing commas and have formatting inconsistencies flagged by ESLint;
add a trailing comma after each property (e.g., after the email validator and
after achPaymentsEnabled) and reformat the block to match the project's style
rules (run the project's formatter or ESLint --fix) so spacing and commas comply
with the linter.


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.

Copy link
Member

@devksingh4 devksingh4 left a comment

Choose a reason for hiding this comment

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

@ashleyyli is there a real eslint issue?


export const invoiceLinkPostRequestSchema = z.object({
invoiceId: z.string().min(1),
invoiceAmountUsd: z.number().min(50),
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants