diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/AddressBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/AddressBusiness.tsx
index bc53691eb1551..585921a391080 100644
--- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/AddressBusiness.tsx
+++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/AddressBusiness.tsx
@@ -8,7 +8,6 @@ import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ValidationUtils from '@libs/ValidationUtils';
import AddressForm from '@pages/ReimbursementAccount/AddressForm';
-import getDefaultValueForReimbursementAccountField from '@pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField';
import * as BankAccounts from '@userActions/BankAccounts';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -53,10 +52,10 @@ function AddressBusiness({reimbursementAccount, onNext, isEditing}: AddressBusin
const styles = useThemeStyles();
const defaultValues = {
- street: getDefaultValueForReimbursementAccountField(reimbursementAccount, companyBusinessInfoKey.STREET, ''),
- city: getDefaultValueForReimbursementAccountField(reimbursementAccount, companyBusinessInfoKey.CITY, ''),
- state: getDefaultValueForReimbursementAccountField(reimbursementAccount, companyBusinessInfoKey.STATE, ''),
- zipCode: getDefaultValueForReimbursementAccountField(reimbursementAccount, companyBusinessInfoKey.ZIP_CODE, ''),
+ street: reimbursementAccount?.achData?.addressStreet ?? '',
+ city: reimbursementAccount?.achData?.addressCity ?? '',
+ state: reimbursementAccount?.achData?.addressState ?? '',
+ zipCode: reimbursementAccount?.achData?.addressZipCode ?? '',
};
const handleSubmit = (values: BankAccounts.BusinessAddress) => {
diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationDateBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationDateBusiness.tsx
index d57d4b19d292e..835952e776286 100644
--- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationDateBusiness.tsx
+++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationDateBusiness.tsx
@@ -9,7 +9,6 @@ import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ValidationUtils from '@libs/ValidationUtils';
-import getDefaultValueForReimbursementAccountField from '@pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ReimbursementAccount, ReimbursementAccountDraft} from '@src/types/onyx';
@@ -44,8 +43,7 @@ function IncorporationDateBusiness({reimbursementAccount, reimbursementAccountDr
const {translate} = useLocalize();
const styles = useThemeStyles();
- const defaultCompanyIncorporationDate =
- getDefaultValueForReimbursementAccountField(reimbursementAccount, companyIncorporationDateKey, '') || (reimbursementAccountDraft?.[companyIncorporationDateKey] ?? '');
+ const defaultCompanyIncorporationDate = reimbursementAccount?.achData?.incorporationDate ?? reimbursementAccountDraft?.incorporationDate ?? '';
return (
// @ts-expect-error TODO: Remove this once FormProvider (https://github.com/Expensify/App/issues/31972) is migrated to TypeScript
diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationStateBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationStateBusiness.tsx
index e2df151e5f3e4..c8c2305cad2ff 100644
--- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationStateBusiness.tsx
+++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/IncorporationStateBusiness.tsx
@@ -9,7 +9,6 @@ import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ValidationUtils from '@libs/ValidationUtils';
-import getDefaultValueForReimbursementAccountField from '@pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ReimbursementAccount} from '@src/types/onyx';
@@ -30,8 +29,7 @@ const validate = (values: FormValues): OnyxCommon.Errors => ValidationUtils.getF
function IncorporationStateBusiness({reimbursementAccount, onNext, isEditing}: IncorporationStateBusinessProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
-
- const defaultCompanyIncorporationState = getDefaultValueForReimbursementAccountField(reimbursementAccount, companyIncorporationStateKey, '');
+ const defaultCompanyIncorporationState = reimbursementAccount?.achData?.incorporationState ?? '';
return (
// @ts-expect-error TODO: Remove this once FormProvider (https://github.com/Expensify/App/issues/31972) is migrated to TypeScript
diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/NameBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/NameBusiness.tsx
index f35010b3c224d..f9220a1102793 100644
--- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/NameBusiness.tsx
+++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/NameBusiness.tsx
@@ -9,7 +9,6 @@ import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ValidationUtils from '@libs/ValidationUtils';
-import getDefaultValueForReimbursementAccountField from '@pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ReimbursementAccount} from '@src/types/onyx';
@@ -31,9 +30,8 @@ function NameBusiness({reimbursementAccount, onNext, isEditing}: NameBusinessPro
const {translate} = useLocalize();
const styles = useThemeStyles();
- const defaultCompanyName = getDefaultValueForReimbursementAccountField(reimbursementAccount, companyNameKey, '');
-
- const bankAccountID = getDefaultValueForReimbursementAccountField(reimbursementAccount, 'bankAccountID', 0);
+ const defaultCompanyName = reimbursementAccount?.achData?.companyName ?? '';
+ const bankAccountID = reimbursementAccount?.achData?.bankAccountID ?? 0;
const shouldDisableCompanyName = Boolean(bankAccountID && defaultCompanyName);
diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/PhoneNumberBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/PhoneNumberBusiness.tsx
index f87e0830f4b3d..e9d3036aceeaf 100644
--- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/PhoneNumberBusiness.tsx
+++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/PhoneNumberBusiness.tsx
@@ -9,7 +9,6 @@ import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ValidationUtils from '@libs/ValidationUtils';
-import getDefaultValueForReimbursementAccountField from '@pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ReimbursementAccount} from '@src/types/onyx';
@@ -38,8 +37,7 @@ const validate = (values: FormValues): OnyxCommon.Errors => {
function PhoneNumberBusiness({reimbursementAccount, onNext, isEditing}: PhoneNumberBusinessProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
-
- const defaultCompanyPhoneNumber = getDefaultValueForReimbursementAccountField(reimbursementAccount, companyPhoneNumberKey, '');
+ const defaultCompanyPhoneNumber = reimbursementAccount?.achData?.companyPhone ?? '';
return (
// @ts-expect-error TODO: Remove this once FormProvider (https://github.com/Expensify/App/issues/31972) is migrated to TypeScript
diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/TaxIdBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/TaxIdBusiness.tsx
index f2653cd268794..9933eaafa5046 100644
--- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/TaxIdBusiness.tsx
+++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/TaxIdBusiness.tsx
@@ -9,7 +9,6 @@ import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ValidationUtils from '@libs/ValidationUtils';
-import getDefaultValueForReimbursementAccountField from '@pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ReimbursementAccount} from '@src/types/onyx';
@@ -38,10 +37,8 @@ const validate = (values: FormValues): OnyxCommon.Errors => {
function TaxIdBusiness({reimbursementAccount, onNext, isEditing}: TaxIdBusinessProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
-
- const defaultCompanyTaxId = getDefaultValueForReimbursementAccountField(reimbursementAccount, companyTaxIdKey, '');
-
- const bankAccountID = getDefaultValueForReimbursementAccountField(reimbursementAccount, 'bankAccountID', 0);
+ const defaultCompanyTaxId = reimbursementAccount?.achData?.companyTaxID ?? '';
+ const bankAccountID = reimbursementAccount?.achData?.bankAccountID ?? 0;
const shouldDisableCompanyTaxID = Boolean(bankAccountID && defaultCompanyTaxId);
diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/TypeBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/TypeBusiness.tsx
index 6ae3539dbeecf..18d32e8a55095 100644
--- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/TypeBusiness.tsx
+++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/TypeBusiness.tsx
@@ -9,7 +9,6 @@ import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ValidationUtils from '@libs/ValidationUtils';
-import getDefaultValueForReimbursementAccountField from '@pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ReimbursementAccount} from '@src/types/onyx';
@@ -32,8 +31,7 @@ const validate = (values: FormValues): OnyxCommon.Errors => ValidationUtils.getF
function TypeBusiness({reimbursementAccount, onNext, isEditing}: TypeBusinessProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
-
- const defaultIncorporationType = getDefaultValueForReimbursementAccountField(reimbursementAccount, companyIncorporationTypeKey, '');
+ const defaultIncorporationType = reimbursementAccount?.achData?.incorporationType ?? '';
return (
// @ts-expect-error TODO: Remove this once FormProvider (https://github.com/Expensify/App/issues/31972) is migrated to TypeScript
diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/WebsiteBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/WebsiteBusiness.tsx
index f33d3da794762..5dd60df21f76c 100644
--- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/WebsiteBusiness.tsx
+++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/WebsiteBusiness.tsx
@@ -10,7 +10,6 @@ import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ValidationUtils from '@libs/ValidationUtils';
-import getDefaultValueForReimbursementAccountField from '@pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField';
import * as BankAccounts from '@userActions/BankAccounts';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -51,8 +50,7 @@ function WebsiteBusiness({reimbursementAccount, user, session, onNext, isEditing
() => (user?.isFromPublicDomain ? 'https://' : `https://www.${Str.extractEmailDomain(session?.email ?? '')}`),
[session?.email, user?.isFromPublicDomain],
);
-
- const defaultCompanyWebsite = getDefaultValueForReimbursementAccountField(reimbursementAccount, companyWebsiteKey, defaultWebsiteExample);
+ const defaultCompanyWebsite = reimbursementAccount?.achData?.website ?? defaultWebsiteExample;
useEffect(() => {
BankAccounts.addBusinessWebsiteForDraft(defaultCompanyWebsite);
diff --git a/src/pages/ReimbursementAccount/CompleteVerification/substeps/ConfirmAgreements.tsx b/src/pages/ReimbursementAccount/CompleteVerification/substeps/ConfirmAgreements.tsx
index 86d6288d4d1c7..f87838985be6d 100644
--- a/src/pages/ReimbursementAccount/CompleteVerification/substeps/ConfirmAgreements.tsx
+++ b/src/pages/ReimbursementAccount/CompleteVerification/substeps/ConfirmAgreements.tsx
@@ -11,7 +11,6 @@ import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ValidationUtils from '@libs/ValidationUtils';
-import getDefaultValueForReimbursementAccountField from '@pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ReimbursementAccount} from '@src/types/onyx';
@@ -53,17 +52,9 @@ function ConfirmAgreements({onNext, reimbursementAccount}: ConfirmAgreementsProp
const {translate} = useLocalize();
const styles = useThemeStyles();
const defaultValues = {
- [COMPLETE_VERIFICATION_KEYS.IS_AUTHORIZED_TO_USE_BANK_ACCOUNT]: getDefaultValueForReimbursementAccountField(
- reimbursementAccount,
- COMPLETE_VERIFICATION_KEYS.IS_AUTHORIZED_TO_USE_BANK_ACCOUNT,
- false,
- ),
- [COMPLETE_VERIFICATION_KEYS.CERTIFY_TRUE_INFORMATION]: getDefaultValueForReimbursementAccountField(reimbursementAccount, COMPLETE_VERIFICATION_KEYS.CERTIFY_TRUE_INFORMATION, false),
- [COMPLETE_VERIFICATION_KEYS.ACCEPT_TERMS_AND_CONDITIONS]: getDefaultValueForReimbursementAccountField(
- reimbursementAccount,
- COMPLETE_VERIFICATION_KEYS.ACCEPT_TERMS_AND_CONDITIONS,
- false,
- ),
+ isAuthorizedToUseBankAccount: reimbursementAccount?.achData?.isAuthorizedToUseBankAccount ?? false,
+ certifyTrueInformation: reimbursementAccount?.achData?.certifyTrueInformation ?? false,
+ acceptTermsAndConditions: reimbursementAccount?.achData?.acceptTermsAndConditions ?? false,
};
return (
@@ -87,7 +78,7 @@ function ConfirmAgreements({onNext, reimbursementAccount}: ConfirmAgreementsProp
inputID={COMPLETE_VERIFICATION_KEYS.IS_AUTHORIZED_TO_USE_BANK_ACCOUNT}
style={styles.mt4}
LabelComponent={() => {translate('completeVerificationStep.isAuthorizedToUseBankAccount')}}
- defaultValue={defaultValues[COMPLETE_VERIFICATION_KEYS.IS_AUTHORIZED_TO_USE_BANK_ACCOUNT]}
+ defaultValue={defaultValues.isAuthorizedToUseBankAccount}
shouldSaveDraft
/>
{translate('completeVerificationStep.certifyTrueAndAccurate')}}
- defaultValue={defaultValues[COMPLETE_VERIFICATION_KEYS.CERTIFY_TRUE_INFORMATION]}
+ defaultValue={defaultValues.certifyTrueInformation}
shouldSaveDraft
/>
{`${translate('completeVerificationStep.termsAndConditions')}`}
)}
- defaultValue={defaultValues[COMPLETE_VERIFICATION_KEYS.ACCEPT_TERMS_AND_CONDITIONS]}
+ defaultValue={defaultValues.acceptTermsAndConditions}
shouldSaveDraft
/>
diff --git a/src/pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField.js b/src/pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField.js
deleted file mode 100644
index 9806ff2f38a77..0000000000000
--- a/src/pages/ReimbursementAccount/utils/getDefaultValueForReimbursementAccountField.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import lodashGet from 'lodash/get';
-
-/**
- * @param {Object | null} reimbursementAccount
- * @param {String} fieldName
- * @param {* | undefined} defaultValue
- * @returns {String}
- */
-function getDefaultValueForReimbursementAccountField(reimbursementAccount, fieldName, defaultValue = '') {
- return lodashGet(reimbursementAccount, ['achData', fieldName], defaultValue);
-}
-
-export default getDefaultValueForReimbursementAccountField;
diff --git a/src/pages/ReimbursementAccount/utils/getSubstepValues.ts b/src/pages/ReimbursementAccount/utils/getSubstepValues.ts
index 39867b93d3bad..14c3ee0087094 100644
--- a/src/pages/ReimbursementAccount/utils/getSubstepValues.ts
+++ b/src/pages/ReimbursementAccount/utils/getSubstepValues.ts
@@ -1,6 +1,6 @@
import type {OnyxEntry} from 'react-native-onyx';
import type {ReimbursementAccount, ReimbursementAccountDraft} from '@src/types/onyx';
-import getDefaultValueForReimbursementAccountField from './getDefaultValueForReimbursementAccountField';
+import type {ACHData} from '@src/types/onyx/ReimbursementAccount';
function getSubstepValues(
inputKeys: Record,
@@ -10,7 +10,7 @@ function getSubstepValues(
return Object.entries(inputKeys).reduce(
(acc, [, value]) => ({
...acc,
- [value]: reimbursementAccountDraft?.[value] ?? getDefaultValueForReimbursementAccountField(reimbursementAccount, value, ''),
+ [value]: reimbursementAccountDraft?.[value] ?? reimbursementAccount?.achData?.[value as keyof ACHData] ?? '',
}),
{} as {[K in T]: ReimbursementAccountDraft[K]},
);
diff --git a/src/types/onyx/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts
index dff0b201457c8..85a39914058de 100644
--- a/src/types/onyx/ReimbursementAccount.ts
+++ b/src/types/onyx/ReimbursementAccount.ts
@@ -2,7 +2,7 @@ import type {ValueOf} from 'type-fest';
import type CONST from '@src/CONST';
import type {BankName} from './Bank';
import type * as OnyxCommon from './OnyxCommon';
-import type {BeneficialOwnersStepDraftProps, CompanyStepProps, RequestorStepProps} from './ReimbursementAccountDraft';
+import type {ACHContractStepProps, BeneficialOwnersStepDraftProps, CompanyStepProps, RequestorStepProps} from './ReimbursementAccountDraft';
type BankAccountStep = ValueOf;
@@ -34,7 +34,8 @@ type ACHData = {
addressName?: string;
} & BeneficialOwnersStepDraftProps &
CompanyStepProps &
- RequestorStepProps;
+ RequestorStepProps &
+ ACHContractStepProps;
type ReimbursementAccount = {
/** Whether we are loading the data via the API */
@@ -68,4 +69,4 @@ type ReimbursementAccount = {
};
export default ReimbursementAccount;
-export type {BankAccountStep, BankAccountSubStep};
+export type {BankAccountStep, BankAccountSubStep, ACHData};