Skip to content

Commit 4bcced4

Browse files
committed
fix: revert some changes to substep and setup type
1 parent 6f4822c commit 4bcced4

5 files changed

Lines changed: 13 additions & 9 deletions

File tree

src/CONST/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ const CONST = {
486486
ENABLE: 'EnableStep',
487487
},
488488
STEP_NAMES: ['1', '2', '3', '4', '5', '6'],
489+
SUBSTEP: {
490+
MANUAL: 'manual',
491+
PLAID: 'plaid',
492+
},
489493
STEPS_HEADER_HEIGHT: 40,
490494
VERIFICATIONS: {
491495
ERROR_MESSAGE: 'verifications.errorMessage',

src/libs/actions/ReimbursementAccount/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {ValueOf} from 'type-fest';
33
import type CONST from '@src/CONST';
44
import ONYXKEYS from '@src/ONYXKEYS';
55
import type {ReimbursementAccountForm} from '@src/types/form';
6-
import type {BankAccountSubStep} from '@src/types/onyx/ReimbursementAccount';
6+
import type {ReimbursementAccountSubStep} from '@src/types/onyx/ReimbursementAccount';
77
import resetNonUSDBankAccount from './resetNonUSDBankAccount';
88
import resetUSDBankAccount from './resetUSDBankAccount';
99

@@ -16,7 +16,7 @@ export {setBankAccountFormValidationErrors, resetReimbursementAccount} from './e
1616
* - CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL to ask them to enter their accountNumber and routingNumber
1717
* - CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID to ask them to login to their bank via Plaid
1818
*/
19-
function setBankAccountSubStep(subStep: BankAccountSubStep | null): Promise<void | void[]> {
19+
function setBankAccountSubStep(subStep: ReimbursementAccountSubStep | null): Promise<void | void[]> {
2020
return Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {achData: {subStep}});
2121
}
2222

src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,13 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy}: Reimbursemen
255255
);
256256

257257
const continueUSDVBBASetup = useCallback(() => {
258-
const subStep = achData?.subStep !== undefined ? achData.subStep : CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL;
259-
260-
setBankAccountSubStep(subStep).then(() => {
258+
// If user comes back to the flow we never want to allow him to go through plaid again
259+
// so we're always showing manual setup with locked numbers he can not change
260+
setBankAccountSubStep(CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL).then(() => {
261261
setShouldShowContinueSetupButton(false);
262262
setUSDBankAccountStep(currentStep);
263263
});
264-
}, [achData?.subStep, currentStep]);
264+
}, [currentStep]);
265265

266266
const continueNonUSDVBBASetup = () => {
267267
const isPastSignerStep = achData?.corpay?.signerFullName && achData?.corpay?.authorizedToBindClientToAgreement === undefined;

src/pages/ReimbursementAccount/USD/BankInfo/BankInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function BankInfo({onBackButtonPress, policyID, setUSDBankAccountStep}: BankInfo
4444
const [redirectedFromPlaidToManual, setRedirectedFromPlaidToManual] = React.useState(false);
4545
const values = useMemo(() => getSubStepValues(BANK_INFO_STEP_KEYS, reimbursementAccountDraft, reimbursementAccount ?? {}), [reimbursementAccount, reimbursementAccountDraft]);
4646

47-
let setupType = reimbursementAccount?.achData?.setupType ?? reimbursementAccount?.achData?.subStep ?? '';
47+
let setupType = reimbursementAccount?.achData?.subStep ?? '';
4848

4949
const shouldReinitializePlaidLink = plaidLinkToken && receivedRedirectURI && setupType !== CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL;
5050
if (shouldReinitializePlaidLink) {

src/types/onyx/ReimbursementAccount.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type * as OnyxCommon from './OnyxCommon';
1111
type BankAccountStep = ValueOf<typeof CONST.BANK_ACCOUNT.STEP>;
1212

1313
/** Substeps to setup a reimbursement bank account */
14-
type BankAccountSubStep = ValueOf<typeof CONST.BANK_ACCOUNT.SETUP_TYPE>;
14+
type BankAccountSubStep = ValueOf<typeof CONST.BANK_ACCOUNT.SUBSTEP>;
1515

1616
/** Model of Corpay data */
1717
type Corpay = {
@@ -190,7 +190,7 @@ type ACHData = Partial<BeneficialOwnersStepProps & CompanyStepProps & RequestorS
190190
type ReimbursementAccountStep = BankAccountStep | '';
191191

192192
/** The sub step in an reimbursement account's ach data */
193-
type ReimbursementAccountSubStep = BankAccountSubStep;
193+
type ReimbursementAccountSubStep = BankAccountSubStep | '';
194194

195195
/** The ACHData for an reimbursement account */
196196
type ACHDataReimbursementAccount = Omit<ACHData, 'subStep' | 'currentStep'> & {

0 commit comments

Comments
 (0)