Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ACH payment flows #3673

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

feat: Add ACH payment flows #3673

wants to merge 6 commits into from

Conversation

suejung-sentry
Copy link
Contributor

@suejung-sentry suejung-sentry commented Jan 21, 2025

Add flows to handle when using ACH with async microdeposits. Need to adjust for the below flows:

  1. User is going from free to paid and has finished the intiial CheckoutSession selecting ACH microdeposits as their payment method. They need to wait 2 days for the microdeposits to hit their account. What should they see in the UI?
    • shows a banner that it's awaiting verification
  2. User decides they want to abandon that existing upgrade that is in progress and waiting for the ACH microdeposits. What actions can they perform and what should they be able to see in the UI?
    • shows a modal to confirm what they are doing
  3. User is on an existing plan and wants to update their payment method to ACH microdeposits. What does the UI look like until it's confirmed?
    • View Payment Method page shows the old method and the same banner as in 1 above

This PR also handles some stripe error message rendering in the PaymentElement.

Screenshot 2025-01-24 at 2 10 31 PM Screenshot 2025-01-24 at 2 11 06 PM Screenshot 2025-01-24 at 2 13 31 PM

What "here" links to
Screenshot 2025-01-27 at 10 23 05 AM

codecov/engineering-team#2622

Copy link

codecov bot commented Jan 21, 2025

Bundle Report

Changes will increase total bundle size by 20 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 6.05MB 10 bytes (0.0%) ⬆️
gazebo-production-esm 6.1MB 10 bytes (0.0%) ⬆️

@codecov-notifications
Copy link

codecov-notifications bot commented Jan 21, 2025

❌ 13 Tests Failed:

Tests completed Failed Passed Skipped
4820 13 4807 2
View the top 3 failed tests by shortest run time
src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/PaymentCard/PaymentMethodForm.test.tsx > PaymentMethodForm > when there is an error in the form > renders the error
Stack Traces | 0.0344s run time
Error: [vitest] No "MissingNameError" export is defined on the "services/account/useUpdatePaymentMethod" mock. Did you forget to return it from "vi.mock"?
If you need to partially mock a module, you can use "importOriginal" helper inside:

vi.mock(import("services/account/useUpdatePaymentMethod"), async (importOriginal) => {
  const actual = await importOriginal()
  return {
    ...actual,
    // your mocked methods
  }
})

 ❯ getErrorMessage .../BillingDetails/PaymentCard/PaymentMethodForm.tsx:162:14PaymentMethodForm .../BillingDetails/PaymentCard/PaymentMethodForm.tsx:98:14renderWithHooks .../react-dom/cjs/react-dom.development.js:15486:18mountIndeterminateComponent .../react-dom/cjs/react-dom.development.js:20103:13beginWork .../react-dom/cjs/react-dom.development.js:21626:16beginWork$1 .../react-dom/cjs/react-dom.development.js:27465:14performUnitOfWork .../react-dom/cjs/react-dom.development.js:26599:12workLoopSync .../react-dom/cjs/react-dom.development.js:26505:5
src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/PaymentCard/PaymentCard.test.jsx > PaymentCard > when there is an error in the form > renders the error
Stack Traces | 0.0592s run time
TypeError: Cannot read properties of undefined (reading 'match')
 ❯ Proxy.useParams .../react-router/modules/hooks.js:40:17Module.useNavLinks .../navigation/useNavLinks/useNavLinks.ts:53:7useLinkConfig .../shared/AppLink/AppLink.tsx:10:9
 ❯ .../shared/AppLink/AppLink.tsx:113:3renderWithHooks .../react-dom/cjs/react-dom.development.js:15486:18updateForwardRef .../react-dom/cjs/react-dom.development.js:19245:20beginWork .../react-dom/cjs/react-dom.development.js:21675:16beginWork$1 .../react-dom/cjs/react-dom.development.js:27465:14performUnitOfWork .../react-dom/cjs/react-dom.development.js:26599:12workLoopSync .../react-dom/cjs/react-dom.development.js:26505:5
src/pages/PlanPage/PlanPage.test.jsx > PlanPage > testing routes > on invoices id path > renders invoices details page
Stack Traces | 1s run time
TestingLibraryElementError: Unable to find an element with the text: /InvoiceDetailsPage/. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ .../pages/PlanPage/PlanPage.test.jsx:199:24

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

codecov-public-qa bot commented Jan 21, 2025

❌ 13 Tests Failed:

Tests completed Failed Passed Skipped
4179 13 4166 0
View the top 3 failed tests by shortest run time
src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/PaymentCard/PaymentMethodForm.test.tsx > PaymentMethodForm > when there is an error in the form > renders the error
Stack Traces | 0.0344s run time
Error: [vitest] No "MissingNameError" export is defined on the "services/account/useUpdatePaymentMethod" mock. Did you forget to return it from "vi.mock"?
If you need to partially mock a module, you can use "importOriginal" helper inside:

vi.mock(import("services/account/useUpdatePaymentMethod"), async (importOriginal) => {
  const actual = await importOriginal()
  return {
    ...actual,
    // your mocked methods
  }
})

 ❯ getErrorMessage .../BillingDetails/PaymentCard/PaymentMethodForm.tsx:162:14PaymentMethodForm .../BillingDetails/PaymentCard/PaymentMethodForm.tsx:98:14renderWithHooks .../react-dom/cjs/react-dom.development.js:15486:18mountIndeterminateComponent .../react-dom/cjs/react-dom.development.js:20103:13beginWork .../react-dom/cjs/react-dom.development.js:21626:16beginWork$1 .../react-dom/cjs/react-dom.development.js:27465:14performUnitOfWork .../react-dom/cjs/react-dom.development.js:26599:12workLoopSync .../react-dom/cjs/react-dom.development.js:26505:5
src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/PaymentCard/PaymentCard.test.jsx > PaymentCard > when there is an error in the form > renders the error
Stack Traces | 0.0592s run time
TypeError: Cannot read properties of undefined (reading 'match')
 ❯ Proxy.useParams .../react-router/modules/hooks.js:40:17Module.useNavLinks .../navigation/useNavLinks/useNavLinks.ts:53:7useLinkConfig .../shared/AppLink/AppLink.tsx:10:9
 ❯ .../shared/AppLink/AppLink.tsx:113:3renderWithHooks .../react-dom/cjs/react-dom.development.js:15486:18updateForwardRef .../react-dom/cjs/react-dom.development.js:19245:20beginWork .../react-dom/cjs/react-dom.development.js:21675:16beginWork$1 .../react-dom/cjs/react-dom.development.js:27465:14performUnitOfWork .../react-dom/cjs/react-dom.development.js:26599:12workLoopSync .../react-dom/cjs/react-dom.development.js:26505:5
src/pages/PlanPage/PlanPage.test.jsx > PlanPage > testing routes > on invoices id path > renders invoices details page
Stack Traces | 1s run time
TestingLibraryElementError: Unable to find an element with the text: /InvoiceDetailsPage/. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ .../pages/PlanPage/PlanPage.test.jsx:199:24

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@codecov-releaser
Copy link
Contributor

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
7f4797b Tue, 21 Jan 2025 20:04:57 GMT Cloud Enterprise

@codecov-qa
Copy link

codecov-qa bot commented Jan 24, 2025

❌ 13 Tests Failed:

Tests completed Failed Passed Skipped
4177 13 4164 2
View the top 3 failed tests by shortest run time
src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/PaymentCard/PaymentMethodForm.test.tsx > PaymentMethodForm > when there is an error in the form > renders the error
Stack Traces | 0.0344s run time
Error: [vitest] No "MissingNameError" export is defined on the "services/account/useUpdatePaymentMethod" mock. Did you forget to return it from "vi.mock"?
If you need to partially mock a module, you can use "importOriginal" helper inside:

vi.mock(import("services/account/useUpdatePaymentMethod"), async (importOriginal) => {
  const actual = await importOriginal()
  return {
    ...actual,
    // your mocked methods
  }
})

 ❯ getErrorMessage .../BillingDetails/PaymentCard/PaymentMethodForm.tsx:162:14PaymentMethodForm .../BillingDetails/PaymentCard/PaymentMethodForm.tsx:98:14renderWithHooks .../react-dom/cjs/react-dom.development.js:15486:18mountIndeterminateComponent .../react-dom/cjs/react-dom.development.js:20103:13beginWork .../react-dom/cjs/react-dom.development.js:21626:16beginWork$1 .../react-dom/cjs/react-dom.development.js:27465:14performUnitOfWork .../react-dom/cjs/react-dom.development.js:26599:12workLoopSync .../react-dom/cjs/react-dom.development.js:26505:5
src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/PaymentCard/PaymentCard.test.jsx > PaymentCard > when there is an error in the form > renders the error
Stack Traces | 0.0592s run time
TypeError: Cannot read properties of undefined (reading 'match')
 ❯ Proxy.useParams .../react-router/modules/hooks.js:40:17Module.useNavLinks .../navigation/useNavLinks/useNavLinks.ts:53:7useLinkConfig .../shared/AppLink/AppLink.tsx:10:9
 ❯ .../shared/AppLink/AppLink.tsx:113:3renderWithHooks .../react-dom/cjs/react-dom.development.js:15486:18updateForwardRef .../react-dom/cjs/react-dom.development.js:19245:20beginWork .../react-dom/cjs/react-dom.development.js:21675:16beginWork$1 .../react-dom/cjs/react-dom.development.js:27465:14performUnitOfWork .../react-dom/cjs/react-dom.development.js:26599:12workLoopSync .../react-dom/cjs/react-dom.development.js:26505:5
src/pages/PlanPage/PlanPage.test.jsx > PlanPage > testing routes > on invoices id path > renders invoices details page
Stack Traces | 1s run time
TestingLibraryElementError: Unable to find an element with the text: /InvoiceDetailsPage/. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ .../pages/PlanPage/PlanPage.test.jsx:199:24

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

codecov bot commented Jan 24, 2025

❌ 9 Tests Failed:

Tests completed Failed Passed Skipped
3614 9 3605 2
View the top 3 failed tests by shortest run time
src/pages/PlanPage/PlanPage.test.jsx > PlanPage > testing routes > on root route > renders current org plan page
Stack Traces | 1s run time
TestingLibraryElementError: Unable to find an element with the text: /CurrentOrgPlan/. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ .../pages/PlanPage/PlanPage.test.jsx:169:46
src/pages/PlanPage/PlanPage.test.jsx > PlanPage > testing routes > on cancel path > renders cancel plan page
Stack Traces | 1s run time
TestingLibraryElementError: Unable to find an element with the text: /CancelPlanPage/. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ .../pages/PlanPage/PlanPage.test.jsx:208:45
src/pages/PlanPage/PlanPage.test.jsx > PlanPage > when the owner is part of org > renders tabs component
Stack Traces | 1.01s run time
TestingLibraryElementError: Unable to find an element with the text: /Tabs/. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>

Ignored nodes: comments, script, style
<body
  class="light"
>
  <div />
</body>waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ .../pages/PlanPage/PlanPage.test.jsx:149:33

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

const UnverifiedPaymentMethodAlert = ({ url }: { url?: string }) => {
return (
<>
<Alert variant={'warning'}>
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: don't need to wrap that in {}

Your new payment method requires verification.{' '}
<A
href={url}
isExternal={true}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can just put isExternal

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