Skip to content

Commit 82153a6

Browse files
neil-marcelliniOSBotify
authored andcommitted
Merge pull request #54585 from Expensify/revert-52082-fix/51491-wallet-page
Revert "fix wallet phone validation page" (cherry picked from commit d649ce2) (CP triggered by jasperhuangg)
1 parent 8f04fbf commit 82153a6

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

src/libs/GetPhysicalCardUtils.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {Str} from 'expensify-common';
21
import type {OnyxEntry} from 'react-native-onyx';
32
import ROUTES from '@src/ROUTES';
43
import type {Route} from '@src/ROUTES';
@@ -7,19 +6,16 @@ import type {LoginList, PrivatePersonalDetails} from '@src/types/onyx';
76
import * as LoginUtils from './LoginUtils';
87
import Navigation from './Navigation/Navigation';
98
import * as PersonalDetailsUtils from './PersonalDetailsUtils';
10-
import * as PhoneNumberUtils from './PhoneNumber';
119
import * as UserUtils from './UserUtils';
1210

1311
function getCurrentRoute(domain: string, privatePersonalDetails: OnyxEntry<PrivatePersonalDetails>): Route {
1412
const {legalFirstName, legalLastName, phoneNumber} = privatePersonalDetails ?? {};
1513
const address = PersonalDetailsUtils.getCurrentAddress(privatePersonalDetails);
16-
const phoneNumberWithCountryCode = LoginUtils.appendCountryCode(phoneNumber ?? '');
17-
const parsedPhoneNumber = PhoneNumberUtils.parsePhoneNumber(phoneNumberWithCountryCode);
1814

1915
if (!legalFirstName && !legalLastName) {
2016
return ROUTES.SETTINGS_WALLET_CARD_GET_PHYSICAL_NAME.getRoute(domain);
2117
}
22-
if (!phoneNumber || !parsedPhoneNumber.possible || !Str.isValidE164Phone(phoneNumberWithCountryCode.slice(0))) {
18+
if (!phoneNumber || !LoginUtils.validateNumber(phoneNumber)) {
2319
return ROUTES.SETTINGS_WALLET_CARD_GET_PHYSICAL_PHONE.getRoute(domain);
2420
}
2521
if (!(address?.street && address?.city && address?.state && address?.country && address?.zip)) {

src/pages/settings/Wallet/Card/GetPhysicalCardPhone.tsx

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {Str} from 'expensify-common';
21
import React from 'react';
32
import {View} from 'react-native';
43
import {useOnyx} from 'react-native-onyx';
@@ -9,8 +8,6 @@ import useLocalize from '@hooks/useLocalize';
98
import useThemeStyles from '@hooks/useThemeStyles';
109
import * as LoginUtils from '@libs/LoginUtils';
1110
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
12-
import * as PhoneNumberUtils from '@libs/PhoneNumber';
13-
import * as ValidationUtils from '@libs/ValidationUtils';
1411
import type {SettingsNavigatorParamList} from '@navigation/types';
1512
import CONST from '@src/CONST';
1613
import ONYXKEYS from '@src/ONYXKEYS';
@@ -43,17 +40,12 @@ function GetPhysicalCardPhone({
4340

4441
const errors: OnValidateResult = {};
4542

46-
if (!ValidationUtils.isRequiredFulfilled(phoneNumberToValidate)) {
43+
if (!LoginUtils.validateNumber(phoneNumberToValidate)) {
44+
errors.phoneNumber = translate('common.error.phoneNumber');
45+
} else if (!phoneNumberToValidate) {
4746
errors.phoneNumber = translate('common.error.fieldRequired');
4847
}
4948

50-
const phoneNumberWithCountryCode = LoginUtils.appendCountryCode(phoneNumberToValidate);
51-
const parsedPhoneNumber = PhoneNumberUtils.parsePhoneNumber(phoneNumberWithCountryCode);
52-
53-
if (!parsedPhoneNumber.possible || !Str.isValidE164Phone(phoneNumberWithCountryCode.slice(0))) {
54-
errors.phoneNumber = translate('bankAccount.error.phoneNumber');
55-
}
56-
5749
return errors;
5850
};
5951

0 commit comments

Comments
 (0)