diff --git a/app/(auth)/bankaccountform/form.tsx b/app/(auth)/bankaccountform/form.tsx deleted file mode 100644 index e9e126f4..00000000 --- a/app/(auth)/bankaccountform/form.tsx +++ /dev/null @@ -1,225 +0,0 @@ -'use client'; - -import * as React from 'react'; -import {useRouter} from 'next/navigation'; -import {signIn} from 'next-auth/react'; -import {zodResolver} from '@hookform/resolvers/zod'; -import {ControllerRenderProps, useForm} from 'react-hook-form'; -import {z} from 'zod'; -import {Button} from '@/components/ui/button'; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form'; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from '@/components/ui/select'; -import {Input} from '@/components/ui/input'; -import {Collapsible} from '@/components/ui/collapsible'; -import {ChevronUp, ChevronDown, ArrowRight, Loader2} from 'lucide-react'; -import {Link} from '@/components/ui/link'; - -const formSchema = z.object({ - accountName: z.string().min(1), - accountType: z.string(), - country: z.string(), - currency: z.string(), - accountNumber: z.string().min(1), - routingNumber: z.string(), -}); - -export default function BankAccountForm() { - const router = useRouter(); - const [error, setError] = React.useState(false); - const [submitting, setSubmitting] = React.useState(false); - - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - accountName: '', - accountType: 'individual', - country: 'US', - currency: 'usd', - accountNumber: '', - routingNumber: '110000000', - }, - }); - - const onSubmit = async (values: z.infer) => { - setSubmitting(true); - const data = { - country: values.country, - currency: values.currency, - account_holder_name: values.accountName, - account_holder_type: values.accountType, - routing_number: values.routingNumber, - account_number: values.accountNumber, - }; - - const response = await fetch('/api/setup_accounts/create_bank_account', { - method: 'POST', - body: JSON.stringify(data), - }); - if (!response.ok) { - // Handle errors on the client side here - console.warn('An error occurred: ', error); - setError(true); - setSubmitting(false); - return undefined; - } else { - setError(false); - router.push('/home?shownux=true'); - } - }; - - return ( -
- -
- ( - - Account Holder Name - - - - - - )} - /> -
-
- ( - - Account Holder Type - - - - - - )} - /> -
-
- ( - - Country - - - - - - )} - /> -
-
- ( - - Currency - - - - - - )} - /> -
-
- ( - - Routing Number - - - - - - )} - /> -
-
- ( - - Account Number - - - - - - )} - /> -
- - {error && ( -
- {' '} - An error occurred. Please try again using a test account number.{' '} -
- )} -
- - ); -} diff --git a/app/(auth)/bankaccountform/page.tsx b/app/(auth)/bankaccountform/page.tsx deleted file mode 100644 index b6542a6b..00000000 --- a/app/(auth)/bankaccountform/page.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import {getServerSession} from 'next-auth'; -import {redirect} from 'next/navigation'; -import BankAccountForm from './form'; - -export default async function BankAccount() { - const session = await getServerSession(); - if (!session || !session.user?.email) { - return redirect('/login'); - } - return ( - <> -
-

Add your bank account

-
-
-

- Note: you need to use a Stripe test bank account. Those can be found{' '} - here -

- -
- - ); -} diff --git a/app/(auth)/onboarding/page.tsx b/app/(auth)/onboarding/page.tsx index ef4b2c92..45863ea5 100644 --- a/app/(auth)/onboarding/page.tsx +++ b/app/(auth)/onboarding/page.tsx @@ -3,26 +3,13 @@ import {ConnectAccountOnboarding} from '@stripe/react-connect-js'; import EmbeddedComponentContainer from '@/app/components/EmbeddedComponentContainer'; import React from 'react'; -import {useSession} from 'next-auth/react'; export default function Onboarding() { - const {data: session} = useSession(); - const stripeAccount = session?.user.stripeAccount; - - const isCustom = - stripeAccount?.controller?.stripe_dashboard?.type === 'none' && - stripeAccount?.controller?.losses?.payments === 'application' && - stripeAccount?.controller?.requirement_collection === 'application'; - return ( { - if (isCustom) { - window.location.href = '/bankaccountform'; - } else { - window.location.href = '/home?shownux=true'; - } + window.location.href = '/home?shownux=true'; }} /> diff --git a/app/api/account_session/route.ts b/app/api/account_session/route.ts index 2a822b5b..d182e7ac 100644 --- a/app/api/account_session/route.ts +++ b/app/api/account_session/route.ts @@ -81,7 +81,7 @@ export async function POST(req: NextRequest) { enabled: true, features: { money_movement: true, - external_account_collection: !isCustom, + disable_stripe_user_authentication: isCustom, }, }, financial_account_transactions: { @@ -105,24 +105,30 @@ export async function POST(req: NextRequest) { instant_payouts: true, standard_payouts: true, edit_payout_schedule: true, - external_account_collection: !isCustom, + disable_stripe_user_authentication: isCustom, }, }, // Connect account_management: { enabled: true, - features: {external_account_collection: !isCustom}, + features: { + disable_stripe_user_authentication: isCustom, + }, }, account_onboarding: { enabled: true, - features: {external_account_collection: !isCustom}, + features: { + disable_stripe_user_authentication: isCustom, + }, }, // @ts-ignore payment_method_settings: {enabled: true}, documents: {enabled: true}, notification_banner: { enabled: true, - features: {external_account_collection: !isCustom}, + features: { + disable_stripe_user_authentication: isCustom, + }, }, capital_overview: { enabled: true, diff --git a/package.json b/package.json index 41290fee..0159991e 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "react-dom": "^18", "react-hook-form": "^7.51.1", "sharp": "^0.33.4", - "stripe": "^15.12.0-beta.1", + "stripe": "^17.3.0-beta.1", "tailwind-merge": "^2.2.2", "tailwindcss-animate": "^1.0.7", "yarn": "^1.22.22", diff --git a/yarn.lock b/yarn.lock index b830ca14..8aae5426 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4573,10 +4573,10 @@ strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -stripe@^15.12.0-beta.1: - version "15.12.0" - resolved "https://registry.yarnpkg.com/stripe/-/stripe-15.12.0.tgz#a30c242861f9c97dd31d3078fb0673d9bd10efe2" - integrity sha512-slTbYS1WhRJXVB8YXU8fgHizkUrM9KJyrw4Dd8pLEwzKHYyQTIE46EePC2MVbSDZdE24o1GdNtzmJV4PrPpmJA== +stripe@^17.3.0-beta.1: + version "17.3.0-beta.1" + resolved "https://registry.yarnpkg.com/stripe/-/stripe-17.3.0-beta.1.tgz#4d7a3843e8e272f66973ed26de72b30b06946cfa" + integrity sha512-qi/ChW82ElFIe9Tz7mdPI+rx8neHmYoBGODeJ0QNfP9hdyx7F06nBjxriCWO9Y3poL+XQ8WXGOPjyhRgWVa34A== dependencies: "@types/node" ">=8.1.0" qs "^6.11.0"