Skip to content

Commit 4e02218

Browse files
authored
Merge pull request #80020 from TaduJR/feat-Update-option-missing-for-Personal-Bank-Accounts-in-ND-compared-to-Classic
feat: Update option missing for Personal Bank Accounts in ND compared to Classic
2 parents 4621b49 + 635c215 commit 4e02218

36 files changed

Lines changed: 1096 additions & 57 deletions

src/CONST/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3005,6 +3005,14 @@ const CONST = {
30053005
VENDOR_BILL: 'VENDOR_BILL',
30063006
},
30073007

3008+
UPDATE_PERSONAL_BANK_ACCOUNT: {
3009+
PAGE_NAME: {
3010+
LEGAL_NAME: 'legal-name',
3011+
ADDRESS: 'address',
3012+
PHONE_NUMBER: 'phone-number',
3013+
},
3014+
},
3015+
30083016
MISSING_PERSONAL_DETAILS: {
30093017
STEP_INDEX_LIST: ['1', '2', '3', '4'],
30103018
STEP_INDEX_LIST_WITH_PIN: ['1', '2', '3', '4', '5'],

src/ROUTES.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,15 @@ const ROUTES = {
524524
},
525525
SETTINGS_ADD_US_BANK_ACCOUNT: 'settings/wallet/add-us-bank-account',
526526
SETTINGS_ADD_US_BANK_ACCOUNT_ENTRY_POINT: 'settings/wallet/add-us-bank-account/entry-point',
527+
SETTINGS_UPDATE_PERSONAL_BANK_ACCOUNT: {
528+
route: 'settings/wallet/update-personal-bank-account/:subPage?',
529+
getRoute: (subPage?: string) => {
530+
if (!subPage) {
531+
return 'settings/wallet/update-personal-bank-account' as const;
532+
}
533+
return `settings/wallet/update-personal-bank-account/${subPage}` as const;
534+
},
535+
},
527536
SETTINGS_ADD_BANK_ACCOUNT_SELECT_COUNTRY_VERIFY_ACCOUNT: `settings/wallet/add-bank-account/select-country/${VERIFY_ACCOUNT}`,
528537
SETTINGS_BANK_ACCOUNT_PURPOSE: 'settings/wallet/bank-account-purpose',
529538
SETTINGS_ENABLE_PAYMENTS: 'settings/wallet/enable-payments',

src/SCREENS.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ const SCREENS = {
122122
ADD_BANK_ACCOUNT: 'Settings_Add_Bank_Account',
123123
ADD_US_BANK_ACCOUNT: 'Settings_Add_US_Bank_Account',
124124
ADD_US_BANK_ACCOUNT_ENTRY_POINT: 'Settings_Add_US_Bank_Account_Entry_Point',
125+
UPDATE_PERSONAL_BANK_ACCOUNT: 'Settings_Update_Personal_Bank_Account',
125126
ADD_BANK_ACCOUNT_SELECT_COUNTRY_VERIFY_ACCOUNT: 'Settings_Add_Bank_Account_Select_Country_Verify_Account',
126127
BANK_ACCOUNT_PURPOSE: 'Settings_Bank_Account_Purpose',
127128
CLOSE: 'Settings_Close',

src/components/AddressForm.tsx

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ type AddressFormProps = {
5555

5656
/** A unique Onyx key identifying the form */
5757
formID: typeof ONYXKEYS.FORMS.HOME_ADDRESS_FORM;
58+
59+
/** Whether to hide the country selector (e.g. when country cannot be changed) */
60+
shouldHideCountrySelector?: boolean;
61+
62+
/** Whether the form submit button should be enabled when offline */
63+
enabledWhenOffline?: boolean;
5864
};
5965

6066
function AddressForm({
@@ -69,6 +75,8 @@ function AddressForm({
6975
street2 = '',
7076
submitButtonText = '',
7177
zip = '',
78+
shouldHideCountrySelector = false,
79+
enabledWhenOffline: enabledWhenOfflineProp = true,
7280
}: AddressFormProps) {
7381
const styles = useThemeStyles();
7482
const {translate} = useLocalize();
@@ -87,11 +95,14 @@ function AddressForm({
8795
*/
8896

8997
const validator = useCallback(
90-
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.HOME_ADDRESS_FORM>): Errors => {
98+
(rawValues: FormOnyxValues<typeof ONYXKEYS.FORMS.HOME_ADDRESS_FORM>): Errors => {
99+
// When hidden, the country input is unregistered so fall back to the country prop.
100+
const values = shouldHideCountrySelector ? {...rawValues, country: rawValues.country || country} : rawValues;
101+
91102
const errors: Errors & {
92103
zipPostCode?: string | string[];
93104
} = {};
94-
const requiredFields = ['addressLine1', 'city', 'country', 'state'] as const;
105+
const requiredFields = shouldHideCountrySelector ? (['addressLine1', 'city', 'state'] as const) : (['addressLine1', 'city', 'country', 'state'] as const);
95106

96107
// Check "State" dropdown is a valid state if selected Country is USA
97108
if (values.country === CONST.COUNTRY.US && !values.state) {
@@ -145,7 +156,7 @@ function AddressForm({
145156

146157
return errors;
147158
},
148-
[translate],
159+
[translate, shouldHideCountrySelector, country],
149160
);
150161

151162
return (
@@ -155,7 +166,7 @@ function AddressForm({
155166
validate={validator}
156167
onSubmit={onSubmit}
157168
submitButtonText={submitButtonText}
158-
enabledWhenOffline
169+
enabledWhenOffline={enabledWhenOfflineProp}
159170
addBottomSafeAreaPadding
160171
>
161172
<View>
@@ -192,16 +203,20 @@ function AddressForm({
192203
autoComplete="address-line2"
193204
/>
194205
<View style={styles.formSpaceVertical} />
195-
<View style={styles.mhn5}>
196-
<InputWrapper
197-
InputComponent={CountrySelector}
198-
inputID={INPUT_IDS.COUNTRY}
199-
value={country}
200-
onValueChange={onAddressChanged}
201-
shouldSaveDraft={shouldSaveDraft}
202-
/>
203-
</View>
204-
<View style={styles.formSpaceVertical} />
206+
{!shouldHideCountrySelector && (
207+
<>
208+
<View style={styles.mhn5}>
209+
<InputWrapper
210+
InputComponent={CountrySelector}
211+
inputID={INPUT_IDS.COUNTRY}
212+
value={country}
213+
onValueChange={onAddressChanged}
214+
shouldSaveDraft={shouldSaveDraft}
215+
/>
216+
</View>
217+
<View style={styles.formSpaceVertical} />
218+
</>
219+
)}
205220
{isUSAForm ? (
206221
<View style={styles.mhn5}>
207222
<InputWrapper

src/components/SubStepForms/FullNameStep.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ type FullNameStepProps<TFormID extends keyof OnyxFormValuesMapping> = SubStepPro
5555

5656
/** Whether to show the Patriot Act help link (EnablePayments-only) */
5757
shouldShowPatriotActLink?: boolean;
58+
59+
/** Whether the form submit button should be enabled when offline */
60+
enabledWhenOffline?: boolean;
5861
};
5962

6063
function FullNameStep<TFormID extends keyof OnyxFormValuesMapping>({
@@ -72,6 +75,7 @@ function FullNameStep<TFormID extends keyof OnyxFormValuesMapping>({
7275
customLastNameLabel,
7376
shouldShowPatriotActLink = false,
7477
forwardedFSClass,
78+
enabledWhenOffline: enabledWhenOfflineProp = true,
7579
}: FullNameStepProps<TFormID>) {
7680
const {translate} = useLocalize();
7781
const styles = useThemeStyles();
@@ -125,7 +129,7 @@ function FullNameStep<TFormID extends keyof OnyxFormValuesMapping>({
125129
validate={customValidate ?? validate}
126130
onSubmit={onSubmit}
127131
style={[styles.mh5, styles.flexGrow1]}
128-
enabledWhenOffline
132+
enabledWhenOffline={enabledWhenOfflineProp}
129133
>
130134
<View>
131135
<Text style={[styles.textHeadlineLineHeightXXL, styles.mb6]}>{formTitle}</Text>

src/hooks/useNavigationTabBarIndicatorChecks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type {ValueOf} from 'type-fest';
22
import {isConnectionInProgress} from '@libs/actions/connections';
33
import {shouldShowQBOReimbursableExportDestinationAccountError} from '@libs/actions/connections/QuickbooksOnline';
44
import {hasPaymentMethodError} from '@libs/actions/PaymentMethods';
5-
import {hasPartiallySetupBankAccount} from '@libs/BankAccountUtils';
5+
import {hasPartiallySetupBankAccount, hasPersonalBankAccountMissingInfo} from '@libs/BankAccountUtils';
66
import {hasPendingExpensifyCardAction} from '@libs/CardUtils';
77
import {hasDomainErrors} from '@libs/DomainUtils';
88
import {getUberConnectionErrorDirectlyFromPolicy, shouldShowCustomUnitsError, shouldShowEmployeeListError, shouldShowPolicyError, shouldShowSyncError} from '@libs/PolicyUtils';
@@ -105,7 +105,7 @@ function useNavigationTabBarIndicatorChecks(): NavigationTabBarChecksResult {
105105
amountOwed,
106106
ownerBillingGraceEndPeriod,
107107
),
108-
[CONST.INDICATOR_STATUS.HAS_PARTIALLY_SETUP_BANK_ACCOUNT_INFO]: hasPartiallySetupBankAccount(bankAccountList),
108+
[CONST.INDICATOR_STATUS.HAS_PARTIALLY_SETUP_BANK_ACCOUNT_INFO]: hasPartiallySetupBankAccount(bankAccountList) || hasPersonalBankAccountMissingInfo(bankAccountList),
109109
};
110110

111111
const domainChecks: Partial<Record<IndicatorStatus, boolean>> = {

src/languages/de.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3361,6 +3361,11 @@ ${amount} für ${merchant} – ${date}`,
33613361
confirmationStepHeader: 'Überprüfe deine Angaben.',
33623362
confirmationStepSubHeader: 'Prüfen Sie die untenstehenden Angaben sorgfältig und aktivieren Sie das Kontrollkästchen für die Bedingungen, um zu bestätigen.',
33633363
toGetStarted: 'Fügen Sie ein persönliches Bankkonto hinzu, um Erstattungen zu erhalten, Rechnungen zu bezahlen oder die Expensify Wallet zu aktivieren.',
3364+
updatePersonalInfo: 'Bankkonto aktualisieren',
3365+
updatePersonalInfoFailure: 'Die Bankkontoinformationen konnten nicht aktualisiert werden. Bitte versuchen Sie es später erneut.',
3366+
updateSuccessTitle: 'Bankkonto aktualisiert!',
3367+
updateSuccessHeader: 'Bankkonto aktualisiert',
3368+
updateSuccessMessage: 'Glückwunsch, dein Bankkonto ist eingerichtet und bereit, Rückerstattungen zu empfangen.',
33643369
},
33653370
addPersonalBankAccountPage: {
33663371
enterPassword: 'Expensify-Passwort eingeben',

src/languages/en.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3425,6 +3425,11 @@ const translations = {
34253425
confirmationStepHeader: 'Check your info.',
34263426
confirmationStepSubHeader: 'Double check the details below, and check the terms box to confirm.',
34273427
toGetStarted: 'Add a personal bank account to receive reimbursements, pay invoices, or enable the Expensify Wallet.',
3428+
updatePersonalInfo: 'Update bank account',
3429+
updatePersonalInfoFailure: 'Unable to update bank account information. Please try again later.',
3430+
updateSuccessTitle: 'Bank account updated!',
3431+
updateSuccessHeader: 'Bank account updated',
3432+
updateSuccessMessage: 'Congrats, your bank account is set up and ready to receive reimbursements.',
34283433
},
34293434
addPersonalBankAccountPage: {
34303435
enterPassword: 'Enter Expensify password',

src/languages/es.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3292,6 +3292,11 @@ ${amount} para ${merchant} - ${date}`,
32923292
confirmationStepHeader: 'Verifica tu información.',
32933293
confirmationStepSubHeader: 'Verifica dos veces los detalles a continuación y marca la casilla de términos para confirmar.',
32943294
toGetStarted: 'Agrega una cuenta bancaria personal para recibir reembolsos, pagar facturas o habilitar la Cartera de Expensify.',
3295+
updatePersonalInfo: 'Actualizar cuenta bancaria',
3296+
updatePersonalInfoFailure: 'No se pudo actualizar la información de la cuenta bancaria. Por favor, inténtalo de nuevo más tarde.',
3297+
updateSuccessTitle: '¡Cuenta bancaria actualizada!',
3298+
updateSuccessHeader: 'Cuenta bancaria actualizada',
3299+
updateSuccessMessage: 'Enhorabuena, tu cuenta bancaria está configurada y lista para recibir reembolsos.',
32953300
},
32963301
addPersonalBankAccountPage: {
32973302
enterPassword: 'Escribe tu contraseña de Expensify',

src/languages/fr.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3371,6 +3371,11 @@ ${amount} pour ${merchant} - ${date}`,
33713371
confirmationStepHeader: 'Vérifiez vos informations.',
33723372
confirmationStepSubHeader: 'Vérifiez attentivement les détails ci-dessous et cochez la case des conditions pour confirmer.',
33733373
toGetStarted: 'Ajoutez un compte bancaire personnel pour recevoir des remboursements, payer des factures ou activer le Portefeuille Expensify.',
3374+
updatePersonalInfo: 'Mettre à jour le compte bancaire',
3375+
updatePersonalInfoFailure: 'Impossible de mettre à jour les informations du compte bancaire. Veuillez réessayer plus tard.',
3376+
updateSuccessTitle: 'Compte bancaire mis à jour !',
3377+
updateSuccessHeader: 'Compte bancaire mis à jour',
3378+
updateSuccessMessage: 'Félicitations, votre compte bancaire est configuré et prêt à recevoir des remboursements.',
33743379
},
33753380
addPersonalBankAccountPage: {
33763381
enterPassword: 'Saisissez le mot de passe Expensify',

0 commit comments

Comments
 (0)