mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-27 19:42:11 +10:00
Remove synchronous account and routing number validation
Stripe v3 removes the validation helpers and v2 validation only worked with US numbers.
This commit is contained in:
parent
120868c02f
commit
8709a7b225
3 changed files with 0 additions and 39 deletions
|
|
@ -16,7 +16,6 @@ import {
|
|||
mapInputsToStripeAccountKeys,
|
||||
supportedCountries,
|
||||
translateStripeError,
|
||||
validateInput,
|
||||
} from './StripeBankAccountTokenInputField.util';
|
||||
import StripeBankAccountRequiredInput from './StripeBankAccountRequiredInput';
|
||||
import css from './StripeBankAccountTokenInputField.css';
|
||||
|
|
@ -183,13 +182,6 @@ class TokenInputFieldComponent extends Component {
|
|||
inputError = intl.formatMessage({
|
||||
id: `StripeBankAccountTokenInputField.${inputType}.required`,
|
||||
});
|
||||
} else if (!validateInput(inputType, value, country, window.Stripe)) {
|
||||
inputError = intl.formatMessage(
|
||||
{
|
||||
id: `StripeBankAccountTokenInputField.${inputType}.invalid`,
|
||||
},
|
||||
{ country }
|
||||
);
|
||||
}
|
||||
|
||||
// Save changes to the state
|
||||
|
|
|
|||
|
|
@ -132,32 +132,6 @@ export const translateStripeError = (country, intl, stripeError) => {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Validate input before creating Token
|
||||
*
|
||||
* @param {String} inputType - input type (e.g. 'routingNumber', 'IBAN')
|
||||
* @param {String} value - input value
|
||||
* @param {String} country - string representing country code (e.g. 'US', 'FI')
|
||||
*
|
||||
* @return {Boolean} is valid value.
|
||||
*/
|
||||
export const validateInput = (inputType, value, country, stripe) => {
|
||||
switch (inputType) {
|
||||
case ACCOUNT_NUMBER:
|
||||
return stripe.bankAccount.validateAccountNumber(value, country);
|
||||
case ROUTING_NUMBER:
|
||||
return stripe.bankAccount.validateRoutingNumber(value, country);
|
||||
case BSB:
|
||||
case IBAN:
|
||||
case SORT_CODE:
|
||||
// Unfortunately we don't have validation for these yet
|
||||
// (Stripe errors work as validation)
|
||||
return true;
|
||||
|
||||
default:
|
||||
throw new Error(`Unknown inputType (${inputType}) given to validator`);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Map inputs to correct Stripe keys
|
||||
|
|
|
|||
|
|
@ -574,30 +574,25 @@
|
|||
"SignupForm.termsAndConditionsAcceptText": "By signing up you accept the {termsLink}",
|
||||
"SignupForm.termsAndConditionsLinkText": "terms and conditions",
|
||||
"StripeBankAccountTokenInputField.accountNumber.inline": "account number",
|
||||
"StripeBankAccountTokenInputField.accountNumber.invalid": "Invalid {country} bank account number",
|
||||
"StripeBankAccountTokenInputField.accountNumber.label": "Bank account number",
|
||||
"StripeBankAccountTokenInputField.accountNumber.placeholder": "Type in bank account number…",
|
||||
"StripeBankAccountTokenInputField.accountNumber.required": "Bank account number is required",
|
||||
"StripeBankAccountTokenInputField.andBeforeLastItemInAList": " and",
|
||||
"StripeBankAccountTokenInputField.bsb.inline": "BSB",
|
||||
"StripeBankAccountTokenInputField.bsb.invalid": "Invalid {country} BSB",
|
||||
"StripeBankAccountTokenInputField.bsb.label": "BSB",
|
||||
"StripeBankAccountTokenInputField.bsb.placeholder": "Type in BSB…",
|
||||
"StripeBankAccountTokenInputField.bsb.required": "BSB is required",
|
||||
"StripeBankAccountTokenInputField.genericStripeError": "Could not connect account number. Please double-check that your {inputs} are valid in {country}",
|
||||
"StripeBankAccountTokenInputField.genericStripeErrorIban": "Could not connect account number. Please double-check that your account number is valid in {country}",
|
||||
"StripeBankAccountTokenInputField.iban.inline": "IBAN",
|
||||
"StripeBankAccountTokenInputField.iban.invalid": "Invalid {country} bank account number",
|
||||
"StripeBankAccountTokenInputField.iban.label": "Bank account number (IBAN)",
|
||||
"StripeBankAccountTokenInputField.iban.placeholder": "DE89 3704 0044 0532 0130 00",
|
||||
"StripeBankAccountTokenInputField.iban.required": "Bank account number (IBAN) is required",
|
||||
"StripeBankAccountTokenInputField.routingNumber.inline": "routing number",
|
||||
"StripeBankAccountTokenInputField.routingNumber.invalid": "Invalid {country} routing number",
|
||||
"StripeBankAccountTokenInputField.routingNumber.label": "Routing number",
|
||||
"StripeBankAccountTokenInputField.routingNumber.placeholder": "Type in routing number…",
|
||||
"StripeBankAccountTokenInputField.routingNumber.required": "Routing number is required",
|
||||
"StripeBankAccountTokenInputField.sortCode.inline": "sort code",
|
||||
"StripeBankAccountTokenInputField.sortCode.invalid": "Invalid {country} sort code",
|
||||
"StripeBankAccountTokenInputField.sortCode.label": "Sort code",
|
||||
"StripeBankAccountTokenInputField.sortCode.placeholder": "Type in sort code…",
|
||||
"StripeBankAccountTokenInputField.sortCode.required": "Sort code is required",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue