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

Deprecate paypal #27308

Merged
merged 10 commits into from
Sep 19, 2023
Merged
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
29 changes: 0 additions & 29 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,6 @@ const CONST = {
},

PAYMENT_METHODS: {
PAYPAL: 'payPalMe',
DEBIT_CARD: 'debitCard',
BANK_ACCOUNT: 'bankAccount',
},
Expand All @@ -1042,7 +1041,6 @@ const CONST = {
PAYMENT_TYPE: {
ELSEWHERE: 'Elsewhere',
EXPENSIFY: 'Expensify',
PAYPAL_ME: 'PayPal.me',
VBBA: 'ACH',
},
MONEY_REQUEST_TYPE: {
Expand Down Expand Up @@ -1201,7 +1199,6 @@ const CONST = {
CARD_NUMBER: /^[0-9]{15,16}$/,
CARD_SECURITY_CODE: /^[0-9]{3,4}$/,
CARD_EXPIRATION_DATE: /^(0[1-9]|1[0-2])([^0-9])?([0-9]{4}|([0-9]{2}))$/,
PAYPAL_ME_USERNAME: /^[a-zA-Z0-9]{1,20}$/,
ROOM_NAME: /^#[a-z0-9à-ÿ-]{1,80}$/,

// eslint-disable-next-line max-len, no-misleading-character-class
Expand Down Expand Up @@ -2532,32 +2529,6 @@ const CONST = {
SEARCH_ISSUES: 'https://github.com/Expensify/App/issues',
},

PAYPAL_SUPPORTED_CURRENCIES: [
'AUD',
'BRL',
'CAD',
'CZK',
'DKK',
'EUR',
'HKD',
'HUF',
'ILS',
'JPY',
'MYR',
'MXN',
'TWD',
'NZD',
'NOK',
'PHP',
'PLN',
'GBP',
'RUB',
'SGD',
'SEK',
'CHF',
'THB',
'USD',
],
CONCIERGE_TRAVEL_URL: 'https://community.expensify.com/discussion/7066/introducing-concierge-travel',
SCREEN_READER_STATES: {
ALL: 'all',
Expand Down
6 changes: 0 additions & 6 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ const ONYXKEYS = {
SHOW_DOWNLOAD_APP_BANNER: 'showDownloadAppBanner',

/** NVP keys
* Contains the user's payPalMe data */
PAYPAL: 'paypal',

/** Contains the user preference for the LHN priority mode */
NVP_PRIORITY_MODE: 'nvp_priorityMode',

Expand Down Expand Up @@ -284,7 +281,6 @@ const ONYXKEYS = {
MONEY_REQUEST_AMOUNT_FORM: 'moneyRequestAmountForm',
MONEY_REQUEST_DATE_FORM: 'moneyRequestCreatedForm',
NEW_CONTACT_METHOD_FORM: 'newContactMethodForm',
PAYPAL_FORM: 'payPalForm',
WAYPOINT_FORM: 'waypointForm',
WAYPOINT_FORM_DRAFT: 'waypointFormDraft',
SETTINGS_STATUS_SET_FORM: 'settingsStatusSetForm',
Expand Down Expand Up @@ -328,7 +324,6 @@ type OnyxValues = {
[ONYXKEYS.LOGIN_LIST]: OnyxTypes.Login;
[ONYXKEYS.SESSION]: OnyxTypes.Session;
[ONYXKEYS.BETAS]: OnyxTypes.Beta[];
[ONYXKEYS.PAYPAL]: OnyxTypes.Paypal;
[ONYXKEYS.NVP_PRIORITY_MODE]: ValueOf<typeof CONST.PRIORITY_MODE>;
[ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE]: OnyxTypes.BlockedFromConcierge;
[ONYXKEYS.NVP_PRIVATE_PUSH_NOTIFICATION_ID]: string;
Expand Down Expand Up @@ -420,7 +415,6 @@ type OnyxValues = {
[ONYXKEYS.FORMS.MONEY_REQUEST_DATE_FORM]: OnyxTypes.Form;
[ONYXKEYS.FORMS.MONEY_REQUEST_DATE_FORM]: OnyxTypes.Form;
[ONYXKEYS.FORMS.NEW_CONTACT_METHOD_FORM]: OnyxTypes.Form;
[ONYXKEYS.FORMS.PAYPAL_FORM]: OnyxTypes.Form;
[ONYXKEYS.FORMS.WAYPOINT_FORM]: OnyxTypes.Form;
[ONYXKEYS.FORMS.WAYPOINT_FORM_DRAFT]: OnyxTypes.Form;
[ONYXKEYS.FORMS.SETTINGS_STATUS_SET_FORM]: OnyxTypes.Form;
Expand Down
1 change: 0 additions & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default {
SETTINGS_ABOUT: 'settings/about',
SETTINGS_APP_DOWNLOAD_LINKS: 'settings/about/app-download-links',
SETTINGS_WALLET: 'settings/wallet',
SETTINGS_ADD_PAYPAL_ME: 'settings/wallet/add-paypal-me',
SETTINGS_ADD_DEBIT_CARD: 'settings/wallet/add-debit-card',
SETTINGS_ADD_BANK_ACCOUNT: 'settings/wallet/add-bank-account',
SETTINGS_ENABLE_PAYMENTS: 'settings/wallet/enable-payments',
Expand Down
21 changes: 0 additions & 21 deletions src/components/AddPaymentMethodMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import withWindowDimensions from './withWindowDimensions';
import Permissions from '../libs/Permissions';
import PopoverMenu from './PopoverMenu';
import refPropTypes from './refPropTypes';
import paypalMeDataPropTypes from './paypalMeDataPropTypes';

const propTypes = {
/** Should the component be visible? */
Expand All @@ -25,12 +24,6 @@ const propTypes = {
vertical: PropTypes.number,
}),

/** Account details for PayPal.Me */
payPalMeData: paypalMeDataPropTypes,

/** Should we show the Paypal option */
shouldShowPaypal: PropTypes.bool,

/** List of betas available to current user */
betas: PropTypes.arrayOf(PropTypes.string),

Expand All @@ -42,8 +35,6 @@ const propTypes = {

const defaultProps = {
anchorPosition: {},
payPalMeData: {},
shouldShowPaypal: true,
betas: [],
anchorRef: () => {},
};
Expand Down Expand Up @@ -73,15 +64,6 @@ function AddPaymentMethodMenu(props) {
},
]
: []),
...(props.shouldShowPaypal && !props.payPalMeData.description
? [
{
text: props.translate('common.payPalMe'),
icon: Expensicons.PayPal,
onSelected: () => props.onItemSelected(CONST.PAYMENT_METHODS.PAYPAL),
},
]
: []),
]}
withoutOverlay
/>
Expand All @@ -96,9 +78,6 @@ export default compose(
withWindowDimensions,
withLocalize,
withOnyx({
payPalMeData: {
key: ONYXKEYS.PAYPAL,
},
betas: {
key: ONYXKEYS.BETAS,
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/ButtonWithDropdownMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const propTypes = {
style: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),

/** Menu options to display */
/** e.g. [{text: 'Pay with Expensify', icon: Wallet}, {text: 'PayPal', icon: PayPal}] */
/** e.g. [{text: 'Pay with Expensify', icon: Wallet}] */
options: PropTypes.arrayOf(
PropTypes.shape({
value: PropTypes.string.isRequired,
Expand Down
2 changes: 0 additions & 2 deletions src/components/Icon/Expensicons.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ import NewWorkspace from '../../../assets/images/new-workspace.svg';
import Offline from '../../../assets/images/offline.svg';
import OfflineCloud from '../../../assets/images/offline-cloud.svg';
import Paperclip from '../../../assets/images/paperclip.svg';
import PayPal from '../../../assets/images/paypal.svg';
import Paycheck from '../../../assets/images/paycheck.svg';
import Pencil from '../../../assets/images/pencil.svg';
import Phone from '../../../assets/images/phone.svg';
Expand Down Expand Up @@ -216,7 +215,6 @@ export {
Offline,
OfflineCloud,
Paperclip,
PayPal,
Paycheck,
Pencil,
Phone,
Expand Down
1 change: 0 additions & 1 deletion src/components/KYCWall/BaseKYCWall.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ class KYCWall extends React.Component {
vertical: this.state.anchorPositionVertical,
horizontal: this.state.anchorPositionHorizontal,
}}
shouldShowPaypal={false}
onItemSelected={(item) => {
this.setState({shouldShowAddPaymentMenu: false});
if (item === CONST.PAYMENT_METHODS.BANK_ACCOUNT) {
Expand Down
3 changes: 0 additions & 3 deletions src/components/MoneyReportHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, report
return isManager && !isApproved && !isSettled;
}, [policyType, isManager, isApproved, isSettled]);
const bankAccountRoute = ReportUtils.getBankAccountRoute(chatReport);
const shouldShowPaypal = Boolean(lodashGet(personalDetails, [moneyRequestReport.managerID, 'payPalMeAddress']));
const formattedAmount = CurrencyUtils.convertToDisplayString(reportTotal, moneyRequestReport.currency);

return (
Expand All @@ -99,7 +98,6 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, report
<SettlementButton
currency={moneyRequestReport.currency}
policyID={moneyRequestReport.policyID}
shouldShowPaypal={shouldShowPaypal}
chatReportID={chatReport.reportID}
iouReport={moneyRequestReport}
onPress={(paymentType) => IOU.payMoneyRequest(paymentType, chatReport, moneyRequestReport)}
Expand Down Expand Up @@ -128,7 +126,6 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, report
<SettlementButton
currency={moneyRequestReport.currency}
policyID={moneyRequestReport.policyID}
shouldShowPaypal={shouldShowPaypal}
chatReportID={moneyRequestReport.chatReportID}
iouReport={moneyRequestReport}
onPress={(paymentType) => IOU.payMoneyRequest(paymentType, chatReport, moneyRequestReport)}
Expand Down
4 changes: 1 addition & 3 deletions src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,11 @@ function MoneyRequestConfirmationList(props) {

const shouldShowSettlementButton = props.iouType === CONST.IOU.MONEY_REQUEST_TYPE.SEND;
const shouldDisableButton = selectedParticipants.length === 0;
const recipient = props.selectedParticipants[0] || {};

return shouldShowSettlementButton ? (
<SettlementButton
isDisabled={shouldDisableButton}
onPress={confirm}
shouldShowPaypal={Boolean(recipient && recipient.payPalMeAddress)}
enablePaymentsRoute={ROUTES.IOU_SEND_ENABLE_PAYMENTS}
addBankAccountRoute={props.bankAccountRoute}
addDebitCardRoute={ROUTES.IOU_SEND_ADD_DEBIT_CARD}
Expand All @@ -412,7 +410,7 @@ function MoneyRequestConfirmationList(props) {
buttonSize={CONST.DROPDOWN_BUTTON_SIZE.LARGE}
/>
);
}, [confirm, props.selectedParticipants, props.bankAccountRoute, props.iouCurrencyCode, props.iouType, props.isReadOnly, props.policyID, selectedParticipants, splitOrRequestOptions]);
}, [confirm, props.bankAccountRoute, props.iouCurrencyCode, props.iouType, props.isReadOnly, props.policyID, selectedParticipants, splitOrRequestOptions]);

return (
<OptionsSelector
Expand Down
9 changes: 3 additions & 6 deletions src/components/ReportActionItem/MoneyRequestPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ function MoneyRequestPreview(props) {
const isScanning = hasReceipt && TransactionUtils.isReceiptBeingScanned(props.transaction);
const hasFieldErrors = TransactionUtils.hasMissingSmartscanFields(props.transaction);
const isDistanceRequest = TransactionUtils.isDistanceRequest(props.transaction);
const isSettled = ReportUtils.isSettled(props.iouReport);

// Show the merchant for IOUs and expenses only if they are custom or not related to scanning smartscan
const shouldShowMerchant =
Expand All @@ -173,14 +174,10 @@ function MoneyRequestPreview(props) {

const getSettledMessage = () => {
switch (lodashGet(props.action, 'originalMessage.paymentType', '')) {
case CONST.IOU.PAYMENT_TYPE.PAYPAL_ME:
return props.translate('iou.settledPaypalMe');
case CONST.IOU.PAYMENT_TYPE.ELSEWHERE:
return props.translate('iou.settledElsewhere');
case CONST.IOU.PAYMENT_TYPE.EXPENSIFY:
return props.translate('iou.settledExpensify');
default:
return '';
return props.translate('iou.settledElsewhere');
}
};

Expand Down Expand Up @@ -249,7 +246,7 @@ function MoneyRequestPreview(props) {
<View style={[styles.flexRow]}>
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
<Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20]}>{getPreviewHeaderText()}</Text>
{Boolean(getSettledMessage()) && (
{isSettled && (
<>
<Icon
src={Expensicons.DotIndicator}
Expand Down
20 changes: 1 addition & 19 deletions src/components/SettlementButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ const propTypes = {
/** Settlement currency type */
currency: PropTypes.string,

/** Should we show paypal option */
shouldShowPaypal: PropTypes.bool,

/** When the button is opened via an IOU, ID for the chatReport that the IOU is linked to */
chatReportID: PropTypes.string,

Expand Down Expand Up @@ -81,7 +78,6 @@ const defaultProps = {
addBankAccountRoute: '',
addDebitCardRoute: '',
currency: CONST.CURRENCY.USD,
shouldShowPaypal: false,
chatReportID: '',

// The "betas" array, "iouReport" and "nvp_lastPaymentMethod" objects needs to be stable to prevent the "useMemo"
Expand Down Expand Up @@ -117,7 +113,6 @@ function SettlementButton({
onPress,
policyID,
shouldShowPaymentOptions,
shouldShowPaypal,
style,
}) {
const {translate} = useLocalize();
Expand All @@ -141,11 +136,6 @@ function SettlementButton({
icon: Expensicons.Wallet,
value: CONST.IOU.PAYMENT_TYPE.VBBA,
},
[CONST.IOU.PAYMENT_TYPE.PAYPAL_ME]: {
text: translate('iou.settlePaypalMe', {formattedAmount}),
icon: Expensicons.PayPal,
value: CONST.IOU.PAYMENT_TYPE.PAYPAL_ME,
},
[CONST.IOU.PAYMENT_TYPE.ELSEWHERE]: {
text: translate('iou.payElsewhere'),
icon: Expensicons.Cash,
Expand All @@ -170,11 +160,6 @@ function SettlementButton({
}
}

// In case the last payment method has been PayPal, but this request is made in currency unsupported by Paypal, default to Elsewhere
if (paymentMethod === CONST.IOU.PAYMENT_TYPE.PAYPAL_ME && !_.includes(CONST.PAYPAL_SUPPORTED_CURRENCIES, currency)) {
paymentMethod = CONST.IOU.PAYMENT_TYPE.ELSEWHERE;
}

// In case of the settlement button in the report preview component, we do not show payment options and the label for Wallet and ACH type is simply "Pay".
return [
{
Expand All @@ -189,17 +174,14 @@ function SettlementButton({
if (isExpenseReport) {
buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.VBBA]);
}
if (shouldShowPaypal && _.includes(CONST.PAYPAL_SUPPORTED_CURRENCIES, currency)) {
buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.PAYPAL_ME]);
}
buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.ELSEWHERE]);

// Put the preferred payment method to the front of the array so its shown as default
if (paymentMethod) {
return _.sortBy(buttonOptions, (method) => (method.value === paymentMethod ? 0 : 1));
}
return buttonOptions;
}, [betas, currency, formattedAmount, iouReport, nvp_lastPaymentMethod, policyID, shouldShowPaymentOptions, shouldShowPaypal, translate]);
}, [betas, currency, formattedAmount, iouReport, nvp_lastPaymentMethod, policyID, shouldShowPaymentOptions, translate]);

const selectPaymentType = (event, iouPaymentType, triggerKYCFlow) => {
if (iouPaymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY || iouPaymentType === CONST.IOU.PAYMENT_TYPE.VBBA) {
Expand Down
2 changes: 0 additions & 2 deletions src/components/optionPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,4 @@ export default PropTypes.shape({
brickRoadIndicator: PropTypes.oneOf([CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR, '']),

phoneNumber: PropTypes.string,

payPalMeAddress: PropTypes.string,
});
15 changes: 0 additions & 15 deletions src/components/paypalMeDataPropTypes.js

This file was deleted.

Loading
Loading