diff --git a/.env-template b/.env-template index 82e4be59..24066181 100644 --- a/.env-template +++ b/.env-template @@ -1,6 +1,8 @@ # Mandatory configuration # +# Note: You also need to set Stripe secret key in Flex Console. +# REACT_APP_SHARETRIBE_SDK_CLIENT_ID= REACT_APP_STRIPE_PUBLISHABLE_KEY= REACT_APP_MAPBOX_ACCESS_TOKEN= diff --git a/src/config.js b/src/config.js index 32b8401e..b42c7a43 100644 --- a/src/config.js +++ b/src/config.js @@ -1,5 +1,6 @@ import * as custom from './marketplace-custom-config.js'; import defaultLocationSearches from './default-location-searches'; +import { stripePublishableKey, stripeSupportedCountries } from './stripe-config'; const env = process.env.REACT_APP_ENV; const dev = process.env.REACT_APP_ENV === 'development'; @@ -79,298 +80,6 @@ const currencyConfig = { maximumFractionDigits: 2, }; -const stripePublishableKey = process.env.REACT_APP_STRIPE_PUBLISHABLE_KEY; - -// Stripe only supports payments in certain countries, see full list -// at https://stripe.com/global -// -// We currently only support EU countries, US, and AU. -const stripeSupportedCountries = [ - { - // Australia - code: 'AU', - currency: 'AUD', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - state: true, - }, - accountConfig: { - bsb: true, - accountNumber: true, - }, - }, - { - // Austria - code: 'AT', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Belgium - code: 'BE', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Canada - code: 'CA', - currency: 'CAD', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - province: true, - }, - accountConfig: { - transitNumber: true, - institutionNumber: true, - accountNumber: true, - }, - }, - { - // Denmark - code: 'DK', - currency: 'DKK', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Finland - code: 'FI', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // France - code: 'FR', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Germany - code: 'DE', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Hong Kong - code: 'HK', - currency: 'HKD', - addressConfig: { - addressLine: true, - city: true, - }, - accountConfig: { - clearingCode: true, - branchCode: true, - accountNumber: true, - }, - personalIdNumberRequired: true, - }, - { - // Ireland - code: 'IE', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Italy - code: 'IT', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Luxembourg - code: 'LU', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Netherlands - code: 'NL', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // New Zealand - code: 'NZ', - currency: 'NZD', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - accountNumber: true, - }, - }, - { - // Norway - code: 'NO', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Portugal - code: 'PT', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Spain - code: 'ES', - currency: 'EUR', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Sweden - code: 'SE', - currency: 'SEK', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // Switzerland - code: 'CH', - currency: 'CHF', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - iban: true, - }, - }, - { - // United Kingdom - code: 'GB', - currency: 'GBP', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - }, - accountConfig: { - sortCode: true, - accountNumber: true, - }, - }, - { - // United States - code: 'US', - currency: 'USD', - addressConfig: { - addressLine: true, - city: true, - postalCode: true, - state: true, - }, - accountConfig: { - routingNumber: true, - accountNumber: true, - }, - }, -]; - // Address information is used in SEO schema for Organization (http://schema.org/PostalAddress) const addressCountry = 'FI'; const addressRegion = 'Helsinki'; diff --git a/src/stripe-config.js b/src/stripe-config.js new file mode 100644 index 00000000..ec2a94c6 --- /dev/null +++ b/src/stripe-config.js @@ -0,0 +1,298 @@ +/* + * Stripe related configuration. + */ + +// NOTE: REACT_APP_STRIPE_PUBLISHABLE_KEY is mandatory environment variable. +// This variable is set in a hidden file: .env +// To make Stripe connection work, you also need to set Stripe's private key in the Flex Console. +export const stripePublishableKey = process.env.REACT_APP_STRIPE_PUBLISHABLE_KEY; + +// Stripe only supports payments in certain countries, see full list +// at https://stripe.com/global +// +export const stripeSupportedCountries = [ + { + // Australia + code: 'AU', + currency: 'AUD', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + state: true, + }, + accountConfig: { + bsb: true, + accountNumber: true, + }, + }, + { + // Austria + code: 'AT', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Belgium + code: 'BE', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Canada + code: 'CA', + currency: 'CAD', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + province: true, + }, + accountConfig: { + transitNumber: true, + institutionNumber: true, + accountNumber: true, + }, + }, + { + // Denmark + code: 'DK', + currency: 'DKK', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Finland + code: 'FI', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // France + code: 'FR', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Germany + code: 'DE', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Hong Kong + code: 'HK', + currency: 'HKD', + addressConfig: { + addressLine: true, + city: true, + }, + accountConfig: { + clearingCode: true, + branchCode: true, + accountNumber: true, + }, + personalIdNumberRequired: true, + }, + { + // Ireland + code: 'IE', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Italy + code: 'IT', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Luxembourg + code: 'LU', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Netherlands + code: 'NL', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // New Zealand + code: 'NZ', + currency: 'NZD', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + accountNumber: true, + }, + }, + { + // Norway + code: 'NO', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Portugal + code: 'PT', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Spain + code: 'ES', + currency: 'EUR', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Sweden + code: 'SE', + currency: 'SEK', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // Switzerland + code: 'CH', + currency: 'CHF', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + iban: true, + }, + }, + { + // United Kingdom + code: 'GB', + currency: 'GBP', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + }, + accountConfig: { + sortCode: true, + accountNumber: true, + }, + }, + { + // United States + code: 'US', + currency: 'USD', + addressConfig: { + addressLine: true, + city: true, + postalCode: true, + state: true, + }, + accountConfig: { + routingNumber: true, + accountNumber: true, + }, + ssnLast4Required: true, + }, +];