Skip to content

Commit 3fb4b65

Browse files
authored
Merge pull request Expensify#87141 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 24d1833 + 3f64b76 commit 3fb4b65

37 files changed

Lines changed: 1279 additions & 55 deletions

src/CONST/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,6 +3103,14 @@ const CONST = {
31033103
VENDOR_BILL: 'VENDOR_BILL',
31043104
},
31053105

3106+
UPDATE_PERSONAL_BANK_ACCOUNT: {
3107+
PAGE_NAME: {
3108+
LEGAL_NAME: 'legal-name',
3109+
ADDRESS: 'address',
3110+
PHONE_NUMBER: 'phone-number',
3111+
},
3112+
},
3113+
31063114
MISSING_PERSONAL_DETAILS: {
31073115
STEP_INDEX_LIST: ['1', '2', '3', '4'],
31083116
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
@@ -754,6 +754,15 @@ const ROUTES = {
754754
},
755755
SETTINGS_ADD_US_BANK_ACCOUNT: 'settings/wallet/add-us-bank-account',
756756
SETTINGS_ADD_US_BANK_ACCOUNT_ENTRY_POINT: 'settings/wallet/add-us-bank-account/entry-point',
757+
SETTINGS_UPDATE_PERSONAL_BANK_ACCOUNT: {
758+
route: 'settings/wallet/update-personal-bank-account/:subPage?',
759+
getRoute: (subPage?: string) => {
760+
if (!subPage) {
761+
return 'settings/wallet/update-personal-bank-account' as const;
762+
}
763+
return `settings/wallet/update-personal-bank-account/${subPage}` as const;
764+
},
765+
},
757766
SETTINGS_ADD_BANK_ACCOUNT_SELECT_COUNTRY_VERIFY_ACCOUNT: `settings/wallet/add-bank-account/select-country/${VERIFY_ACCOUNT}`,
758767
SETTINGS_BANK_ACCOUNT_PURPOSE: 'settings/wallet/bank-account-purpose',
759768
SETTINGS_ENABLE_PAYMENTS: 'settings/wallet/enable-payments',

src/SCREENS.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ const SCREENS = {
123123
ADD_BANK_ACCOUNT: 'Settings_Add_Bank_Account',
124124
ADD_US_BANK_ACCOUNT: 'Settings_Add_US_Bank_Account',
125125
ADD_US_BANK_ACCOUNT_ENTRY_POINT: 'Settings_Add_US_Bank_Account_Entry_Point',
126+
UPDATE_PERSONAL_BANK_ACCOUNT: 'Settings_Update_Personal_Bank_Account',
126127
ADD_BANK_ACCOUNT_SELECT_COUNTRY_VERIFY_ACCOUNT: 'Settings_Add_Bank_Account_Select_Country_Verify_Account',
127128
BANK_ACCOUNT_PURPOSE: 'Settings_Bank_Account_Purpose',
128129
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/useAccountIndicatorChecks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {hasPaymentMethodError} from '@libs/actions/PaymentMethods';
2-
import {hasPartiallySetupBankAccount} from '@libs/BankAccountUtils';
2+
import {hasPartiallySetupBankAccount, hasPersonalBankAccountMissingInfo} from '@libs/BankAccountUtils';
33
import {hasPendingExpensifyCardAction} from '@libs/CardUtils';
44
import {hasSubscriptionGreenDotInfo, hasSubscriptionRedDotError} from '@libs/SubscriptionUtils';
55
import {hasLoginListError, hasLoginListInfo} from '@libs/UserUtils';
@@ -74,7 +74,7 @@ function useAccountIndicatorChecks(): AccountIndicatorChecksResult {
7474
amountOwed,
7575
ownerBillingGracePeriodEnd,
7676
),
77-
[CONST.INDICATOR_STATUS.HAS_PARTIALLY_SETUP_BANK_ACCOUNT_INFO]: hasPartiallySetupBankAccount(bankAccountList),
77+
[CONST.INDICATOR_STATUS.HAS_PARTIALLY_SETUP_BANK_ACCOUNT_INFO]: hasPartiallySetupBankAccount(bankAccountList) || hasPersonalBankAccountMissingInfo(bankAccountList),
7878
};
7979

8080
const [accountStatus] = Object.entries(accountChecks).find(([, value]) => value) ?? [];

src/languages/de.ts

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

src/languages/en.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3554,6 +3554,11 @@ const translations = {
35543554
confirmationStepHeader: 'Check your info.',
35553555
confirmationStepSubHeader: 'Double check the details below, and check the terms box to confirm.',
35563556
toGetStarted: 'Add a personal bank account to receive reimbursements, pay invoices, or enable the Expensify Wallet.',
3557+
updatePersonalInfo: 'Update bank account',
3558+
updatePersonalInfoFailure: 'Unable to update bank account information. Please try again later.',
3559+
updateSuccessTitle: 'Bank account updated!',
3560+
updateSuccessHeader: 'Bank account updated',
3561+
updateSuccessMessage: 'Congrats, your bank account is set up and ready to receive reimbursements.',
35573562
},
35583563
addPersonalBankAccountPage: {
35593564
enterPassword: 'Enter Expensify password',

src/languages/es.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3392,6 +3392,11 @@ ${amount} para ${merchant} - ${date}`,
33923392
confirmationStepHeader: 'Verifica tu información.',
33933393
confirmationStepSubHeader: 'Verifica dos veces los detalles a continuación y marca la casilla de términos para confirmar.',
33943394
toGetStarted: 'Agrega una cuenta bancaria personal para recibir reembolsos, pagar facturas o habilitar la Cartera de Expensify.',
3395+
updatePersonalInfo: 'Actualizar cuenta bancaria',
3396+
updatePersonalInfoFailure: 'No se pudo actualizar la información de la cuenta bancaria. Por favor, inténtalo de nuevo más tarde.',
3397+
updateSuccessTitle: '¡Cuenta bancaria actualizada!',
3398+
updateSuccessHeader: 'Cuenta bancaria actualizada',
3399+
updateSuccessMessage: 'Enhorabuena, tu cuenta bancaria está configurada y lista para recibir reembolsos.',
33953400
},
33963401
addPersonalBankAccountPage: {
33973402
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
@@ -3498,6 +3498,11 @@ ${amount} pour ${merchant} - ${date}`,
34983498
confirmationStepHeader: 'Vérifiez vos informations.',
34993499
confirmationStepSubHeader: 'Vérifiez attentivement les détails ci-dessous et cochez la case des conditions pour confirmer.',
35003500
toGetStarted: 'Ajoutez un compte bancaire personnel pour recevoir des remboursements, payer des factures ou activer le Portefeuille Expensify.',
3501+
updatePersonalInfo: 'Mettre à jour le compte bancaire',
3502+
updatePersonalInfoFailure: 'Impossible de mettre à jour les informations du compte bancaire. Veuillez réessayer plus tard.',
3503+
updateSuccessTitle: 'Compte bancaire mis à jour !',
3504+
updateSuccessHeader: 'Compte bancaire mis à jour',
3505+
updateSuccessMessage: 'Félicitations, votre compte bancaire est configuré et prêt à recevoir des remboursements.',
35013506
},
35023507
addPersonalBankAccountPage: {
35033508
enterPassword: 'Saisissez le mot de passe Expensify',

0 commit comments

Comments
 (0)