diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 325bab091bec..451979b92efa 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -1,5 +1,5 @@ import type {RefObject} from 'react'; -import React from 'react'; +import React, {useEffect} from 'react'; import type {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; @@ -70,6 +70,21 @@ function AddPaymentMethodMenu({ const canUsePersonalBankAccount = shouldShowPersonalBankAccountOption || isIOUReport; + const isPersonalOnlyOption = canUsePersonalBankAccount && !canUseBusinessBankAccount; + + // We temporarily disabled P2P debit cards so we will automatically select the personal bank account option if there is no other option to select. + useEffect(() => { + if (!isVisible) { + return; + } + + onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); + }, [isPersonalOnlyOption, isVisible, onItemSelected]); + + if (isPersonalOnlyOption) { + return null; + } + return ( onItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD), - }, - ], + // Adding a debit card for P2P payments is temporarily disabled + // ...[ + // { + // text: translate('common.debitCard'), + // icon: Expensicons.CreditCard, + // onSelected: () => onItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD), + // }, + // ], ]} withoutOverlay /> diff --git a/src/pages/settings/Wallet/AddDebitCardPage.tsx b/src/pages/settings/Wallet/AddDebitCardPage.tsx index 31f8957dcea1..d785df0ea324 100644 --- a/src/pages/settings/Wallet/AddDebitCardPage.tsx +++ b/src/pages/settings/Wallet/AddDebitCardPage.tsx @@ -7,10 +7,14 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import usePrevious from '@hooks/usePrevious'; import Navigation from '@libs/Navigation/Navigation'; +import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import * as PaymentMethods from '@userActions/PaymentMethods'; import ONYXKEYS from '@src/ONYXKEYS'; function DebitCardPage() { + // Temporarily disabled + return ; + const {translate} = useLocalize(); const [formData] = useOnyx(ONYXKEYS.FORMS.ADD_PAYMENT_CARD_FORM); const prevFormDataSetupComplete = usePrevious(!!formData?.setupComplete); diff --git a/src/pages/settings/Wallet/PaymentMethodList.tsx b/src/pages/settings/Wallet/PaymentMethodList.tsx index a1fc79110235..8ca7d8dc5213 100644 --- a/src/pages/settings/Wallet/PaymentMethodList.tsx +++ b/src/pages/settings/Wallet/PaymentMethodList.tsx @@ -29,7 +29,7 @@ import * as PaymentMethods from '@userActions/PaymentMethods'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import type {AccountData, BankAccountList, CardList, FundList} from '@src/types/onyx'; +import type {AccountData, BankAccountList, CardList} from '@src/types/onyx'; import type {BankIcon} from '@src/types/onyx/Bank'; import type {Errors} from '@src/types/onyx/OnyxCommon'; import type PaymentMethod from '@src/types/onyx/PaymentMethod'; @@ -45,7 +45,7 @@ type PaymentMethodListOnyxProps = { cardList: OnyxEntry; /** List of user's cards */ - fundList: OnyxEntry; + // fundList: OnyxEntry; /** Are we loading payment methods? */ isLoadingPaymentMethods: OnyxEntry; @@ -175,7 +175,8 @@ function PaymentMethodList({ bankAccountList = {}, buttonRef = () => {}, cardList = {}, - fundList = {}, + // Temporarily disabled because P2P debit cards are disabled. + // fundList = {}, filterType = '', listHeaderComponent, isLoadingPaymentMethods = true, @@ -260,10 +261,11 @@ function PaymentMethodList({ return assignedCardsGrouped; } - const paymentCardList = fundList ?? {}; - // Hide any billing cards that are not P2P debit cards for now because you cannot make them your default method, or delete them - const filteredCardList = Object.values(paymentCardList).filter((card) => !!card.accountData?.additionalData?.isP2PDebitCard); + // All payment cards are temporarily disabled for use as a payment method + // const paymentCardList = fundList ?? {}; + // const filteredCardList = Object.values(paymentCardList).filter((card) => !!card.accountData?.additionalData?.isP2PDebitCard); + const filteredCardList = {}; let combinedPaymentMethods = PaymentUtils.formatPaymentMethods(bankAccountList ?? {}, filteredCardList, styles); if (filterType !== '') { @@ -302,20 +304,7 @@ function PaymentMethodList({ }; }); return combinedPaymentMethods; - }, [ - shouldShowAssignedCards, - fundList, - bankAccountList, - styles, - filterType, - isOffline, - cardList, - actionPaymentMethodType, - activePaymentMethodID, - StyleUtils, - shouldShowRightIcon, - onPress, - ]); + }, [shouldShowAssignedCards, bankAccountList, styles, filterType, isOffline, cardList, actionPaymentMethodType, activePaymentMethodID, StyleUtils, shouldShowRightIcon, onPress]); /** * Render placeholder when there are no payments methods @@ -423,9 +412,10 @@ export default withOnyx({ cardList: { key: ONYXKEYS.CARD_LIST, }, - fundList: { - key: ONYXKEYS.FUND_LIST, - }, + // Temporarily disabled - used for P2P debit cards + // fundList: { + // key: ONYXKEYS.FUND_LIST, + // }, isLoadingPaymentMethods: { key: ONYXKEYS.IS_LOADING_PAYMENT_METHODS, },