Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reapply feat: Connect USD and nonUSD VBA flows #57460

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,14 @@ const CONST = {
AGREEMENTS: 'AgreementsStep',
FINISH: 'FinishStep',
},
BANK_INFO_STEP_ACH_DATA_INPUT_IDS: {
ACCOUNT_HOLDER_NAME: 'addressName',
ACCOUNT_HOLDER_REGION: 'addressState',
ACCOUNT_HOLDER_CITY: 'addressCity',
ACCOUNT_HOLDER_ADDRESS: 'addressStreet',
ACCOUNT_HOLDER_POSTAL_CODE: 'addressZipCode',
ROUTING_CODE: 'routingNumber',
},
BUSINESS_INFO_STEP: {
PICKLIST: {
ANNUAL_VOLUME_RANGE: 'AnnualVolumeRange',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import type TimeModalPicker from '@components/TimeModalPicker';
import type UploadFile from '@components/UploadFile';
import type ValuePicker from '@components/ValuePicker';
import type ConstantSelector from '@pages/Debug/ConstantSelector';
import type BusinessTypePicker from '@pages/ReimbursementAccount/BusinessInfo/substeps/TypeBusiness/BusinessTypePicker';
import type BusinessTypePicker from '@pages/ReimbursementAccount/USD/BusinessInfo/subSteps/TypeBusiness/BusinessTypePicker';
import type DimensionTypeSelector from '@pages/workspace/accounting/intacct/import/DimensionTypeSelector';
import type NetSuiteCustomFieldMappingPicker from '@pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/NetSuiteCustomFieldMappingPicker';
import type NetSuiteCustomListPicker from '@pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/NetSuiteCustomListPicker';
Expand Down
10 changes: 5 additions & 5 deletions src/components/SubStepForms/AddressStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ValidationUtils from '@libs/ValidationUtils';
import {getFieldRequiredErrors, isValidAddress, isValidZipCode, isValidZipCodeInternational} from '@libs/ValidationUtils';
import AddressFormFields from '@pages/ReimbursementAccount/AddressFormFields';
import HelpLinks from '@pages/ReimbursementAccount/PersonalInfo/HelpLinks';
import HelpLinks from '@pages/ReimbursementAccount/USD/Requestor/PersonalInfo/HelpLinks';
import type {OnyxFormValuesMapping} from '@src/ONYXKEYS';

type AddressValues = {
Expand Down Expand Up @@ -95,16 +95,16 @@ function AddressStep<TFormID extends keyof OnyxFormValuesMapping>({

const validate = useCallback(
(values: FormOnyxValues<TFormID>): FormInputErrors<TFormID> => {
const errors = ValidationUtils.getFieldRequiredErrors(values, stepFields);
const errors = getFieldRequiredErrors(values, stepFields);

const street = values[inputFieldsIDs.street as keyof typeof values];
if (street && !ValidationUtils.isValidAddress(street as FormValue)) {
if (street && !isValidAddress(street as FormValue)) {
// @ts-expect-error type mismatch to be fixed
errors[inputFieldsIDs.street] = translate('bankAccount.error.addressStreet');
}

const zipCode = values[inputFieldsIDs.zipCode as keyof typeof values];
if (zipCode && (shouldDisplayCountrySelector ? !ValidationUtils.isValidZipCodeInternational(zipCode as string) : !ValidationUtils.isValidZipCode(zipCode as string))) {
if (zipCode && (shouldDisplayCountrySelector ? !isValidZipCodeInternational(zipCode as string) : !isValidZipCode(zipCode as string))) {
// @ts-expect-error type mismatch to be fixed
errors[inputFieldsIDs.zipCode] = translate('bankAccount.error.zipCode');
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SubStepForms/FullNameStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import {getFieldRequiredErrors, isRequiredFulfilled, isValidLegalName} from '@libs/ValidationUtils';
import HelpLinks from '@pages/ReimbursementAccount/PersonalInfo/HelpLinks';
import HelpLinks from '@pages/ReimbursementAccount/USD/Requestor/PersonalInfo/HelpLinks';
import CONST from '@src/CONST';
import type {OnyxFormValuesMapping} from '@src/ONYXKEYS';

Expand Down
2 changes: 1 addition & 1 deletion src/components/SubStepForms/SingleFieldStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import TextInput from '@components/TextInput';
import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import HelpLinks from '@pages/ReimbursementAccount/PersonalInfo/HelpLinks';
import HelpLinks from '@pages/ReimbursementAccount/USD/Requestor/PersonalInfo/HelpLinks';
import CONST from '@src/CONST';
import type {OnyxFormValuesMapping} from '@src/ONYXKEYS';

Expand Down
2 changes: 1 addition & 1 deletion src/libs/API/parameters/RestartBankAccountSetupParams.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type RestartBankAccountSetupParams = {
bankAccountID: number;
ownerEmail: string;
policyID: string;
policyID: string | undefined;
};

export default RestartBankAccountSetupParams;
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Onyx.connect({
/**
* Reset user's reimbursement account. This will delete the bank account.
*/
function resetFreePlanBankAccount(bankAccountID: number | undefined, session: OnyxEntry<OnyxTypes.Session>, policyID: string) {
function resetFreePlanBankAccount(bankAccountID: number | undefined, session: OnyxEntry<OnyxTypes.Session>, policyID: string | undefined) {
if (!bankAccountID) {
throw new Error('Missing bankAccountID when attempting to reset free plan bank account');
}
Expand Down
15 changes: 0 additions & 15 deletions src/pages/ReimbursementAccount/ACHContractStep.tsx

This file was deleted.

1 change: 1 addition & 0 deletions src/pages/ReimbursementAccount/AddressFormFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ function AddressFormFields({
modalHeaderTitle={translate('countryStep.selectCountry')}
searchInputTitle={translate('countryStep.findCountry')}
value={values?.country}
defaultValue={defaultValues?.country}
onValueChange={handleCountryChange}
stateInputIDToReset={inputKeys.state ?? 'stateInput'}
/>
Expand Down
251 changes: 0 additions & 251 deletions src/pages/ReimbursementAccount/BankAccountStep.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/pages/ReimbursementAccount/CompanyStep.tsx

This file was deleted.

Loading
Loading