Add Singapore to Stripe countries

This commit is contained in:
Jenni Nurmi 2019-07-04 10:03:14 +03:00
parent 8e550d8392
commit 426a12288b
5 changed files with 59 additions and 1 deletions

View file

@ -12,8 +12,10 @@ export const INSTITUTION_NUMBER = 'institutionNumber';
export const TRANSIT_NUMBER = 'transitNumber';
// Needed for creating full routing number in Hong Kong
export const CLEARING_CODE = 'clearingCode';
// Needed for creating full routing number in Hong Kong
// Needed for creating full routing number in Hong Kong and Singapore
export const BRANCH_CODE = 'branchCode';
// Needed for creating full routing number in Singapore
export const BANK_CODE = 'bankCode';
// International bank account number (e.g. EU countries use this)
export const IBAN = 'iban';
// Routing number to separate bank account in different areas
@ -29,6 +31,7 @@ export const BANK_ACCOUNT_INPUTS = [
INSTITUTION_NUMBER,
CLEARING_CODE,
BRANCH_CODE,
BANK_CODE,
SORT_CODE,
ROUTING_NUMBER,
ACCOUNT_NUMBER,
@ -190,6 +193,14 @@ export const mapInputsToStripeAccountKeys = (country, values) => {
routing_number: cleanedString(values[ROUTING_NUMBER]),
account_number: cleanedString(values[ACCOUNT_NUMBER]),
};
case 'SG':
return {
routing_number: cleanedString(values[BANK_CODE]).concat(
'-',
cleanedString(values[BRANCH_CODE])
),
account_number: cleanedString(values[ACCOUNT_NUMBER]),
};
case 'HK':
return {
routing_number: cleanedString(values[CLEARING_CODE]).concat(

View file

@ -115,6 +115,19 @@ const PayoutDetailsPersonalDetails = props => {
})
);
personalIdNumberValid = validators.composeValidators(personalIdNumberRequired, validHKID);
} else if (country === 'SG') {
personalIdNumberLabel = intl.formatMessage({
id: `PayoutDetailsForm.personalIdNumberLabel.SG`,
});
personalIdNumberPlaceholder = intl.formatMessage({
id: `PayoutDetailsForm.personalIdNumberPlaceholder.SG`,
});
const validSGID = validators.validSGID(
intl.formatMessage({
id: `PayoutDetailsForm.personalIdNumberValid`,
})
);
personalIdNumberValid = validators.composeValidators(personalIdNumberRequired, validSGID);
}
const phoneLabel = intl.formatMessage({ id: 'PayoutDetailsForm.personalPhoneLabel' });

View file

@ -284,6 +284,28 @@ export const stripeSupportedCountries = [
owners: true,
},
},
{
// Singapore
code: 'SG',
currency: 'SGD',
addressConfig: {
addressLine: true,
postalCode: true,
},
accountConfig: {
bankCode: true,
branchCode: true,
accountNumber: true,
},
companyConfig: {
personalAddress: true,
owners: true,
personalIdNumberRequired: true,
},
individualConfig: {
personalIdNumberRequired: true,
},
},
{
// Spain
code: 'ES',

View file

@ -533,6 +533,7 @@
"PayoutDetailsForm.companyTaxIdLabel.NZ": "NZBN",
"PayoutDetailsForm.companyTaxIdLabel.PT": "N.º Contribuinte",
"PayoutDetailsForm.companyTaxIdLabel.SE": "Organisationsnummer",
"PayoutDetailsForm.companyTaxIdLabel.SG": "Unique Entity Number (UEN)",
"PayoutDetailsForm.companyTaxIdLabel.US": "Tax ID",
"PayoutDetailsForm.companyTaxIdPlaceholder": "Enter {idName}…",
"PayoutDetailsForm.companyTaxIdRequired": "{idName} is required",
@ -557,6 +558,7 @@
"PayoutDetailsForm.countryNames.NZ": "New Zealand",
"PayoutDetailsForm.countryNames.PT": "Portugal",
"PayoutDetailsForm.countryNames.SE": "Sweden",
"PayoutDetailsForm.countryNames.SG": "Singapore",
"PayoutDetailsForm.countryNames.US": "United States",
"PayoutDetailsForm.countryPlaceholder": "Select your country…",
"PayoutDetailsForm.countryRequired": "This field is required",
@ -583,8 +585,10 @@
"PayoutDetailsForm.personalEmailPlaceholder": "Email address",
"PayoutDetailsForm.personalEmailRequired": "This field is required",
"PayoutDetailsForm.personalIdNumberLabel.HK": "Hong Kong Identity Card Number (HKID)",
"PayoutDetailsForm.personalIdNumberLabel.SG": "National Registration Identity Card (NRIC) or Foreign Identification Number (FIN)",
"PayoutDetailsForm.personalIdNumberLabel.US": "Last 4 digits of social security number (SSN)",
"PayoutDetailsForm.personalIdNumberPlaceholder.HK": "XY123456",
"PayoutDetailsForm.personalIdNumberPlaceholder.SG": "S8888888A",
"PayoutDetailsForm.personalIdNumberPlaceholder.US": "1234",
"PayoutDetailsForm.personalIdNumberRequired": "This field is required",
"PayoutDetailsForm.personalIdNumberTitle": "Personal id number",
@ -743,6 +747,10 @@
"StripeBankAccountTokenInputField.accountNumber.placeholder": "Type in bank account number…",
"StripeBankAccountTokenInputField.accountNumber.required": "Bank account number is required",
"StripeBankAccountTokenInputField.andBeforeLastItemInAList": " and",
"StripeBankAccountTokenInputField.bankCode.inline": "bank code",
"StripeBankAccountTokenInputField.bankCode.label": "Bank code",
"StripeBankAccountTokenInputField.bankCode.placeholder": "Type in bank code…",
"StripeBankAccountTokenInputField.bankCode.required": "Bank code is required",
"StripeBankAccountTokenInputField.branchCode.inline": "branch code",
"StripeBankAccountTokenInputField.branchCode.label": "Branch code",
"StripeBankAccountTokenInputField.branchCode.placeholder": "Type in branch code…",

View file

@ -219,5 +219,9 @@ export const validHKID = message => value => {
return isValid ? VALID : message;
};
export const validSGID = message => value => {
return value.length === 9 ? VALID : message;
};
export const composeValidators = (...validators) => value =>
validators.reduce((error, validator) => error || validator(value), VALID);