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

Support other EEA countries #366

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
35 changes: 11 additions & 24 deletions _base/src/pages/api/onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import Stripe from "stripe";

import { apiResponse } from "src/types/api-response";
import FinancialProduct from "src/types/financial-product";
import {
CountryConfigMap,
SupportedCountry,
} from "src/utils/account-management-helpers";
import { CountryConfigMap } from "src/utils/account-management-helpers";
import { handlerMapping } from "src/utils/api-helpers";
import { isDemoMode, TOS_ACCEPTANCE } from "src/utils/demo-helpers";
import {
isDemoMode,
TOS_ACCEPTANCE,
getStaticFakeCompanyTaxIdNumberByCountry,
getStaticFakePhoneByCountry,
getStaticFakeAddressByCountry,
} from "src/utils/demo-helpers";
import { createAccountOnboardingUrl } from "src/utils/onboarding-helpers";
import { getSessionForServerSide } from "src/utils/session-helpers";
import stripeClient from "src/utils/stripe-loader";
Expand Down Expand Up @@ -80,26 +83,11 @@ const onboard = async (req: NextApiRequest, res: NextApiResponse) => {
},
company: {
name: businessName,
// Fake business TIN: https://stripe.com/docs/connect/testing#test-business-tax-ids
tax_id: "000000000",
tax_id: getStaticFakeCompanyTaxIdNumberByCountry(country),
},
individual: {
address: {
// This value causes the address to be verified in testmode: https://stripe.com/docs/connect/testing#test-verification-addresses
line1: "address_full_match",
// @if financialProduct==embedded-finance
...(country === SupportedCountry.US && {
city: "South San Francisco",
state: "CA",
postal_code: "94080",
}),
// @endif
// @if financialProduct==expense-management
...(country === SupportedCountry.UK && {
city: "London",
postal_code: "WC32 4AP",
}),
// @endif
...getStaticFakeAddressByCountry(country),
country: country.toString(),
},
// These values together cause the DOB to be verified in testmode: https://stripe.com/docs/connect/testing#test-dobs
Expand All @@ -111,8 +99,7 @@ const onboard = async (req: NextApiRequest, res: NextApiResponse) => {
email: email,
first_name: "John",
last_name: "Smith",
// Fake phone number: https://docs.stripe.com/connect/testing#using-oauth
phone: "000-000-0000",
phone: getStaticFakePhoneByCountry(country),
},
...(skipOnboarding && { tos_acceptance: TOS_ACCEPTANCE }),
// Faking Terms of Service acceptances
Expand Down
Loading