Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,15 @@ const CONST = {
PREFIX: 'beneficialOwner',
FIRST_NAME: 'firstName',
LAST_NAME: 'lastName',
NATIONALITY: 'nationality',
OWNERSHIP_PERCENTAGE: 'ownershipPercentage',
DOB: 'dob',
SSN_LAST_4: 'ssnLast4',
STREET: 'street',
CITY: 'city',
STATE: 'state',
ZIP_CODE: 'zipCode',
COUNTRY: 'nationality',
COUNTRY: 'country',
PROOF_OF_OWNERSHIP: 'proofOfBeneficialOwner',
COPY_OF_ID: 'copyOfIDForBeneficialOwner',
ADDRESS_PROOF: 'addressProofForBeneficialOwner',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3307,6 +3307,9 @@ ${
whatsYourAddress: 'Wie lautet Ihre Adresse?',
whatAreTheLast: 'Was sind die letzten 4 Ziffern der Sozialversicherungsnummer des Eigentümers?',
whatsYourLast: 'Was sind die letzten 4 Ziffern Ihrer Sozialversicherungsnummer?',
whatsYourNationality: 'Was ist Ihr Staatsangehörigkeitsland?',
whatsTheOwnersNationality: 'Was ist das Staatsangehörigkeitsland des Eigentümers?',
countryOfCitizenship: 'Staatsangehörigkeitsland',
dontWorry: 'Keine Sorge, wir führen keine persönlichen Bonitätsprüfungen durch!',
last4: 'Letzte 4 der SSN',
whyDoWeAsk: 'Warum fragen wir danach?',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3400,6 +3400,9 @@ const translations = {
whatsYourAddress: "What's your address?",
whatAreTheLast: "What are the last 4 digits of the owner's Social Security Number?",
whatsYourLast: 'What are the last 4 digits of your Social Security Number?',
whatsYourNationality: 'What is your country of citizenship?',
whatsTheOwnersNationality: "What's the owner's country of citizenship?",
countryOfCitizenship: 'Country of citizenship',
dontWorry: "Don't worry, we don't do any personal credit checks!",
last4: 'Last 4 of SSN',
whyDoWeAsk: 'Why do we ask for this?',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3052,6 +3052,9 @@ ${amount} para ${merchant} - ${date}`,
whatsYourAddress: '¿Cuál es su dirección?',
whatAreTheLast: '¿Cuáles son los últimos 4 dígitos del número de seguro social del propietario?',
whatsYourLast: '¿Cuáles son los últimos 4 dígitos de su número de seguro social?',
whatsYourNationality: '¿Cuál es tu país de ciudadanía?',
whatsTheOwnersNationality: '¿Cuál es el país de ciudadanía del propietario?',
countryOfCitizenship: 'País de ciudadanía',
dontWorry: 'No se preocupe, ¡no realizamos ninguna verificación de crédito personal!',
last4: 'Últimos 4 del SSN',
whyDoWeAsk: '¿Por qué solicitamos esto?',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3310,6 +3310,9 @@ ${
whatsYourAddress: 'Quelle est votre adresse ?',
whatAreTheLast: 'Quels sont les 4 derniers chiffres du numéro de sécurité sociale du propriétaire ?',
whatsYourLast: 'Quels sont les 4 derniers chiffres de votre numéro de sécurité sociale ?',
whatsYourNationality: 'Quel est votre pays de citoyenneté ?',
whatsTheOwnersNationality: 'Quel est le pays de citoyenneté du propriétaire ?',
countryOfCitizenship: 'Pays de citoyenneté',
dontWorry: 'Ne vous inquiétez pas, nous ne faisons aucune vérification de crédit personnel !',
last4: 'Derniers 4 du SSN',
whyDoWeAsk: 'Pourquoi demandons-nous cela ?',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3292,6 +3292,9 @@ ${
whatsYourAddress: 'Qual è il tuo indirizzo?',
whatAreTheLast: 'Quali sono le ultime 4 cifre del numero di previdenza sociale del proprietario?',
whatsYourLast: 'Quali sono le ultime 4 cifre del tuo numero di previdenza sociale?',
whatsYourNationality: 'Qual è il tuo paese di cittadinanza?',
whatsTheOwnersNationality: 'Qual è il paese di cittadinanza del proprietario?',
countryOfCitizenship: 'Paese di cittadinanza',
dontWorry: 'Non preoccuparti, non facciamo alcun controllo del credito personale!',
last4: 'Ultime 4 cifre del SSN',
whyDoWeAsk: 'Perché lo chiediamo?',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3278,6 +3278,9 @@ ${
whatsYourAddress: '住所は何ですか?',
whatAreTheLast: '所有者の社会保障番号の下4桁は何ですか?',
whatsYourLast: 'あなたの社会保障番号の最後の4桁は何ですか?',
whatsYourNationality: 'あなたの市民権の国はどこですか?',
whatsTheOwnersNationality: '所有者の市民権の国はどこですか?',
countryOfCitizenship: '市民権の国',
dontWorry: 'ご安心ください、私たちは個人の信用調査を行いません!',
last4: 'SSNの下4桁',
whyDoWeAsk: 'なぜこれを尋ねるのですか?',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3292,6 +3292,9 @@ ${
whatsYourAddress: 'Wat is jouw adres?',
whatAreTheLast: 'Wat zijn de laatste 4 cijfers van het burgerservicenummer van de eigenaar?',
whatsYourLast: 'Wat zijn de laatste 4 cijfers van uw burgerservicenummer?',
whatsYourNationality: 'Wat is uw nationaliteitsland?',
whatsTheOwnersNationality: 'Wat is het nationaliteitsland van de eigenaar?',
countryOfCitizenship: 'Nationaliteitsland',
dontWorry: 'Maak je geen zorgen, we doen geen persoonlijke kredietcontroles!',
last4: 'Laatste 4 van SSN',
whyDoWeAsk: 'Waarom vragen we hierom?',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3286,6 +3286,9 @@ ${
whatsYourAddress: 'Jaki jest Twój adres?',
whatAreTheLast: 'Jakie są ostatnie 4 cyfry numeru Social Security właściciela?',
whatsYourLast: 'Jakie są ostatnie 4 cyfry Twojego numeru Social Security?',
whatsYourNationality: 'Jaki jest Twój kraj obywatelstwa?',
whatsTheOwnersNationality: 'Jaki jest kraj obywatelstwa właściciela?',
countryOfCitizenship: 'Kraj obywatelstwa',
dontWorry: 'Nie martw się, nie przeprowadzamy żadnych osobistych sprawdzeń kredytowych!',
last4: 'Ostatnie 4 cyfry numeru SSN',
whyDoWeAsk: 'Dlaczego o to prosimy?',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3288,6 +3288,9 @@ ${
whatsYourAddress: 'Qual é o seu endereço?',
whatAreTheLast: 'Quais são os últimos 4 dígitos do Número de Seguro Social do proprietário?',
whatsYourLast: 'Quais são os últimos 4 dígitos do seu Número de Seguro Social?',
whatsYourNationality: 'Qual é o seu país de cidadania?',
whatsTheOwnersNationality: 'Qual é o país de cidadania do proprietário?',
countryOfCitizenship: 'País de cidadania',
dontWorry: 'Não se preocupe, não fazemos nenhuma verificação de crédito pessoal!',
last4: 'Últimos 4 do SSN',
whyDoWeAsk: 'Por que pedimos isso?',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3244,6 +3244,9 @@ ${
whatsYourAddress: '你的地址是什么?',
whatAreTheLast: '业主社会安全号码的最后四位数字是什么?',
whatsYourLast: '您的社会安全号码的最后四位数字是什么?',
whatsYourNationality: '您的公民身份所属国家是?',
whatsTheOwnersNationality: '业主的公民身份所属国家是?',
countryOfCitizenship: '公民身份国家',
dontWorry: '别担心,我们不会进行任何个人信用检查!',
last4: 'SSN的后四位',
whyDoWeAsk: '我们为什么要求这个?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ import SafeString from '@src/utils/SafeString';

type NameProps = SubStepProps & {isUserEnteringHisOwnData: boolean; ownerBeingModifiedID: string};

const {STREET, CITY, STATE, ZIP_CODE, COUNTRY, PREFIX} = CONST.NON_USD_BANK_ACCOUNT.BENEFICIAL_OWNER_INFO_STEP.BENEFICIAL_OWNER_DATA;
const {STREET, CITY, STATE, ZIP_CODE, COUNTRY, NATIONALITY, PREFIX} = CONST.NON_USD_BANK_ACCOUNT.BENEFICIAL_OWNER_INFO_STEP.BENEFICIAL_OWNER_DATA;

function Address({onNext, isEditing, onMove, isUserEnteringHisOwnData, ownerBeingModifiedID}: NameProps) {
const {translate} = useLocalize();
const [reimbursementAccountDraft] = useOnyx(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM_DRAFT);
const [reimbursementAccountDraft] = useOnyx(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM_DRAFT, {canBeMissing: true});
const countryStepCountryValue = reimbursementAccountDraft?.[INPUT_IDS.ADDITIONAL_DATA.COUNTRY] ?? '';
const nationalityInputKey = `${PREFIX}_${ownerBeingModifiedID}_${NATIONALITY}` as const;
const nationality = reimbursementAccountDraft?.[nationalityInputKey] ?? '';

const countryInputKey = `${PREFIX}_${ownerBeingModifiedID}_${COUNTRY}` as const;

const inputKeys = {
street: `${PREFIX}_${ownerBeingModifiedID}_${STREET}`,
city: `${PREFIX}_${ownerBeingModifiedID}_${CITY}`,
Expand Down Expand Up @@ -62,15 +65,15 @@ function Address({onNext, isEditing, onMove, isUserEnteringHisOwnData, ownerBein
};

const handleNextStep = () => {
// owner is US based we need to gather last four digits of his SSN
if (reimbursementAccountDraft?.[inputKeys.country] === CONST.COUNTRY.US) {
// owner is US citizen so we need to gather last four digits of his SSN
if (nationality === CONST.COUNTRY.US) {
onNext();
// currency is set to GBP and owner is UK based, so we skip SSN and Documents step
} else if (countryStepCountryValue === CONST.COUNTRY.GB && reimbursementAccountDraft?.[inputKeys.country] === CONST.COUNTRY.GB) {
onMove(6, false);
// owner is not US based so we skip SSN step
// currency is set to GBP and owner is UK citizen, so we skip SSN and Documents step
} else if (countryStepCountryValue === CONST.COUNTRY.GB && nationality === CONST.COUNTRY.GB) {
onMove(7, false);
// owner is not US citizen so we skip SSN step
} else {
onMove(5, false);
onMove(6, false);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ import SafeString from '@src/utils/SafeString';

type ConfirmationProps = SubStepProps & {ownerBeingModifiedID: string};

const {PREFIX, COUNTRY} = CONST.NON_USD_BANK_ACCOUNT.BENEFICIAL_OWNER_INFO_STEP.BENEFICIAL_OWNER_DATA;
const {PREFIX, NATIONALITY} = CONST.NON_USD_BANK_ACCOUNT.BENEFICIAL_OWNER_INFO_STEP.BENEFICIAL_OWNER_DATA;

function Confirmation({onNext, onMove, isEditing, ownerBeingModifiedID}: ConfirmationProps) {
const {translate} = useLocalize();
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT);
const [reimbursementAccountDraft] = useOnyx(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM_DRAFT);
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {canBeMissing: false});
const [reimbursementAccountDraft] = useOnyx(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM_DRAFT, {canBeMissing: true});
const values = useMemo(() => getValuesForBeneficialOwner(ownerBeingModifiedID, reimbursementAccountDraft), [ownerBeingModifiedID, reimbursementAccountDraft]);
const beneficialOwnerCountryInputID = `${PREFIX}_${ownerBeingModifiedID}_${COUNTRY}` as const;
const beneficialOwnerCountry = SafeString(reimbursementAccountDraft?.[beneficialOwnerCountryInputID]);
const beneficialOwnerNationalityInputID = `${PREFIX}_${ownerBeingModifiedID}_${NATIONALITY}` as const;
const beneficialOwnerNationality = SafeString(reimbursementAccountDraft?.[beneficialOwnerNationalityInputID]);
const policyID = reimbursementAccount?.achData?.policyID;
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {canBeMissing: true});
const currency = policy?.outputCurrency ?? '';
const countryStepCountryValue = reimbursementAccountDraft?.[INPUT_IDS.ADDITIONAL_DATA.COUNTRY] ?? '';
const isDocumentNeededStatus = getNeededDocumentsStatusForBeneficialOwner(currency, countryStepCountryValue, beneficialOwnerCountry);
const isDocumentNeededStatus = getNeededDocumentsStatusForBeneficialOwner(currency, countryStepCountryValue, beneficialOwnerNationality);

const summaryItems = useMemo(
() => [
Expand All @@ -37,30 +37,38 @@ function Confirmation({onNext, onMove, isEditing, ownerBeingModifiedID}: Confirm
onMove(0);
},
},
{
title: CONST.ALL_COUNTRIES[values.nationality as keyof typeof CONST.ALL_COUNTRIES],
description: translate('ownershipInfoStep.countryOfCitizenship'),
shouldShowRightIcon: true,
onPress: () => {
onMove(1);
},
},
{
title: values.ownershipPercentage,
description: translate('ownershipInfoStep.ownershipPercentage'),
shouldShowRightIcon: true,
onPress: () => {
onMove(1);
onMove(2);
},
},
{
title: values.dob,
description: translate('common.dob'),
shouldShowRightIcon: true,
onPress: () => {
onMove(2);
onMove(3);
},
},
...(beneficialOwnerCountry === CONST.COUNTRY.US
...(beneficialOwnerNationality === CONST.COUNTRY.US
? [
{
title: values.ssnLast4,
description: translate('ownershipInfoStep.last4'),
shouldShowRightIcon: true,
onPress: () => {
onMove(4);
onMove(5);
},
},
]
Expand All @@ -70,7 +78,7 @@ function Confirmation({onNext, onMove, isEditing, ownerBeingModifiedID}: Confirm
description: translate('ownershipInfoStep.address'),
shouldShowRightIcon: true,
onPress: () => {
onMove(3);
onMove(4);
},
},
...(isDocumentNeededStatus.isProofOfOwnershipNeeded
Expand All @@ -80,7 +88,7 @@ function Confirmation({onNext, onMove, isEditing, ownerBeingModifiedID}: Confirm
description: translate('ownershipInfoStep.proofOfBeneficialOwner'),
shouldShowRightIcon: true,
onPress: () => {
onMove(5);
onMove(6);
},
},
]
Expand All @@ -92,7 +100,7 @@ function Confirmation({onNext, onMove, isEditing, ownerBeingModifiedID}: Confirm
description: translate('ownershipInfoStep.copyOfID'),
shouldShowRightIcon: true,
onPress: () => {
onMove(5);
onMove(6);
},
},
]
Expand All @@ -104,7 +112,7 @@ function Confirmation({onNext, onMove, isEditing, ownerBeingModifiedID}: Confirm
description: translate('ownershipInfoStep.proofOfAddress'),
shouldShowRightIcon: true,
onPress: () => {
onMove(5);
onMove(6);
},
},
]
Expand All @@ -116,14 +124,14 @@ function Confirmation({onNext, onMove, isEditing, ownerBeingModifiedID}: Confirm
description: translate('ownershipInfoStep.codiceFiscale'),
shouldShowRightIcon: true,
onPress: () => {
onMove(5);
onMove(6);
},
},
]
: []),
],
[
beneficialOwnerCountry,
beneficialOwnerNationality,
isDocumentNeededStatus.isCodiceFiscaleNeeded,
isDocumentNeededStatus.isCopyOfIDNeeded,
isDocumentNeededStatus.isProofOfAddressNeeded,
Expand All @@ -137,6 +145,7 @@ function Confirmation({onNext, onMove, isEditing, ownerBeingModifiedID}: Confirm
values.dob,
values.firstName,
values.lastName,
values.nationality,
values.ownershipPercentage,
values.proofOfOwnership,
values.ssnLast4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SafeString from '@src/utils/SafeString';

type DocumentsProps = SubStepProps & {ownerBeingModifiedID: string};

const {PROOF_OF_OWNERSHIP, ADDRESS_PROOF, COPY_OF_ID, CODICE_FISCALE, COUNTRY, PREFIX} = CONST.NON_USD_BANK_ACCOUNT.BENEFICIAL_OWNER_INFO_STEP.BENEFICIAL_OWNER_DATA;
const {PROOF_OF_OWNERSHIP, ADDRESS_PROOF, COPY_OF_ID, CODICE_FISCALE, NATIONALITY, PREFIX} = CONST.NON_USD_BANK_ACCOUNT.BENEFICIAL_OWNER_INFO_STEP.BENEFICIAL_OWNER_DATA;

function Documents({onNext, isEditing, ownerBeingModifiedID}: DocumentsProps) {
const {translate} = useLocalize();
Expand All @@ -36,9 +36,9 @@ function Documents({onNext, isEditing, ownerBeingModifiedID}: DocumentsProps) {
const copyOfIDInputID = `${PREFIX}_${ownerBeingModifiedID}_${COPY_OF_ID}` as const;
const addressProofInputID = `${PREFIX}_${ownerBeingModifiedID}_${ADDRESS_PROOF}` as const;
const codiceFiscaleInputID = `${PREFIX}_${ownerBeingModifiedID}_${CODICE_FISCALE}` as const;
const beneficialOwnerCountryInputID = `${PREFIX}_${ownerBeingModifiedID}_${COUNTRY}` as const;
const beneficialOwnerCountry = SafeString(reimbursementAccountDraft?.[beneficialOwnerCountryInputID]);
const isDocumentNeededStatus = getNeededDocumentsStatusForBeneficialOwner(currency, countryStepCountryValue, beneficialOwnerCountry);
const beneficialOwnerNationalityInputID = `${PREFIX}_${ownerBeingModifiedID}_${NATIONALITY}` as const;
const beneficialOwnerNationality = SafeString(reimbursementAccountDraft?.[beneficialOwnerNationalityInputID]);
const isDocumentNeededStatus = getNeededDocumentsStatusForBeneficialOwner(currency, countryStepCountryValue, beneficialOwnerNationality);
const defaultValues: Record<string, FileObject[]> = {
[proofOfOwnershipInputID]: Array.isArray(reimbursementAccountDraft?.[proofOfOwnershipInputID]) ? (reimbursementAccountDraft?.[proofOfOwnershipInputID] ?? []) : [],
[copyOfIDInputID]: Array.isArray(reimbursementAccountDraft?.[copyOfIDInputID]) ? (reimbursementAccountDraft?.[copyOfIDInputID] ?? []) : [],
Expand Down
Loading
Loading