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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/main' into sshin/stripe-3
  • Loading branch information
suejung-sentry committed Jan 24, 2025
commit b9ff2e260e4173f3b116a4ef19e8928e77b2d7a4
Original file line number Diff line number Diff line change
@@ -3,10 +3,7 @@
import cs from 'classnames'
import { z } from 'zod'

import {
BillingDetailsSchema,
SubscriptionDetailSchema,
} from 'services/account'
import { AccountDetailsSchema, BillingDetailsSchema } from 'services/account'
import {
MissingAddressError,
MissingEmailError,
@@ -130,9 +127,34 @@
}
}

export const getEmail = (
accountDetails: z.infer<typeof AccountDetailsSchema>
) => {
return (
accountDetails?.subscriptionDetail?.defaultPaymentMethod?.billingDetails
?.email ||
accountDetails?.subscriptionDetail?.latestInvoice?.customerEmail ||
accountDetails?.subscriptionDetail?.customer?.email ||
accountDetails?.email ||
undefined
)
}

export const getName = (
accountDetails: z.infer<typeof AccountDetailsSchema>
) => {
return (
accountDetails?.subscriptionDetail?.defaultPaymentMethod?.billingDetails
?.name ||
accountDetails?.subscriptionDetail?.latestInvoice?.customerName ||
accountDetails?.name ||
undefined
)
}

export const getErrorMessage = (error: Error): JSX.Element => {
switch (error.message) {
case MissingNameError:

Check failure on line 157 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/PaymentCard/PaymentMethodForm.tsx

GitHub Actions / Test Runner #2 - Vitest

src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/PaymentCard/PaymentMethodForm.test.tsx > PaymentMethodForm > when there is an error in the form > renders the error

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 src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/PaymentCard/PaymentMethodForm.tsx:157:10 ❯ PaymentMethodForm src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/PaymentCard/PaymentMethodForm.tsx:93:25 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:15486:18 ❯ mountIndeterminateComponent node_modules/react-dom/cjs/react-dom.development.js:20103:13 ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21626:16 ❯ beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:27465:14 ❯ performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js:26599:12 ❯ workLoopSync node_modules/react-dom/cjs/react-dom.development.js:26505:5
return <span>Missing name, please edit Full Name</span>
case MissingEmailError:
return <span>Missing email, please edit Email</span>
Loading
Oops, something went wrong.
You are viewing a condensed version of this merge commit. You can view the full changes here.