Require min age for Stripe accounts

This commit is contained in:
Kimmo Puputti 2017-10-05 16:13:47 +03:00
parent 33f50aacce
commit 7fa8f4a9c0
2 changed files with 15 additions and 1 deletions

View file

@ -17,6 +17,8 @@ import * as validators from '../../util/validators';
import css from './PayoutDetailsForm.css';
const MIN_STRIPE_ACCOUNT_AGE = 18;
const supportedCountries = config.stripe.supportedCountries.map(c => c.code);
export const stripeCountryConfigs = countryCode => {
@ -78,6 +80,17 @@ const PayoutDetailsFormComponent = props => {
id: 'PayoutDetailsForm.birthdayRequired',
})
);
const birthdayMinAge = validators.ageAtLeast(
intl.formatMessage(
{
id: 'PayoutDetailsForm.birthdayMinAge',
},
{
minAge: MIN_STRIPE_ACCOUNT_AGE,
}
),
MIN_STRIPE_ACCOUNT_AGE
);
const countryLabel = intl.formatMessage({ id: 'PayoutDetailsForm.countryLabel' });
const countryPlaceholder = intl.formatMessage({ id: 'PayoutDetailsForm.countryPlaceholder' });
@ -218,7 +231,7 @@ const PayoutDetailsFormComponent = props => {
labelForMonth={birthdayLabelMonth}
labelForYear={birthdayLabelYear}
format={null}
validate={birthdayRequired}
validate={[birthdayRequired, birthdayMinAge]}
/>
</div>

View file

@ -317,6 +317,7 @@
"PayoutDetailsForm.birthdayLabel": "Birth date",
"PayoutDetailsForm.birthdayLabelMonth": "Month",
"PayoutDetailsForm.birthdayLabelYear": "Year",
"PayoutDetailsForm.birthdayMinAge": "You should be at least {minAge} years old.",
"PayoutDetailsForm.birthdayMonthPlaceholder": "mm",
"PayoutDetailsForm.birthdayRequired": "Birthday is required and must be a valid date.",
"PayoutDetailsForm.birthdayYearPlaceholder": "yyyy",