diff --git a/changelog/cleanup-is-upe-enabled-logic b/changelog/cleanup-is-upe-enabled-logic
new file mode 100644
index 00000000000..79bae6fa471
--- /dev/null
+++ b/changelog/cleanup-is-upe-enabled-logic
@@ -0,0 +1,4 @@
+Significance: minor
+Type: update
+
+Cleanup the deprecated payment gateway processing - part III
diff --git a/client/additional-methods-setup/index.js b/client/additional-methods-setup/index.js
index 86c9b604e33..06bb77b8f35 100644
--- a/client/additional-methods-setup/index.js
+++ b/client/additional-methods-setup/index.js
@@ -9,24 +9,13 @@
*/
import Page from 'components/page';
import UpePreviewMethodSelector from './upe-preview-methods-selector';
-import WcPayUpeContextProvider from '../settings/wcpay-upe-toggle/provider';
import WCPaySettingsContext from '../settings/wcpay-settings-context';
const AdditionalMethodsPage = () => {
- const {
- isUpeEnabled,
- upeType,
- } = window.wcpaySettings.additionalMethodsSetup;
-
return (
-
-
-
+
);
diff --git a/client/additional-methods-setup/test/index.js b/client/additional-methods-setup/test/index.js
deleted file mode 100644
index 6a2f6924427..00000000000
--- a/client/additional-methods-setup/test/index.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @format */
-
-/**
- * External dependencies
- */
-import { render, screen } from '@testing-library/react';
-import UpePreviewMethodSelector from '../upe-preview-methods-selector';
-
-/**
- * Internal dependencies
- */
-import AdditionalMethodsPage from '../';
-
-jest.mock( '../upe-preview-methods-selector', () => jest.fn() );
-
-describe( 'AdditionalMethodsPage', () => {
- beforeEach( () => {
- UpePreviewMethodSelector.mockReturnValue(
-
UPE preview method selector
- );
- } );
-
- afterEach( () => {
- jest.restoreAllMocks();
- } );
-
- describe( 'if UPE settings preview is enabled', () => {
- it( 'renders "Boost your sales by accepting new payment methods" page', () => {
- global.wcpaySettings = {
- additionalMethodsSetup: {
- isUpeEnabled: false,
- },
- };
-
- render( );
-
- expect(
- screen.queryByText( 'UPE preview method selector' )
- ).toBeInTheDocument();
- } );
- } );
-} );
diff --git a/client/additional-methods-setup/upe-preview-methods-selector/index.js b/client/additional-methods-setup/upe-preview-methods-selector/index.js
index 541865d4ebb..fcd8698b0ed 100644
--- a/client/additional-methods-setup/upe-preview-methods-selector/index.js
+++ b/client/additional-methods-setup/upe-preview-methods-selector/index.js
@@ -11,26 +11,14 @@ import Wizard from '../wizard/wrapper';
import WizardTask from '../wizard/task';
import WizardTaskList from '../wizard/task-list';
import SetupCompleteTask from './setup-complete-task';
-import useIsUpeEnabled from '../../settings/wcpay-upe-toggle/hook';
import AddPaymentMethodsTask from './add-payment-methods-task';
import './index.scss';
const UpePreviewMethodsSelector = () => {
- const [ isUpeEnabled ] = useIsUpeEnabled();
-
return (
-
+
diff --git a/client/additional-methods-setup/upe-preview-methods-selector/setup-complete-task.js b/client/additional-methods-setup/upe-preview-methods-selector/setup-complete-task.js
index f36121320b8..6a5c33b3881 100644
--- a/client/additional-methods-setup/upe-preview-methods-selector/setup-complete-task.js
+++ b/client/additional-methods-setup/upe-preview-methods-selector/setup-complete-task.js
@@ -2,7 +2,7 @@
* External dependencies
*/
import React from 'react';
-import { useEffect, useContext } from '@wordpress/element';
+import { useContext } from '@wordpress/element';
import { __, _n, sprintf } from '@wordpress/i18n';
import { Button } from '@wordpress/components';
@@ -11,7 +11,6 @@ import { Button } from '@wordpress/components';
*/
import CollapsibleBody from '../wizard/collapsible-body';
import WizardTaskItem from '../wizard/task-item';
-import WizardTaskContext from '../wizard/task/context';
import WCPaySettingsContext from '../../settings/wcpay-settings-context';
import { useEnabledPaymentMethodIds } from '../../data';
import WizardContext from '../wizard/wrapper/context';
@@ -70,19 +69,10 @@ const EnabledMethodsList = () => {
};
const SetupComplete = () => {
- const { isActive } = useContext( WizardTaskContext );
const {
featureFlags: { multiCurrency },
} = useContext( WCPaySettingsContext );
- useEffect( () => {
- if ( ! isActive ) {
- return;
- }
-
- window.wcpaySettings.additionalMethodsSetup.isUpeEnabled = true;
- }, [ isActive ] );
-
return (
( {
describe( 'SetupComplete', () => {
beforeEach( () => {
- window.wcpaySettings = {
- additionalMethodsSetup: {
- isUpeEnabled: false,
- },
- };
-
useEnabledPaymentMethodIds.mockReturnValue( [
[
'card',
@@ -41,30 +35,6 @@ describe( 'SetupComplete', () => {
] );
} );
- it( 'sets isUpeEnabled if isActive', () => {
- render(
-
-
-
- );
-
- expect(
- window.wcpaySettings.additionalMethodsSetup.isUpeEnabled
- ).toBeTruthy();
- } );
-
- it( 'does not set isUpeEnabled if not isActive', () => {
- render(
-
-
-
- );
-
- expect(
- window.wcpaySettings.additionalMethodsSetup.isUpeEnabled
- ).toBeFalsy();
- } );
-
it( 'renders setup complete messaging when context value is undefined', () => {
render(
diff --git a/client/checkout/api/index.js b/client/checkout/api/index.js
index b7deafca8af..3e2dcf1f7af 100644
--- a/client/checkout/api/index.js
+++ b/client/checkout/api/index.js
@@ -69,16 +69,10 @@ export default class WCPayAPI {
accountId,
forceNetworkSavedCards,
locale,
- isUPEEnabled,
- isUPEDeferredEnabled,
isStripeLinkEnabled,
} = this.options;
- if (
- forceNetworkSavedCards &&
- ! forceAccountRequest &&
- ! ( isUPEEnabled && ! isUPEDeferredEnabled )
- ) {
+ if ( forceNetworkSavedCards && ! forceAccountRequest ) {
if ( ! this.stripePlatform ) {
this.stripePlatform = this.createStripe(
publishableKey,
@@ -89,25 +83,17 @@ export default class WCPayAPI {
}
if ( ! this.stripe ) {
- if ( isUPEEnabled ) {
- let betas = [ 'card_country_event_beta_1' ];
- if ( isStripeLinkEnabled ) {
- betas = betas.concat( [ 'link_autofill_modal_beta_1' ] );
- }
-
- this.stripe = this.createStripe(
- publishableKey,
- locale,
- accountId,
- betas
- );
- } else {
- this.stripe = this.createStripe(
- publishableKey,
- locale,
- accountId
- );
+ let betas = [ 'card_country_event_beta_1' ];
+ if ( isStripeLinkEnabled ) {
+ betas = betas.concat( [ 'link_autofill_modal_beta_1' ] );
}
+
+ this.stripe = this.createStripe(
+ publishableKey,
+ locale,
+ accountId,
+ betas
+ );
}
return this.stripe;
}
@@ -352,14 +338,11 @@ export default class WCPayAPI {
/**
* Creates a setup intent without confirming it.
*
- * @param {string} paymentMethodType Stripe payment method type ID.
* @return {Promise} The final promise for the request to the server.
*/
- initSetupIntent( paymentMethodType = '' ) {
- let path = 'init_setup_intent';
- if ( this.options.isUPESplitEnabled && paymentMethodType ) {
- path += `_${ paymentMethodType }`;
- }
+ initSetupIntent() {
+ const path = 'init_setup_intent';
+
return this.request( buildAjaxURL( getConfig( 'wcAjaxUrl' ), path ), {
_ajax_nonce: getConfig( 'createSetupIntentNonce' ),
} ).then( ( response ) => {
@@ -414,16 +397,13 @@ export default class WCPayAPI {
* @return {Promise} The final promise for the request to the server.
*/
createIntent( options ) {
- const { fingerprint, paymentMethodType, orderId } = options;
- let path = 'create_payment_intent';
+ const { fingerprint, orderId } = options;
+ const path = 'create_payment_intent';
const params = {
_ajax_nonce: getConfig( 'createPaymentIntentNonce' ),
'wcpay-fingerprint': fingerprint,
};
- if ( this.options.isUPESplitEnabled && paymentMethodType ) {
- path += `_${ paymentMethodType }`;
- }
if ( orderId ) {
params.wcpay_order_id = orderId;
}
@@ -468,10 +448,8 @@ export default class WCPayAPI {
paymentCountry,
fingerprint
) {
- let path = 'update_payment_intent';
- if ( this.options.isUPESplitEnabled ) {
- path += `_${ selectedUPEPaymentType }`;
- }
+ const path = 'update_payment_intent';
+
return this.request( buildAjaxURL( getConfig( 'wcAjaxUrl' ), path ), {
wcpay_order_id: orderId,
wc_payment_intent_id: paymentIntentId,
diff --git a/client/checkout/blocks/index.js b/client/checkout/blocks/index.js
index 72f1c49b6b9..deed017c0d9 100644
--- a/client/checkout/blocks/index.js
+++ b/client/checkout/blocks/index.js
@@ -62,9 +62,6 @@ const api = new WCPayAPI(
accountId: getUPEConfig( 'accountId' ),
forceNetworkSavedCards: getUPEConfig( 'forceNetworkSavedCards' ),
locale: getUPEConfig( 'locale' ),
- isUPEEnabled: getUPEConfig( 'isUPEEnabled' ),
- isUPESplitEnabled: getUPEConfig( 'isUPESplitEnabled' ),
- isUPEDeferredEnabled: getUPEConfig( 'isUPEDeferredEnabled' ),
isStripeLinkEnabled,
},
request
diff --git a/client/checkout/classic/event-handlers.js b/client/checkout/classic/event-handlers.js
index dbf292944a5..00a2581b8a9 100644
--- a/client/checkout/classic/event-handlers.js
+++ b/client/checkout/classic/event-handlers.js
@@ -42,11 +42,9 @@ jQuery( function ( $ ) {
accountId: getUPEConfig( 'accountId' ),
forceNetworkSavedCards: getUPEConfig( 'forceNetworkSavedCards' ),
locale: getUPEConfig( 'locale' ),
- isUPEEnabled: getUPEConfig( 'isUPEEnabled' ),
isStripeLinkEnabled: isLinkEnabled(
getUPEConfig( 'paymentMethodsConfig' )
),
- isUPEDeferredEnabled: getUPEConfig( 'isUPEDeferredEnabled' ),
},
apiRequest
);
@@ -79,9 +77,7 @@ jQuery( function ( $ ) {
$( 'form#add_payment_method' ).length ||
$( 'form#order_review' ).length
) {
- if ( getUPEConfig( 'isUPEEnabled' ) ) {
- maybeMountStripePaymentElement();
- }
+ maybeMountStripePaymentElement();
}
$( 'form#add_payment_method' ).on( 'submit', function () {
diff --git a/client/checkout/classic/payment-processing.js b/client/checkout/classic/payment-processing.js
index 6d47f327882..2b1542792ff 100644
--- a/client/checkout/classic/payment-processing.js
+++ b/client/checkout/classic/payment-processing.js
@@ -304,7 +304,7 @@ export function renderTerms( event ) {
return;
}
const upeElement = gatewayUPEComponents[ paymentMethodType ].upeElement;
- if ( getUPEConfig( 'isUPEEnabled' ) && upeElement ) {
+ if ( upeElement ) {
upeElement.update( {
terms: getTerms( getUPEConfig( 'paymentMethodsConfig' ), value ),
} );
diff --git a/client/checkout/classic/test/payment-processing.test.js b/client/checkout/classic/test/payment-processing.test.js
index 984adb378a6..cb2b2d7b4e0 100644
--- a/client/checkout/classic/test/payment-processing.test.js
+++ b/client/checkout/classic/test/payment-processing.test.js
@@ -236,15 +236,10 @@ describe( 'Stripe Payment Element mounting', () => {
if ( argument === 'currency' ) {
return 'eur';
}
-
- if ( argument === 'isUPEEnabled' ) {
- return true;
- }
} );
getSelectedUPEGatewayPaymentMethod.mockReturnValue( 'card' );
renderTerms( event );
- expect( getUPEConfig ).toHaveBeenCalledWith( 'isUPEEnabled' );
expect( mockUpdateFunction ).toHaveBeenCalled();
} );
@@ -256,7 +251,6 @@ describe( 'Stripe Payment Element mounting', () => {
};
getSelectedUPEGatewayPaymentMethod.mockReturnValue( null );
renderTerms( event );
- expect( getUPEConfig ).not.toHaveBeenCalledWith( 'isUPEEnabled' );
expect( mockUpdateFunction ).not.toHaveBeenCalled();
} );
diff --git a/client/payment-methods/index.js b/client/payment-methods/index.js
index 816402c854f..950610e6fba 100644
--- a/client/payment-methods/index.js
+++ b/client/payment-methods/index.js
@@ -3,11 +3,10 @@
/**
* External dependencies
*/
-import React, { useContext, useState } from 'react';
+import React, { useState } from 'react';
import { __ } from '@wordpress/i18n';
import { Card, CardHeader, DropdownMenu } from '@wordpress/components';
import { moreVertical } from '@wordpress/icons';
-import classNames from 'classnames';
/**
* Internal dependencies
@@ -21,14 +20,11 @@ import {
useUnselectedPaymentMethod,
useAccountDomesticCurrency,
} from 'wcpay/data';
-
-import WcPayUpeContext from '../settings/wcpay-upe-toggle/context';
import PAYMENT_METHOD_IDS from './constants';
// Survey modal imports.
import WcPaySurveyContextProvider from '../settings/survey-modal/provider';
import SurveyModal from '../settings/survey-modal';
-import DisableUPEModal from '../settings/disable-upe-modal';
import PaymentMethodsList from 'components/payment-methods-list';
import PaymentMethod from 'components/payment-methods-list/payment-method';
import methodsConfiguration from '../payment-methods-map';
@@ -38,35 +34,19 @@ import ConfirmPaymentMethodActivationModal from './activation-modal';
import ConfirmPaymentMethodDeleteModal from './delete-modal';
import { getPaymentMethodDescription } from 'wcpay/utils/payment-methods';
import CapabilityRequestNotice from './capability-request';
-import InlineNotice from 'wcpay/components/inline-notice';
import { BuildMissingCurrenciesTooltipMessage } from 'wcpay/components/currency-information-for-methods';
const PaymentMethodsDropdownMenu = ( { setOpenModal } ) => {
- const { isUpeEnabled, upeType } = useContext( WcPayUpeContext );
- const isDisablePossible = isUpeEnabled && upeType !== 'deferred_intent';
- const label = isDisablePossible
- ? __( 'Add feedback or disable', 'woocommerce-payments' )
- : __( 'Add feedback', 'woocommerce-payments' );
-
- const buttons = [
- {
- title: __( 'Provide feedback', 'woocommerce-payments' ),
- onClick: () => setOpenModal( 'survey' ),
- },
- ];
-
- if ( isDisablePossible ) {
- buttons.push( {
- title: 'Disable',
- onClick: () => setOpenModal( 'disable' ),
- } );
- }
-
return (
setOpenModal( 'survey' ),
+ },
+ ] }
/>
);
};
@@ -170,28 +150,10 @@ const PaymentMethods = () => {
}
};
- const { isUpeEnabled, status, upeType } = useContext( WcPayUpeContext );
const [ openModalIdentifier, setOpenModalIdentifier ] = useState( '' );
- const rollbackNoticeForLegacyUPE = __(
- // eslint-disable-next-line max-len
- 'You have been switched from the new checkout to your previous checkout experience. We will keep you posted on the new checkout availability.',
- 'woocommerce-payments'
- );
- const rollbackNoticeForLegacyCard = __(
- // eslint-disable-next-line max-len
- 'You have been switched from the new checkout to your previous card experience. We will keep you posted on the new checkout availability.'
- );
return (
<>
- { openModalIdentifier === 'disable' ? (
-
- setOpenModalIdentifier( 'survey' )
- }
- />
- ) : null }
{ openModalIdentifier === 'survey' ? (
{
) : null }
-
- { isUpeEnabled && (
-
-
-
- { __(
- 'Payment methods',
- 'woocommerce-payments'
- ) }
-
-
-
-
- ) }
-
- { isUpeEnabled && upeType === 'legacy' && (
-
-
- { rollbackNoticeForLegacyUPE }
-
-
- ) }
-
- { ! isUpeEnabled && (
-
-
- { rollbackNoticeForLegacyCard }
-
-
- ) }
+
+
+
+
+ { __( 'Payment methods', 'woocommerce-payments' ) }
+
+
+
+
@@ -292,13 +221,11 @@ const PaymentMethods = () => {
}
// The card payment method is required when UPE is active, and it can't be disabled/unchecked.
required={
- PAYMENT_METHOD_IDS.CARD === id &&
- isUpeEnabled
+ PAYMENT_METHOD_IDS.CARD === id
}
locked={
PAYMENT_METHOD_IDS.CARD === id &&
- isCreditCardEnabled &&
- isUpeEnabled
+ isCreditCardEnabled
}
Icon={ Icon }
status={
diff --git a/client/payment-methods/test/index.js b/client/payment-methods/test/index.js
index 7df9aee2b9f..c5e55d47643 100644
--- a/client/payment-methods/test/index.js
+++ b/client/payment-methods/test/index.js
@@ -21,9 +21,6 @@ import {
useSelectedPaymentMethod,
useUnselectedPaymentMethod,
} from 'wcpay/data';
-import WCPaySettingsContext from '../../settings/wcpay-settings-context';
-import WcPayUpeContextProvider from '../../settings/wcpay-upe-toggle/provider';
-import WcPayUpeContext from '../../settings/wcpay-upe-toggle/context';
import { upeCapabilityStatuses } from 'wcpay/additional-methods-setup/constants';
jest.mock( '@woocommerce/components', () => {
@@ -100,11 +97,7 @@ describe( 'PaymentMethods', () => {
[ 'card', 'sepa_debit' ],
] );
- render(
-
-
-
- );
+ render( );
const cc = screen.getByRole( 'checkbox', {
name: 'Credit / Debit card',
@@ -209,11 +202,7 @@ describe( 'PaymentMethods', () => {
},
} );
- render(
-
-
-
- );
+ render( );
expect( screen.queryAllByText( /Pending /i ).length ).toEqual( 4 );
} );
@@ -235,11 +224,7 @@ describe( 'PaymentMethods', () => {
global.wcpaySettings.isBnplAffirmAfterpayEnabled = true;
- render(
-
-
-
- );
+ render( );
const affirm = screen.getByRole( 'checkbox', { name: 'Affirm' } );
const afterpay = screen.getByRole( 'checkbox', {
@@ -286,11 +271,7 @@ describe( 'PaymentMethods', () => {
} );
const renderPaymentElements = () => {
- render(
-
-
-
- );
+ render( );
};
renderPaymentElements();
@@ -306,80 +287,22 @@ describe( 'PaymentMethods', () => {
expect( afterpay ).toBeChecked();
} );
- test.each( [
- [ false, false ],
- [ false, true ],
- [ true, true ],
- ] )(
- 'express payments should not rendered when UPE preview = %s and UPE = %s',
- ( upeSettingsPreview, upe ) => {
- const featureFlagContext = {
- featureFlags: { upeSettingsPreview, upe },
- };
- const upeContext = {
- isUpeEnabled: upe,
- setIsUpeEnabled: () => null,
- status: 'resolved',
- };
-
- render(
-
-
-
-
-
- );
-
- const enableWooCommercePaymentText = screen.queryByText(
- 'Enable the new WooPayments checkout experience, which will become the default on November 1, 2023'
- );
+ test( 'renders the payment methods component and feedback button', () => {
+ render( );
- expect( enableWooCommercePaymentText ).toBeNull();
- }
- );
-
- test( 'renders the feedback elements when UPE is enabled', () => {
- render(
-
-
-
- );
- const disableUPEButton = screen.queryByRole( 'button', {
- name: 'Add feedback or disable',
+ const feedbackButton = screen.queryByRole( 'button', {
+ name: 'Add feedback',
} );
- expect( disableUPEButton ).toBeInTheDocument();
+ expect( feedbackButton ).toBeInTheDocument();
+ expect( screen.queryByText( 'Payment methods' ) ).toBeInTheDocument();
expect(
screen.queryByText( 'Payment methods' ).parentElement
).toHaveTextContent( 'Payment methods' );
} );
- test( 'Does not render the feedback elements when UPE is disabled', () => {
- render(
-
-
-
- );
-
- const disableUPEButton = screen.queryByRole( 'button', {
- name: 'Add feedback or disable',
- } );
-
- expect( disableUPEButton ).not.toBeInTheDocument();
- expect(
- screen.queryByText( 'Payment methods' )
- ).not.toBeInTheDocument();
- } );
-
it( 'should only be able to leave feedback', () => {
- render(
-
-
-
- );
+ render( );
const kebabMenuWithFeedbackOnly = screen.queryByRole( 'button', {
name: 'Add feedback',
} );
@@ -402,11 +325,7 @@ describe( 'PaymentMethods', () => {
},
} );
- render(
-
-
-
- );
+ render( );
expect(
screen.queryByRole( 'checkbox', { name: /Bancontact/ } )
@@ -448,11 +367,7 @@ describe( 'PaymentMethods', () => {
},
} );
- render(
-
-
-
- );
+ render( );
expect( screen.queryByLabelText( 'Bancontact' ) ).toBeInTheDocument();
@@ -492,11 +407,7 @@ describe( 'PaymentMethods', () => {
},
} );
- const { container } = render(
-
-
-
- );
+ const { container } = render( );
// Checkbox shouldn't be rendered.
expect(
@@ -505,7 +416,7 @@ describe( 'PaymentMethods', () => {
const svgIcon = container.querySelectorAll(
'.gridicons-notice-outline'
- )[ 1 ];
+ )[ 0 ];
expect( svgIcon ).toBeInTheDocument();
diff --git a/client/settings/disable-upe-modal/index.js b/client/settings/disable-upe-modal/index.js
deleted file mode 100644
index a28bd7e294d..00000000000
--- a/client/settings/disable-upe-modal/index.js
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
- * External dependencies
- */
-import React, { useContext, useEffect } from 'react';
-import { __, sprintf } from '@wordpress/i18n';
-import { dispatch } from '@wordpress/data';
-import { Button, ExternalLink } from '@wordpress/components';
-import interpolateComponents from '@automattic/interpolate-components';
-
-/**
- * Internal dependencies
- */
-import './style.scss';
-import ConfirmationModal from 'components/confirmation-modal';
-import useIsUpeEnabled from 'settings/wcpay-upe-toggle/hook';
-import WcPayUpeContext from 'settings/wcpay-upe-toggle/context';
-import InlineNotice from 'components/inline-notice';
-import { useEnabledPaymentMethodIds } from '../../data';
-import PaymentMethodIcon from '../payment-method-icon';
-
-const NeedHelpBarSection = () => {
- return (
-
- { interpolateComponents( {
- mixedString: __(
- 'Need help? Visit {{ docsLink /}} or {{supportLink /}}.',
- 'woocommerce-payments'
- ),
- components: {
- docsLink: (
- // eslint-disable-next-line max-len
-
- { sprintf(
- /* translators: %s: WooPayments */
- __( '%s docs', 'woocommerce-payments' ),
- 'WooPayments'
- ) }
-
- ),
- supportLink: (
- // eslint-disable-next-line max-len
-
- { __( 'contact support', 'woocommerce-payments' ) }
-
- ),
- },
- } ) }
-
- );
-};
-
-const DisableUpeModalBody = () => {
- const [ enabledPaymentMethodIds ] = useEnabledPaymentMethodIds();
- const upePaymentMethods = enabledPaymentMethodIds.filter(
- ( method ) => method !== 'card'
- );
-
- return (
- <>
-
- { __(
- // eslint-disable-next-line max-len
- 'Without the new payments experience, your customers will only be able to pay using credit card / debit card. You will not be able to add other sales-boosting payment methods anymore.',
- 'woocommerce-payments'
- ) }
-
- { upePaymentMethods.length > 0 ? (
- <>
-
- { __(
- 'Payment methods that require the new payments experience:',
- 'woocommerce-payments'
- ) }
-
-
- { upePaymentMethods.map( ( method ) => (
-
-
-
- ) ) }
-
- >
- ) : null }
-
- >
- );
-};
-
-const DisableUpeModal = ( { setOpenModal, triggerAfterDisable } ) => {
- const [ isUpeEnabled, setIsUpeEnabled ] = useIsUpeEnabled();
- const { status } = useContext( WcPayUpeContext );
-
- useEffect( () => {
- if ( ! isUpeEnabled ) {
- setOpenModal( '' );
- triggerAfterDisable();
- }
- }, [ isUpeEnabled, setOpenModal, triggerAfterDisable ] );
-
- useEffect( () => {
- if ( status === 'error' ) {
- dispatch( 'core/notices' ).createErrorNotice(
- __(
- 'There was an error disabling the new payment methods.',
- 'woocommerce-payments'
- )
- );
- }
- }, [ status ] );
-
- return (
- <>
- setOpenModal( '' ) }
- actions={
- <>
- setOpenModal( '' ) }
- >
- { __( 'Cancel', 'woocommerce-payments' ) }
-
- setIsUpeEnabled( false ) }
- >
- { __( 'Disable', 'woocommerce-payments' ) }
-
- >
- }
- >
-
-
- >
- );
-};
-export default DisableUpeModal;
diff --git a/client/settings/disable-upe-modal/style.scss b/client/settings/disable-upe-modal/style.scss
deleted file mode 100644
index 55f2dde2d4f..00000000000
--- a/client/settings/disable-upe-modal/style.scss
+++ /dev/null
@@ -1,11 +0,0 @@
-.disable-modal-section {
- .deactivating-payment-methods-list {
- min-height: 150px;
-
- > * {
- &:not( :last-child ) {
- margin-bottom: $grid-unit-10;
- }
- }
- }
-}
diff --git a/client/settings/settings-manager/index.js b/client/settings/settings-manager/index.js
index ebd1c73085f..8204bad0ac9 100644
--- a/client/settings/settings-manager/index.js
+++ b/client/settings/settings-manager/index.js
@@ -2,7 +2,7 @@
/**
* External dependencies
*/
-import React, { useContext, useState, useLayoutEffect } from 'react';
+import React, { useState, useLayoutEffect } from 'react';
import { ExternalLink } from '@wordpress/components';
import { __, sprintf } from '@wordpress/i18n';
import { getQuery } from '@woocommerce/navigation';
@@ -19,9 +19,7 @@ import SettingsLayout from '../settings-layout';
import SaveSettingsSection from '../save-settings-section';
import Transactions from '../transactions';
import Deposits from '../deposits';
-import WCPaySettingsContext from '../wcpay-settings-context';
import LoadableSettingsSection from '../loadable-settings-section';
-import WcPayUpeContextProvider from '../wcpay-upe-toggle/provider';
import ErrorBoundary from '../../components/error-boundary';
import { useDepositDelayDays, useSettings } from '../../data';
import FraudProtection from '../fraud-protection';
@@ -152,13 +150,6 @@ const AdvancedDescription = () => {
};
const SettingsManager = () => {
- const {
- featureFlags: {
- upeSettingsPreview: isUPESettingsPreviewEnabled,
- upe: isUpeEnabled,
- upeType,
- },
- } = useContext( WCPaySettingsContext );
const [ isTransactionInputsValid, setTransactionInputsValid ] = useState(
true
);
@@ -205,23 +196,16 @@ const SettingsManager = () => {
- { isUPESettingsPreviewEnabled && (
-
-
-
-
-
-
-
-
-
- ) }
+
+
+
+
+
+
+
{
>
-
-
-
+
diff --git a/client/settings/settings-manager/test/index.test.js b/client/settings/settings-manager/test/index.test.js
index 51e861bd192..c9709f1ec15 100644
--- a/client/settings/settings-manager/test/index.test.js
+++ b/client/settings/settings-manager/test/index.test.js
@@ -8,46 +8,21 @@ import { render, screen } from '@testing-library/react';
* Internal dependencies
*/
import SettingsManager from '..';
-import WCPaySettingsContext from '../../wcpay-settings-context';
describe( 'SettingsManager', () => {
- it( 'renders the PaymentMethods section if the UPE feature flag is enabled', () => {
- const context = { featureFlags: { upeSettingsPreview: true } };
+ it( 'renders the PaymentMethods section', () => {
global.wcpaySettings = {};
- render(
-
-
-
- );
+ render( );
expect(
screen.queryByText( 'Payments accepted on checkout' )
).toBeInTheDocument();
} );
- it( 'does not render the PaymentMethods section if the UPE feature flag is disabled', () => {
- const context = { featureFlags: {} };
- global.wcpaySettings = {};
- render(
-
-
-
- );
-
- expect(
- screen.queryByText( 'Payments accepted on checkout' )
- ).not.toBeInTheDocument();
- } );
-
it( 'renders the Fraud Protection settings section', () => {
- const context = { featureFlags: {} };
global.wcpaySettings = {};
- render(
-
-
-
- );
+ render( );
expect( screen.queryByText( 'Fraud protection' ) ).toBeInTheDocument();
} );
diff --git a/client/settings/survey-modal/index.js b/client/settings/survey-modal/index.js
index 45bfe42194a..58f46eb2c44 100644
--- a/client/settings/survey-modal/index.js
+++ b/client/settings/survey-modal/index.js
@@ -11,41 +11,23 @@ import { Button, RadioControl, TextareaControl } from '@wordpress/components';
*/
import './style.scss';
import ConfirmationModal from 'components/confirmation-modal';
-import useIsUpeEnabled from 'settings/wcpay-upe-toggle/hook';
import { wcPaySurveys } from './questions';
import WcPaySurveyContext from './context';
-import InlineNotice from 'components/inline-notice';
import { LoadableBlock } from 'components/loadable';
const SurveyModalBody = ( { options, surveyQuestion } ) => {
- const [ isUpeEnabled ] = useIsUpeEnabled();
const { surveyAnswers, setSurveyAnswers, isLoadingSsr } = useContext(
WcPaySurveyContext
);
return (
<>
- { ! isUpeEnabled && (
-
- { __(
- "You've disabled the new payments experience in your store.",
- 'woocommerce-payments'
- ) }
-
- ) }
{
setSurveyAnswers( ( prev ) => ( {
diff --git a/client/settings/transactions/manual-capture-control.tsx b/client/settings/transactions/manual-capture-control.tsx
index 4ef796c2645..6482106c5ff 100644
--- a/client/settings/transactions/manual-capture-control.tsx
+++ b/client/settings/transactions/manual-capture-control.tsx
@@ -12,7 +12,6 @@ import { useState } from '@wordpress/element';
import { useManualCapture, useCardPresentEligible } from '../../data';
import './style.scss';
import ConfirmationModal from 'wcpay/components/confirmation-modal';
-import useIsUpeEnabled from 'wcpay/settings/wcpay-upe-toggle/hook';
import interpolateComponents from '@automattic/interpolate-components';
const ManualCaptureControl = (): JSX.Element => {
@@ -27,11 +26,9 @@ const ManualCaptureControl = (): JSX.Element => {
setIsManualDepositConfirmationModalOpen,
] = useState( false );
- const [ isUpeEnabled ] = useIsUpeEnabled() as [ boolean ];
-
const handleCheckboxToggle = ( isChecked: boolean ) => {
// toggling from "manual" capture to "automatic" capture - no need to show the modal.
- if ( ! isChecked || ! isUpeEnabled ) {
+ if ( ! isChecked ) {
setIsManualCaptureEnabled( isChecked );
return;
}
diff --git a/client/settings/wcpay-upe-toggle/context.js b/client/settings/wcpay-upe-toggle/context.js
deleted file mode 100644
index 0ed4e203507..00000000000
--- a/client/settings/wcpay-upe-toggle/context.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * External dependencies
- */
-import { createContext } from 'react';
-
-const WcPayUpeContext = createContext( {
- isUpeEnabled: false,
- setIsUpeEnabled: () => null,
- status: 'resolved',
- upeType: '',
-} );
-
-export default WcPayUpeContext;
diff --git a/client/settings/wcpay-upe-toggle/hook.js b/client/settings/wcpay-upe-toggle/hook.js
deleted file mode 100644
index 8cea0f9d2c9..00000000000
--- a/client/settings/wcpay-upe-toggle/hook.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * External dependencies
- */
-import { useContext } from 'react';
-
-/**
- * Internal dependencies
- */
-import WcPayUpeContext from './context';
-
-const useIsUpeEnabled = () => {
- const { isUpeEnabled, setIsUpeEnabled } = useContext( WcPayUpeContext );
-
- return [ isUpeEnabled, setIsUpeEnabled ];
-};
-
-export default useIsUpeEnabled;
diff --git a/client/settings/wcpay-upe-toggle/provider.js b/client/settings/wcpay-upe-toggle/provider.js
deleted file mode 100644
index 044ecb2339d..00000000000
--- a/client/settings/wcpay-upe-toggle/provider.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * External dependencies
- */
-import { useCallback, useMemo, useState } from 'react';
-import apiFetch from '@wordpress/api-fetch';
-import { useDispatch } from '@wordpress/data';
-
-/**
- * Internal dependencies
- */
-import WcPayUpeContext from './context';
-import { NAMESPACE, STORE_NAME } from '../../data/constants';
-import { useEnabledPaymentMethodIds } from '../../data';
-
-const WcPayUpeContextProvider = ( {
- children,
- defaultIsUpeEnabled,
- defaultUpeType,
-} ) => {
- const [ isUpeEnabled, setIsUpeEnabled ] = useState(
- Boolean( defaultIsUpeEnabled )
- );
- const [ upeType, setUpeType ] = useState(
- defaultIsUpeEnabled ? defaultUpeType || 'legacy' : ''
- );
- const [ status, setStatus ] = useState( 'resolved' );
- const [ , setEnabledPaymentMethods ] = useEnabledPaymentMethodIds();
- const { updateAvailablePaymentMethodIds } = useDispatch( STORE_NAME );
-
- const updateFlag = useCallback(
- ( value ) => {
- setStatus( 'pending' );
-
- return apiFetch( {
- path: `${ NAMESPACE }/upe_flag_toggle`,
- method: 'POST',
- // eslint-disable-next-line camelcase
- data: { is_upe_enabled: Boolean( value ) },
- } )
- .then( () => {
- // new "toggles" will continue being "split" UPE
- setUpeType( value ? 'split' : '' );
- setIsUpeEnabled( Boolean( value ) );
-
- // the backend already takes care of this,
- // we're just duplicating the effort
- // to ensure that the non-UPE payment methods are removed when the flag is disabled
- if ( ! value ) {
- updateAvailablePaymentMethodIds( [ 'card' ] );
- setEnabledPaymentMethods( [ 'card' ] );
- }
- setStatus( 'resolved' );
- } )
- .catch( () => {
- setStatus( 'error' );
- } );
- },
- [
- setStatus,
- setIsUpeEnabled,
- setUpeType,
- setEnabledPaymentMethods,
- updateAvailablePaymentMethodIds,
- ]
- );
-
- const contextValue = useMemo(
- () => ( {
- isUpeEnabled,
- setIsUpeEnabled: updateFlag,
- status,
- upeType,
- } ),
- [ isUpeEnabled, updateFlag, status, upeType ]
- );
-
- return (
-
- { children }
-
- );
-};
-
-export default WcPayUpeContextProvider;
diff --git a/client/settings/wcpay-upe-toggle/test/provider.test.js b/client/settings/wcpay-upe-toggle/test/provider.test.js
deleted file mode 100644
index 03538b22da7..00000000000
--- a/client/settings/wcpay-upe-toggle/test/provider.test.js
+++ /dev/null
@@ -1,204 +0,0 @@
-/**
- * External dependencies
- */
-import React, { useEffect } from 'react';
-import { render, waitFor } from '@testing-library/react';
-import apiFetch from '@wordpress/api-fetch';
-import { useDispatch } from '@wordpress/data';
-
-/**
- * Internal dependencies
- */
-
-import WcPayUpeContextProvider from '../provider';
-import WcPayUpeContext from '../context';
-import useIsUpeEnabled from '../hook';
-import { useEnabledPaymentMethodIds } from '../../../data';
-
-jest.mock( '@wordpress/api-fetch', () => jest.fn() );
-jest.mock( '../../../data', () => ( {
- useEnabledPaymentMethodIds: jest.fn(),
-} ) );
-jest.mock( '@wordpress/data', () => ( {
- useDispatch: jest
- .fn()
- .mockReturnValue( { updateAvailablePaymentMethodIds: jest.fn() } ),
-} ) );
-
-describe( 'WcPayUpeContextProvider', () => {
- beforeEach( () => {
- useEnabledPaymentMethodIds.mockReturnValue( [ [], () => null ] );
- } );
-
- afterEach( () => {
- jest.clearAllMocks();
-
- apiFetch.mockResolvedValue( true );
- } );
-
- afterAll( () => {
- jest.restoreAllMocks();
- } );
-
- it( 'should render the initial state', () => {
- const childrenMock = jest.fn().mockReturnValue( null );
- render(
-
-
- { childrenMock }
-
-
- );
-
- expect( childrenMock ).toHaveBeenCalledWith( {
- isUpeEnabled: false,
- setIsUpeEnabled: expect.any( Function ),
- status: 'resolved',
- upeType: '',
- } );
- expect( apiFetch ).not.toHaveBeenCalled();
- } );
-
- it( 'should render the initial state given a default value for isUpeEnabled', () => {
- const childrenMock = jest.fn().mockReturnValue( null );
- render(
-
-
- { childrenMock }
-
-
- );
-
- expect( childrenMock ).toHaveBeenCalledWith(
- expect.objectContaining( {
- isUpeEnabled: true,
- } )
- );
- expect( apiFetch ).not.toHaveBeenCalled();
- } );
-
- it( 'should call the API and resolve when setIsUpeEnabled has been called', async () => {
- const childrenMock = jest.fn().mockReturnValue( null );
- const setEnabledPaymentMethodIds = jest.fn();
- useEnabledPaymentMethodIds.mockReturnValue( [
- [ 'card', 'giropay' ],
- setEnabledPaymentMethodIds,
- ] );
-
- const UpdateUpeEnabledFlagMock = () => {
- const [ , setIsUpeEnabled ] = useIsUpeEnabled();
- useEffect( () => {
- setIsUpeEnabled( true );
- }, [ setIsUpeEnabled ] );
-
- return null;
- };
-
- render(
-
-
-
- { childrenMock }
-
-
- );
-
- expect( childrenMock ).toHaveBeenCalledWith( {
- isUpeEnabled: false,
- setIsUpeEnabled: expect.any( Function ),
- status: 'resolved',
- upeType: '',
- } );
-
- expect( childrenMock ).toHaveBeenCalledWith( {
- isUpeEnabled: false,
- setIsUpeEnabled: expect.any( Function ),
- status: 'pending',
- upeType: '',
- } );
-
- await waitFor( () =>
- expect( apiFetch ).toHaveBeenCalledWith( {
- path: '/wc/v3/payments/upe_flag_toggle',
- method: 'POST',
- // eslint-disable-next-line camelcase
- data: { is_upe_enabled: true },
- } )
- );
-
- await waitFor( () => expect( apiFetch ).toHaveReturned() );
-
- expect( childrenMock ).toHaveBeenCalledWith( {
- isUpeEnabled: true,
- setIsUpeEnabled: expect.any( Function ),
- status: 'resolved',
- upeType: 'split',
- } );
- expect( setEnabledPaymentMethodIds ).not.toHaveBeenCalled();
- } );
-
- it( 'should disable non-UPE payment methods when the flag is disabled', async () => {
- const childrenMock = jest.fn().mockReturnValue( null );
- const setEnabledPaymentMethodIds = jest.fn();
- useEnabledPaymentMethodIds.mockReturnValue( [
- [ 'card', 'giropay' ],
- setEnabledPaymentMethodIds,
- ] );
- const updateAvailablePaymentMethodIds = jest.fn();
- useDispatch.mockReturnValue( { updateAvailablePaymentMethodIds } );
-
- const UpdateUpeDisabledFlagMock = () => {
- const [ , setIsUpeEnabled ] = useIsUpeEnabled();
- useEffect( () => {
- setIsUpeEnabled( false );
- }, [ setIsUpeEnabled ] );
-
- return null;
- };
-
- render(
-
-
-
- { childrenMock }
-
-
- );
-
- expect( childrenMock ).toHaveBeenCalledWith( {
- isUpeEnabled: true,
- setIsUpeEnabled: expect.any( Function ),
- status: 'resolved',
- upeType: 'legacy',
- } );
-
- expect( childrenMock ).toHaveBeenCalledWith( {
- isUpeEnabled: true,
- setIsUpeEnabled: expect.any( Function ),
- status: 'pending',
- upeType: 'legacy',
- } );
-
- await waitFor( () =>
- expect( apiFetch ).toHaveBeenCalledWith( {
- path: '/wc/v3/payments/upe_flag_toggle',
- method: 'POST',
- // eslint-disable-next-line camelcase
- data: { is_upe_enabled: false },
- } )
- );
-
- await waitFor( () => expect( apiFetch ).toHaveReturned() );
-
- expect( childrenMock ).toHaveBeenCalledWith( {
- isUpeEnabled: false,
- setIsUpeEnabled: expect.any( Function ),
- status: 'resolved',
- upeType: '',
- } );
- expect( setEnabledPaymentMethodIds ).toHaveBeenCalledWith( [ 'card' ] );
- expect( updateAvailablePaymentMethodIds ).toHaveBeenCalledWith( [
- 'card',
- ] );
- } );
-} );
diff --git a/includes/admin/class-wc-payments-admin.php b/includes/admin/class-wc-payments-admin.php
index c44adb42ac8..153746bd832 100644
--- a/includes/admin/class-wc-payments-admin.php
+++ b/includes/admin/class-wc-payments-admin.php
@@ -847,10 +847,6 @@ private function get_js_settings(): array {
'accountEmail' => $this->account->get_account_email(),
'showUpdateDetailsTask' => $this->get_should_show_update_business_details_task( $account_status_data ),
'wpcomReconnectUrl' => $this->payments_api_client->is_server_connected() && ! $this->payments_api_client->has_server_connection_owner() ? WC_Payments_Account::get_wpcom_reconnect_url() : null,
- 'additionalMethodsSetup' => [
- 'isUpeEnabled' => WC_Payments_Features::is_upe_enabled(),
- 'upeType' => WC_Payments_Features::get_enabled_upe_type(),
- ],
'multiCurrencySetup' => [
'isSetupCompleted' => get_option( 'wcpay_multi_currency_setup_completed' ),
],
@@ -921,7 +917,6 @@ private function get_frontend_feature_flags(): array {
[
'paymentTimeline' => self::version_compare( WC_ADMIN_VERSION_NUMBER, '1.4.0', '>=' ),
'customSearch' => self::version_compare( WC_ADMIN_VERSION_NUMBER, '1.3.0', '>=' ),
- 'upeType' => WC_Payments_Features::get_enabled_upe_type(),
],
WC_Payments_Features::to_array()
);
diff --git a/includes/admin/class-wc-rest-upe-flag-toggle-controller.php b/includes/admin/class-wc-rest-upe-flag-toggle-controller.php
deleted file mode 100644
index 9977a12d07f..00000000000
--- a/includes/admin/class-wc-rest-upe-flag-toggle-controller.php
+++ /dev/null
@@ -1,192 +0,0 @@
-wcpay_gateway = $wcpay_gateway;
- }
-
- /**
- * Verify access to request.
- */
- public function check_permission() {
- return current_user_can( 'manage_woocommerce' );
- }
-
- /**
- * Configure REST API routes.
- */
- public function register_routes() {
- register_rest_route(
- $this->namespace,
- '/' . $this->rest_base,
- [
- 'methods' => WP_REST_Server::READABLE,
- 'callback' => [ $this, 'get_flag' ],
- 'permission_callback' => [ $this, 'check_permission' ],
- ]
- );
- register_rest_route(
- $this->namespace,
- '/' . $this->rest_base,
- [
- 'methods' => WP_REST_Server::EDITABLE,
- 'callback' => [ $this, 'set_flag' ],
- 'permission_callback' => [ $this, 'check_permission' ],
- 'args' => [
- 'is_upe_enabled' => [
- 'description' => __( 'Determines if the UPE feature flag is enabled.', 'woocommerce-payments' ),
- 'type' => 'boolean',
- 'validate_callback' => 'rest_validate_request_arg',
- ],
- ],
- ]
- );
- }
-
- /**
- * Retrieve flag status.
- *
- * @return WP_REST_Response
- */
- public function get_flag(): WP_REST_Response {
- return new WP_REST_Response(
- [
- 'is_upe_enabled' => WC_Payments_Features::is_upe_enabled(),
- ]
- );
- }
-
- /**
- * Update the data.
- *
- * @param WP_REST_Request $request Full data about the request.
- */
- public function set_flag( WP_REST_Request $request ) {
- $this->update_is_upe_enabled( $request );
-
- return new WP_REST_Response( [], 200 );
- }
-
- /**
- * Update UPE feature flag enabled status.
- *
- * @param WP_REST_Request $request Request object.
- */
- private function update_is_upe_enabled( WP_REST_Request $request ) {
- if ( ! $request->has_param( 'is_upe_enabled' ) ) {
- return;
- }
-
- $is_upe_enabled = $request->get_param( 'is_upe_enabled' );
-
- if ( $is_upe_enabled ) {
- update_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME, '1' );
-
- // WooCommerce core only includes Tracks in admin, not the REST API, so we need to use this wc_admin method
- // that includes WC_Tracks in case it's not loaded.
- if ( function_exists( 'wc_admin_record_tracks_event' ) ) {
- wc_admin_record_tracks_event(
- Track_Events::DEFERRED_INTENT_UPE_ENABLED,
- [
- 'is_bnpl_affirm_afterpay_enabled' => WC_Payments_Features::is_bnpl_affirm_afterpay_enabled(),
- ]
- );
- }
-
- return;
- }
-
- // If the legacy UPE flag has been enabled, we need to disable the legacy UPE flag.
- if ( '1' === get_option( WC_Payments_Features::UPE_FLAG_NAME ) ) {
- update_option( WC_Payments_Features::UPE_FLAG_NAME, 'disabled' );
-
- if ( function_exists( 'wc_admin_record_tracks_event' ) ) {
- wc_admin_record_tracks_event(
- Track_Events::UPE_DISABLED,
- [
- 'is_bnpl_affirm_afterpay_enabled' => WC_Payments_Features::is_bnpl_affirm_afterpay_enabled(),
- ]
- );
- }
- } elseif ( '1' === get_option( WC_Payments_Features::UPE_SPLIT_FLAG_NAME ) ) {
- // marking the flag as "disabled", so that we can keep track that the merchant explicitly disabled split UPE.
- update_option( WC_Payments_Features::UPE_SPLIT_FLAG_NAME, 'disabled' );
-
- if ( function_exists( 'wc_admin_record_tracks_event' ) ) {
- wc_admin_record_tracks_event(
- Track_Events::SPLIT_UPE_DISABLED,
- [
- 'is_bnpl_affirm_afterpay_enabled' => WC_Payments_Features::is_bnpl_affirm_afterpay_enabled(),
- ]
- );
- }
- } elseif ( '1' === get_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME ) ) {
- // marking the flag as "disabled", so that we can keep track that the merchant explicitly disabled deferred intent UPE.
- update_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME, 'disabled' );
-
- if ( function_exists( 'wc_admin_record_tracks_event' ) ) {
- wc_admin_record_tracks_event(
- Track_Events::DEFERRED_INTENT_UPE_DISABLED,
- [
- 'is_bnpl_affirm_afterpay_enabled' => WC_Payments_Features::is_bnpl_affirm_afterpay_enabled(),
- ]
- );
- }
- }
-
- // resetting a few other things:
- // removing the UPE payment methods and _only_ leaving "card",
- // just in case the user added additional payment method types.
- $this->wcpay_gateway->update_option(
- 'upe_enabled_payment_method_ids',
- [
- 'card',
- ]
- );
-
- // removing the note from the database.
- if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '4.4.0', '>=' ) ) {
- require_once WCPAY_ABSPATH . 'includes/notes/class-wc-payments-notes-additional-payment-methods.php';
- WC_Payments_Notes_Additional_Payment_Methods::possibly_delete_note();
- }
- }
-}
diff --git a/includes/class-wc-payments-checkout.php b/includes/class-wc-payments-checkout.php
index 29ec2f85bbc..18198308323 100644
--- a/includes/class-wc-payments-checkout.php
+++ b/includes/class-wc-payments-checkout.php
@@ -157,9 +157,6 @@ public function get_payment_fields_js_config() {
'forceNetworkSavedCards' => WC_Payments::is_network_saved_cards_enabled() || $gateway->should_use_stripe_platform_on_checkout_page(),
'locale' => WC_Payments_Utils::convert_to_stripe_locale( get_locale() ),
'isPreview' => is_preview(),
- 'isUPEEnabled' => WC_Payments_Features::is_upe_enabled(),
- 'isUPESplitEnabled' => false,
- 'isUPEDeferredEnabled' => true,
'isSavedCardsEnabled' => $this->gateway->is_saved_cards_enabled(),
'isWooPayEnabled' => $this->woopay_util->should_enable_woopay( $this->gateway ) && $this->woopay_util->should_enable_woopay_on_cart_or_checkout(),
'isWoopayExpressCheckoutEnabled' => $this->woopay_util->is_woopay_express_checkout_enabled(),
diff --git a/includes/class-wc-payments-features.php b/includes/class-wc-payments-features.php
index ef9ae19c263..416cac38831 100644
--- a/includes/class-wc-payments-features.php
+++ b/includes/class-wc-payments-features.php
@@ -13,9 +13,6 @@
* WC Payments Features class
*/
class WC_Payments_Features {
- const UPE_FLAG_NAME = '_wcpay_feature_upe';
- const UPE_SPLIT_FLAG_NAME = '_wcpay_feature_upe_split';
- const UPE_DEFERRED_INTENT_FLAG_NAME = '_wcpay_feature_upe_deferred_intent';
const WCPAY_SUBSCRIPTIONS_FLAG_NAME = '_wcpay_feature_subscriptions';
const STRIPE_BILLING_FLAG_NAME = '_wcpay_feature_stripe_billing';
const WOOPAY_EXPRESS_CHECKOUT_FLAG_NAME = '_wcpay_feature_woopay_express_checkout';
@@ -25,42 +22,6 @@ class WC_Payments_Features {
const DISPUTE_ISSUER_EVIDENCE = '_wcpay_feature_dispute_issuer_evidence';
const STREAMLINE_REFUNDS_FLAG_NAME = '_wcpay_feature_streamline_refunds';
- /**
- * Checks whether any UPE gateway is enabled.
- *
- * @return bool
- */
- public static function is_upe_enabled() {
- return true;
- }
-
- /**
- * Returns the "type" of UPE that will be displayed at checkout.
- *
- * @return string
- */
- public static function get_enabled_upe_type() {
- return 'deferred_intent';
- }
-
- /**
- * Checks whether the UPE gateway is enabled
- *
- * @return bool
- */
- public static function did_merchant_disable_upe() {
- return 'disabled' === get_option( self::UPE_FLAG_NAME, '0' ) || 'disabled' === get_option( self::UPE_SPLIT_FLAG_NAME, '0' );
- }
-
- /**
- * Checks whether the UPE settings redesign is enabled
- *
- * @return bool
- */
- public static function is_upe_settings_preview_enabled() {
- return '1' === get_option( '_wcpay_feature_upe_settings_preview', '1' );
- }
-
/**
* Indicates whether card payments are enabled for this (Stripe) account.
*
@@ -398,10 +359,6 @@ public static function is_dispute_issuer_evidence_enabled(): bool {
public static function to_array() {
return array_filter(
[
- 'upe' => self::is_upe_enabled(),
- 'upeSplit' => false,
- 'upeDeferred' => true,
- 'upeSettingsPreview' => self::is_upe_settings_preview_enabled(),
'multiCurrency' => self::is_customer_multi_currency_enabled(),
'woopay' => self::is_woopay_eligible(),
'documents' => self::is_documents_section_enabled(),
diff --git a/includes/class-wc-payments-status.php b/includes/class-wc-payments-status.php
index fa91edc01f0..6f3caf46c14 100644
--- a/includes/class-wc-payments-status.php
+++ b/includes/class-wc-payments-status.php
@@ -139,17 +139,10 @@ public function render_status_report_section() { ?>
is_test() ? esc_html_e( 'Enabled', 'woocommerce-payments' ) : esc_html_e( 'Disabled', 'woocommerce-payments' ); ?>
- :
-
-
-
-
-
- :
-
+ :
+
gateway->get_upe_enabled_payment_method_ids() ) ); ?>
-
diff --git a/includes/class-wc-payments.php b/includes/class-wc-payments.php
index 0d9137ec4a2..69e684e4343 100644
--- a/includes/class-wc-payments.php
+++ b/includes/class-wc-payments.php
@@ -591,12 +591,12 @@ public static function init() {
require_once __DIR__ . '/migrations/class-allowed-payment-request-button-types-update.php';
require_once __DIR__ . '/migrations/class-allowed-payment-request-button-sizes-update.php';
require_once __DIR__ . '/migrations/class-update-service-data-from-server.php';
- require_once __DIR__ . '/migrations/class-track-upe-status.php';
+ require_once __DIR__ . '/migrations/class-additional-payment-methods-admin-notes-removal.php';
require_once __DIR__ . '/migrations/class-delete-active-woopay-webhook.php';
add_action( 'woocommerce_woocommerce_payments_updated', [ new Allowed_Payment_Request_Button_Types_Update( self::get_gateway() ), 'maybe_migrate' ] );
add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Allowed_Payment_Request_Button_Sizes_Update( self::get_gateway() ), 'maybe_migrate' ] );
add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Update_Service_Data_From_Server( self::get_account_service() ), 'maybe_migrate' ] );
- add_action( 'woocommerce_woocommerce_payments_updated', [ '\WCPay\Migrations\Track_Upe_Status', 'maybe_track' ] );
+ add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Additional_Payment_Methods_Admin_Notes_Removal(), 'maybe_migrate' ] );
add_action( 'woocommerce_woocommerce_payments_updated', [ '\WCPay\Migrations\Delete_Active_WooPay_Webhook', 'maybe_delete' ] );
include_once WCPAY_ABSPATH . '/includes/class-wc-payments-explicit-price-formatter.php';
@@ -1041,15 +1041,9 @@ public static function init_rest_api() {
$customer_controller = new WC_REST_Payments_Customer_Controller( self::$api_client, self::$customer_service );
$customer_controller->register_routes();
- if ( WC_Payments_Features::is_upe_settings_preview_enabled() ) {
- include_once WCPAY_ABSPATH . 'includes/admin/class-wc-rest-upe-flag-toggle-controller.php';
- $upe_flag_toggle_controller = new WC_REST_UPE_Flag_Toggle_Controller( self::get_gateway() );
- $upe_flag_toggle_controller->register_routes();
-
- include_once WCPAY_ABSPATH . 'includes/admin/class-wc-rest-payments-survey-controller.php';
- $survey_controller = new WC_REST_Payments_Survey_Controller( self::get_wc_payments_http() );
- $survey_controller->register_routes();
- }
+ include_once WCPAY_ABSPATH . 'includes/admin/class-wc-rest-payments-survey-controller.php';
+ $survey_controller = new WC_REST_Payments_Survey_Controller( self::get_wc_payments_http() );
+ $survey_controller->register_routes();
if ( WC_Payments_Features::is_documents_section_enabled() ) {
include_once WCPAY_ABSPATH . 'includes/admin/class-wc-rest-payments-documents-controller.php';
@@ -1368,11 +1362,6 @@ public static function add_woo_admin_notes() {
require_once WCPAY_ABSPATH . 'includes/notes/class-wc-payments-notes-set-https-for-checkout.php';
WC_Payments_Notes_Set_Https_For_Checkout::possibly_add_note();
- require_once WCPAY_ABSPATH . 'includes/notes/class-wc-payments-notes-additional-payment-methods.php';
- WC_Payments_Notes_Additional_Payment_Methods::set_account( self::get_account_service() );
- WC_Payments_Notes_Additional_Payment_Methods::possibly_add_note();
- WC_Payments_Notes_Additional_Payment_Methods::maybe_enable_upe_feature_flag();
-
require_once WCPAY_ABSPATH . 'includes/notes/class-wc-payments-notes-set-up-stripelink.php';
WC_Payments_Notes_Set_Up_StripeLink::set_gateway( self::get_gateway() );
WC_Payments_Notes_Set_Up_StripeLink::possibly_add_note();
@@ -1425,9 +1414,6 @@ public static function remove_woo_admin_notes() {
require_once WCPAY_ABSPATH . 'includes/notes/class-wc-payments-notes-instant-deposits-eligible.php';
WC_Payments_Notes_Instant_Deposits_Eligible::possibly_delete_note();
- require_once WCPAY_ABSPATH . 'includes/notes/class-wc-payments-notes-additional-payment-methods.php';
- WC_Payments_Notes_Additional_Payment_Methods::possibly_delete_note();
-
require_once WCPAY_ABSPATH . 'includes/notes/class-wc-payments-notes-set-up-stripelink.php';
WC_Payments_Notes_Set_Up_StripeLink::possibly_delete_note();
}
diff --git a/includes/migrations/class-additional-payment-methods-admin-notes-removal.php b/includes/migrations/class-additional-payment-methods-admin-notes-removal.php
new file mode 100644
index 00000000000..9d85abee74b
--- /dev/null
+++ b/includes/migrations/class-additional-payment-methods-admin-notes-removal.php
@@ -0,0 +1,48 @@
+' ) ) {
+ $this->migrate();
+ }
+ }
+
+ /**
+ * Does the actual migration as described in the class docblock.
+ */
+ private function migrate() {
+ // Delete UPE admin notes as UPE is the default now. This is part of the migration and should be removed in the future.
+ require_once WCPAY_ABSPATH . 'includes/notes/class-wc-payments-notes-additional-payment-methods.php';
+ WC_Payments_Notes_Additional_Payment_Methods::possibly_delete_note();
+ }
+}
diff --git a/includes/migrations/class-track-upe-status.php b/includes/migrations/class-track-upe-status.php
deleted file mode 100644
index b519cef583c..00000000000
--- a/includes/migrations/class-track-upe-status.php
+++ /dev/null
@@ -1,61 +0,0 @@
-gateway->get_upe_enabled_payment_method_ids();
$payment_methods_needing_currency = array_reduce(
$enabled_payment_method_ids,
diff --git a/includes/notes/class-wc-payments-notes-additional-payment-methods.php b/includes/notes/class-wc-payments-notes-additional-payment-methods.php
index 95c0b6635b7..7b309f840bf 100644
--- a/includes/notes/class-wc-payments-notes-additional-payment-methods.php
+++ b/includes/notes/class-wc-payments-notes-additional-payment-methods.php
@@ -6,7 +6,6 @@
* @package WooCommerce\Payments\Admin
*/
-use Automattic\WooCommerce\Admin\Notes\Note;
use Automattic\WooCommerce\Admin\Notes\NoteTraits;
defined( 'ABSPATH' ) || exit;
@@ -22,137 +21,11 @@ class WC_Payments_Notes_Additional_Payment_Methods {
*/
const NOTE_NAME = 'wc-payments-notes-additional-payment-methods';
- /**
- * Nonce action name
- */
- const NOTE_ACTION = 'enable-upe';
-
- /**
- * The account service instance.
- *
- * @var WC_Payments_Account
- */
- private static $account;
-
/**
* Get the note.
*/
public static function get_note() {
- // Show this notice only if UPE settings preview is disabled, and UPE flag is not enabled.
- if ( false === WC_Payments_Features::is_upe_settings_preview_enabled() ) {
- return;
- }
-
- if ( WC_Payments_Features::is_upe_enabled() ) {
- return;
- }
-
- if ( WC_Payments_Features::did_merchant_disable_upe() ) {
- return;
- }
-
- if ( self::$account instanceof WC_Payments_Account ) {
- // if the user hasn't connected their account, do not add the note.
- if ( ! self::$account->is_stripe_connected() ) {
- return;
- }
-
- // If the account hasn't completed intitial Stripe onboarding, do not add the note.
- if ( self::$account->is_account_partially_onboarded() ) {
- return;
- }
-
- // If this is a PO account which has not yet completed full onboarding, do not add the note.
- if ( self::$account->is_progressive_onboarding_in_progress() ) {
- return;
- }
- }
-
- $note = new Note();
-
- $note->set_title( __( 'Boost your sales by accepting new payment methods', 'woocommerce-payments' ) );
- $note->set_content(
- WC_Payments_Utils::esc_interpolated_html(
- sprintf(
- /* translators: %s: WooPayments */
- __( 'Get early access to additional payment methods and an improved checkout experience, coming soon to %s. Learn more ', 'woocommerce-payments' ),
- 'WooPayments'
- ),
- [
- 'a' => '',
- ]
- )
- );
- $note->set_content_data( (object) [] );
- $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
- $note->set_name( self::NOTE_NAME );
- $note->set_source( 'woocommerce-payments' );
- $note->add_action(
- self::NOTE_NAME,
- __( 'Enable on your store', 'woocommerce-payments' ),
- admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=woocommerce_payments&action=' . self::NOTE_ACTION ),
- Note::E_WC_ADMIN_NOTE_UNACTIONED,
- true
- );
-
- return $note;
- }
-
- /**
- * Enable UPE feature flag. CTA from Admin Notes. See WC_Payments_Notes_Additional_Payment_Methods.
- */
- public static function maybe_enable_upe_feature_flag() {
- /**
- * TODO: Add nonce to verify https://github.com/woocommerce/woocommerce-admin/pull/6726/
- * requires WC requirement is > 5.4.
- */
- if (
- ! current_user_can( 'manage_woocommerce' ) ||
- empty( $_GET['page'] ) || // phpcs:disable WordPress.Security.NonceVerification.Recommended
- 'wc-settings' !== $_GET['page'] || // phpcs:disable WordPress.Security.NonceVerification.Recommended
- empty( $_GET['action'] ) || // phpcs:disable WordPress.Security.NonceVerification.Recommended
- 'enable-upe' !== $_GET['action'] // phpcs:disable WordPress.Security.NonceVerification.Recommended
- ) {
- return;
- }
-
- // once we get to this point, it means we should enable UPE,
- // but we also need to check whether the account is connected or not.
-
- // if we get to this point and the account is not connected,
- // it means that the note has been displayed at some point, but the account got disconnected afterwards.
- // in that case, let's redirect the user to the account connection page.
- if ( self::$account instanceof WC_Payments_Account ) {
- if ( false === self::$account->is_stripe_connected() ) {
- // account is not connected, redirecting to connection page.
- self::$account->redirect_to_onboarding_welcome_page( __( 'We detected a temporary issue with your account. Please try and connect your Stripe account.', 'woocommerce-payments' ) );
-
- return;
- }
- }
-
- // Track enabling UPE if it wasn't enabled before.
- if ( ! WC_Payments_Features::is_upe_enabled() && class_exists( 'WC_Tracks' ) ) {
- // We're not using Tracker::track_admin() here because
- // WC_Pay\record_tracker_events() is never triggered due to the redirect below.
- WC_Tracks::record_event( 'wcpay_split_upe_enabled' );
- }
-
- // Enable UPE, deletes the note and redirect to onboarding task.
- update_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME, '1' );
- self::possibly_delete_note();
-
- $wcpay_settings_url = admin_url( 'admin.php?page=wc-admin&path=/payments/additional-payment-methods' );
- wp_safe_redirect( $wcpay_settings_url );
- exit;
- }
-
- /**
- * Sets the account service instance reference on the class.
- *
- * @param WC_Payments_Account $account account service instance.
- */
- public static function set_account( WC_Payments_Account $account ) {
- self::$account = $account;
+ // The notice should not be shown anymore because UPE is the default now.
+ return false;
}
}
diff --git a/includes/notes/class-wc-payments-notes-loan-approved.php b/includes/notes/class-wc-payments-notes-loan-approved.php
index 5af554d9c21..6f16a43fd16 100644
--- a/includes/notes/class-wc-payments-notes-loan-approved.php
+++ b/includes/notes/class-wc-payments-notes-loan-approved.php
@@ -13,7 +13,7 @@
defined( 'ABSPATH' ) || exit;
/**
- * Class WC_Payments_Notes_Additional_Payment_Methods
+ * Class WC_Payments_Notes_Loan_Approved
*/
class WC_Payments_Notes_Loan_Approved {
use NoteTraits;
diff --git a/includes/notes/class-wc-payments-notes-set-up-stripelink.php b/includes/notes/class-wc-payments-notes-set-up-stripelink.php
index 2a4c933e0e7..54956d85cec 100644
--- a/includes/notes/class-wc-payments-notes-set-up-stripelink.php
+++ b/includes/notes/class-wc-payments-notes-set-up-stripelink.php
@@ -42,11 +42,6 @@ class WC_Payments_Notes_Set_Up_StripeLink {
* @return bool
*/
public static function should_display_note():bool {
- // If UPE is not enabled, skip.
- if ( ! \WC_Payments_Features::is_upe_enabled() ) {
- return false;
- }
-
// Check if Link payment is available.
$available_upe_payment_methods = self::$gateway->get_upe_available_payment_methods();
if ( ! in_array( Link_Payment_Method::PAYMENT_METHOD_STRIPE_ID, $available_upe_payment_methods, true ) ) {
diff --git a/tests/e2e/specs/performance/payment-methods.spec.js b/tests/e2e/specs/performance/payment-methods.spec.js
index 63425346c5a..470fff34f5c 100644
--- a/tests/e2e/specs/performance/payment-methods.spec.js
+++ b/tests/e2e/specs/performance/payment-methods.spec.js
@@ -47,11 +47,6 @@ describe( 'Checkout page performance', () => {
describe( 'UPE', () => {
beforeEach( async () => {
- // Activate UPE
- await merchant.login();
- await merchantWCP.activateUpe();
- await merchant.logout();
-
// Setup cart
await setupProductCheckout(
config.get( 'addresses.customer.billing' )
@@ -61,11 +56,6 @@ describe( 'Checkout page performance', () => {
afterEach( async () => {
// Clear the cart at the end so it's ready for another test
await shopperWCP.emptyCart();
-
- // Deactivate UPE
- await merchant.login();
- await merchantWCP.deactivateUpe();
- await merchant.logout();
} );
it( 'measures averaged page load metrics', async () => {
diff --git a/tests/e2e/specs/upe-split/shopper/shopper-bnpls-checkout.spec.js b/tests/e2e/specs/upe-split/shopper/shopper-bnpls-checkout.spec.js
index 3cb6a37c02a..67d1a98a142 100644
--- a/tests/e2e/specs/upe-split/shopper/shopper-bnpls-checkout.spec.js
+++ b/tests/e2e/specs/upe-split/shopper/shopper-bnpls-checkout.spec.js
@@ -20,7 +20,6 @@ const UPE_METHOD_CHECKBOXES = [
describe( 'BNPL checkout', () => {
beforeAll( async () => {
await merchant.login();
- await merchantWCP.activateUPEWithDefferedIntentCreation();
await merchantWCP.enablePaymentMethod( UPE_METHOD_CHECKBOXES );
await merchant.logout();
await shopper.login();
@@ -31,7 +30,6 @@ describe( 'BNPL checkout', () => {
await shopperWCP.logout();
await merchant.login();
await merchantWCP.disablePaymentMethod( UPE_METHOD_CHECKBOXES );
- await merchantWCP.deactivateUPEWithDefferedIntentCreation();
await merchant.logout();
} );
diff --git a/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js b/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js
index 21c1c471815..1e9a6a27956 100644
--- a/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js
+++ b/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js
@@ -30,7 +30,6 @@ const MIN_WAIT_TIME_BETWEEN_PAYMENT_METHODS = 20000;
describe( 'Enabled UPE with deferred intent creation', () => {
beforeAll( async () => {
await merchant.login();
- await merchantWCP.activateUPEWithDefferedIntentCreation();
await merchantWCP.enablePaymentMethod( UPE_METHOD_CHECKBOXES );
await merchant.logout();
await shopper.login();
@@ -42,7 +41,6 @@ describe( 'Enabled UPE with deferred intent creation', () => {
await shopperWCP.logout();
await merchant.login();
await merchantWCP.disablePaymentMethod( UPE_METHOD_CHECKBOXES );
- await merchantWCP.deactivateUPEWithDefferedIntentCreation();
await merchant.logout();
} );
diff --git a/tests/e2e/specs/upe-split/shopper/shopper-upe-enabled-all-flows.spec.js b/tests/e2e/specs/upe-split/shopper/shopper-upe-enabled-all-flows.spec.js
index 75a228753fa..78642474eb1 100644
--- a/tests/e2e/specs/upe-split/shopper/shopper-upe-enabled-all-flows.spec.js
+++ b/tests/e2e/specs/upe-split/shopper/shopper-upe-enabled-all-flows.spec.js
@@ -23,7 +23,6 @@ const card = config.get( 'cards.basic' );
describe( 'Enabled Split UPE', () => {
beforeAll( async () => {
await merchant.login();
- await merchantWCP.activateSplitUpe();
await merchantWCP.enablePaymentMethod( UPE_METHOD_CHECKBOXES );
await merchant.logout();
await shopper.login();
@@ -35,7 +34,6 @@ describe( 'Enabled Split UPE', () => {
await shopperWCP.logout();
await merchant.login();
await merchantWCP.disablePaymentMethod( UPE_METHOD_CHECKBOXES );
- await merchantWCP.deactivateSplitUpe();
await merchant.logout();
} );
diff --git a/tests/e2e/specs/upe/shopper/shopper-upe-enabled-all-flows.spec.js b/tests/e2e/specs/upe/shopper/shopper-upe-enabled-all-flows.spec.js
index 6c5a175d8a2..c5ba0caa81e 100644
--- a/tests/e2e/specs/upe/shopper/shopper-upe-enabled-all-flows.spec.js
+++ b/tests/e2e/specs/upe/shopper/shopper-upe-enabled-all-flows.spec.js
@@ -18,7 +18,6 @@ const card = config.get( 'cards.basic' );
describe( 'Enabled UPE', () => {
beforeAll( async () => {
await merchant.login();
- await merchantWCP.activateUpe();
// enable SEPA
await merchantWCP.enablePaymentMethod( [ sepaPaymentMethod ] );
await merchant.logout();
@@ -32,7 +31,6 @@ describe( 'Enabled UPE', () => {
await merchant.login();
//disable SEPA
await merchantWCP.disablePaymentMethod( [ sepaPaymentMethod ] );
- await merchantWCP.deactivateUpe();
await merchant.logout();
} );
diff --git a/tests/e2e/specs/wcpay/merchant/merchant-payment-settings-manual-capture.spec.js b/tests/e2e/specs/wcpay/merchant/merchant-payment-settings-manual-capture.spec.js
index 3349419f89e..54b622569cd 100644
--- a/tests/e2e/specs/wcpay/merchant/merchant-payment-settings-manual-capture.spec.js
+++ b/tests/e2e/specs/wcpay/merchant/merchant-payment-settings-manual-capture.spec.js
@@ -12,6 +12,8 @@ const confirmationModalClass = '.wcpay-confirmation-modal';
describe( 'As a merchant, I should be prompted a confirmation modal when I try to activate the manual capture', () => {
beforeAll( async () => {
await merchant.login();
+ await merchantWCP.openWCPSettings();
+ await merchantWCP.skipFraudProtectionTour();
} );
afterAll( async () => {
@@ -19,13 +21,10 @@ describe( 'As a merchant, I should be prompted a confirmation modal when I try t
} );
afterEach( async () => {
- await merchantWCP.deactivateUpe();
+ await merchantWCP.unsetCheckboxByTestId( checkboxCaptureLaterOption );
} );
- it( 'should show the confirmation dialog when enabling the manual capture while UPE is activated', async () => {
- await merchantWCP.activateUpe();
- await merchantWCP.openWCPSettings();
- await merchantWCP.skipFraudProtectionTour();
+ it( 'should show the confirmation dialog when enabling the manual capture', async () => {
await merchantWCP.setCheckboxByTestId( checkboxCaptureLaterOption );
const confirmationModal = await expect( page ).toMatchElement(
confirmationModalClass
@@ -35,10 +34,7 @@ describe( 'As a merchant, I should be prompted a confirmation modal when I try t
);
} );
- it( 'should not show the confirmation dialog when disabling the manual capture while UPE is activated', async () => {
- await merchantWCP.activateUpe();
- await merchantWCP.openWCPSettings();
- await merchantWCP.skipFraudProtectionTour();
+ it( 'should not show the confirmation dialog when disabling the manual capture', async () => {
await merchantWCP.setCheckboxByTestId( checkboxCaptureLaterOption );
const confirmationModal = await expect( page ).toMatchElement(
confirmationModalClass
@@ -51,10 +47,7 @@ describe( 'As a merchant, I should be prompted a confirmation modal when I try t
await expect( page ).not.toMatchElement( '.wcpay-confirmation-modal' );
} );
- it( 'should show the UPE methods disabled when manual capture is enabled', async () => {
- await merchantWCP.activateUpe();
- await merchantWCP.openWCPSettings();
- await merchantWCP.skipFraudProtectionTour();
+ it( 'should show the non-card methods disabled when manual capture is enabled', async () => {
await merchantWCP.setCheckboxByTestId( checkboxCaptureLaterOption );
const confirmationModal = await expect( page ).toMatchElement(
confirmationModalClass
diff --git a/tests/e2e/specs/wcpay/shopper/shopper-checkout-free-cart.spec.js b/tests/e2e/specs/wcpay/shopper/shopper-checkout-free-cart.spec.js
index c6a186ba696..9d8497888ac 100644
--- a/tests/e2e/specs/wcpay/shopper/shopper-checkout-free-cart.spec.js
+++ b/tests/e2e/specs/wcpay/shopper/shopper-checkout-free-cart.spec.js
@@ -6,11 +6,10 @@ import config from 'config';
* Internal dependencies
*/
import { fillCardDetails, setupCheckout } from '../../../utils/payments';
-import { merchantWCP, shopperWCP } from '../../../utils';
+import { shopperWCP } from '../../../utils';
const {
shopper,
- merchant,
clearAndFillInput,
uiUnblocked,
} = require( '@woocommerce/e2e-utils' );
@@ -59,12 +58,6 @@ describe( 'Checkout with free coupon & after modifying cart on Checkout page', (
} );
describe( 'UPE', () => {
- beforeAll( async () => {
- await merchant.login();
- await merchantWCP.activateSplitUpe();
- await merchant.logout();
- } );
-
beforeEach( async () => {
await shopper.goToShop();
await shopper.addToCartFromShopPage( productName );
@@ -83,11 +76,5 @@ describe( 'Checkout with free coupon & after modifying cart on Checkout page', (
await shopper.placeOrder();
await expect( page ).toMatch( 'Order received' );
} );
-
- afterAll( async () => {
- await merchant.login();
- await merchantWCP.deactivateSplitUpe();
- await merchant.logout();
- } );
} );
} );
diff --git a/tests/e2e/utils/flows.js b/tests/e2e/utils/flows.js
index 50a0b294a75..0a2d8a8e7f8 100644
--- a/tests/e2e/utils/flows.js
+++ b/tests/e2e/utils/flows.js
@@ -290,192 +290,6 @@ export const shopperWCP = {
// The generic flows will be moved to their own package soon (more details in p7bje6-2gV-p2), so we're
// keeping our customizations grouped here so it's easier to extend the flows once the move happens.
export const merchantWCP = {
- activateUpe: async () => {
- await page.goto( WCPAY_DEV_TOOLS, {
- waitUntil: 'networkidle0',
- } );
-
- if ( ! ( await page.$( '#_wcpay_feature_upe:checked' ) ) ) {
- await expect( page ).toClick( 'label[for="_wcpay_feature_upe"]' );
- }
-
- const isSplitUPEEnabled = await page.$(
- '#_wcpay_feature_upe_split:checked'
- );
-
- if ( isSplitUPEEnabled ) {
- // Deactivate the Split UPE checkout.
- await expect( page ).toClick(
- 'label[for="_wcpay_feature_upe_split"]'
- );
- }
-
- const isAdditionalPaymentsActive = await page.$(
- '#_wcpay_feature_upe_additional_payment_methods:checked'
- );
-
- if ( ! isAdditionalPaymentsActive ) {
- await expect( page ).toClick(
- 'label[for="_wcpay_feature_upe_additional_payment_methods"]'
- );
- }
-
- await expect( page ).toClick( 'input#submit' );
- await page.waitForNavigation( {
- waitUntil: 'networkidle0',
- } );
- },
-
- activateSplitUpe: async () => {
- await page.goto( WCPAY_DEV_TOOLS, {
- waitUntil: 'networkidle0',
- } );
-
- if ( ! ( await page.$( '#_wcpay_feature_upe_split:checked' ) ) ) {
- await expect( page ).toClick(
- 'label[for="_wcpay_feature_upe_split"]'
- );
- }
-
- const isAdditionalPaymentsActive = await page.$(
- '#_wcpay_feature_upe_additional_payment_methods:checked'
- );
-
- if ( ! isAdditionalPaymentsActive ) {
- await expect( page ).toClick(
- 'label[for="_wcpay_feature_upe_additional_payment_methods"]'
- );
- }
-
- await expect( page ).toClick( 'input#submit' );
- await page.waitForNavigation( {
- waitUntil: 'networkidle0',
- } );
- },
-
- activateUPEWithDefferedIntentCreation: async () => {
- await page.goto( WCPAY_DEV_TOOLS, {
- waitUntil: 'networkidle0',
- } );
-
- // uncheck UPE
- if ( await page.$( '#_wcpay_feature_upe:checked' ) ) {
- await expect( page ).toClick( 'label', {
- text: 'Enable UPE checkout (legacy)',
- } );
- }
-
- // uncheck split UPE
- if ( await page.$( '#_wcpay_feature_upe_split:checked' ) ) {
- await expect( page ).toClick( 'label', {
- text: 'Enable Split UPE checkout',
- } );
- }
-
- // check enhanced UPE
- if (
- ! ( await page.$( '#_wcpay_feature_upe_deferred_intent:checked' ) )
- ) {
- await expect( page ).toClick( 'label', {
- text: 'Enable Split UPE checkout with deferred intent creation',
- } );
- }
-
- const isAdditionalPaymentsActive = await page.$(
- '#_wcpay_feature_upe_additional_payment_methods:checked'
- );
-
- if ( ! isAdditionalPaymentsActive ) {
- await expect( page ).toClick( 'label', {
- text: 'Add UPE additional payment methods',
- } );
- }
-
- await expect( page ).toClick( 'input[type="submit"]' );
- await page.waitForNavigation( {
- waitUntil: 'networkidle0',
- } );
- },
-
- deactivateUPEWithDefferedIntentCreation: async () => {
- await page.goto( WCPAY_DEV_TOOLS, {
- waitUntil: 'networkidle0',
- } );
-
- if ( await page.$( '#_wcpay_feature_upe_deferred_intent:checked' ) ) {
- await expect( page ).toClick( 'label', {
- text: 'Enable Split UPE checkout with deferred intent creation',
- } );
- }
-
- const isAdditionalPaymentsActive = await page.$(
- '#_wcpay_feature_upe_additional_payment_methods:checked'
- );
-
- if ( isAdditionalPaymentsActive ) {
- await expect( page ).toClick( 'label', {
- text: 'Add UPE additional payment methods',
- } );
- }
-
- await expect( page ).toClick( 'input[type="submit"]' );
- await page.waitForNavigation( {
- waitUntil: 'networkidle0',
- } );
- },
-
- deactivateUpe: async () => {
- await page.goto( WCPAY_DEV_TOOLS, {
- waitUntil: 'networkidle0',
- } );
-
- if ( await page.$( '#_wcpay_feature_upe:checked' ) ) {
- await expect( page ).toClick( 'label[for="_wcpay_feature_upe"]' );
- }
-
- const isAdditionalPaymentsActive = await page.$(
- '#_wcpay_feature_upe_additional_payment_methods:checked'
- );
-
- if ( isAdditionalPaymentsActive ) {
- await expect( page ).toClick(
- 'label[for="_wcpay_feature_upe_additional_payment_methods"]'
- );
- }
-
- await expect( page ).toClick( 'input#submit' );
- await page.waitForNavigation( {
- waitUntil: 'networkidle0',
- } );
- },
-
- deactivateSplitUpe: async () => {
- await page.goto( WCPAY_DEV_TOOLS, {
- waitUntil: 'networkidle0',
- } );
-
- if ( await page.$( '#_wcpay_feature_upe_split:checked' ) ) {
- await expect( page ).toClick(
- 'label[for="_wcpay_feature_upe_split"]'
- );
- }
-
- const isAdditionalPaymentsActive = await page.$(
- '#_wcpay_feature_upe_additional_payment_methods:checked'
- );
-
- if ( isAdditionalPaymentsActive ) {
- await expect( page ).toClick(
- 'label[for="_wcpay_feature_upe_additional_payment_methods"]'
- );
- }
-
- await expect( page ).toClick( 'input#submit' );
- await page.waitForNavigation( {
- waitUntil: 'networkidle0',
- } );
- },
-
enableActAsDisconnectedFromWCPay: async () => {
await page.goto( WCPAY_DEV_TOOLS, {
waitUntil: 'networkidle0',
diff --git a/tests/unit/admin/test-class-wc-payments-admin.php b/tests/unit/admin/test-class-wc-payments-admin.php
index ea7aaaed164..65b75d854fe 100644
--- a/tests/unit/admin/test-class-wc-payments-admin.php
+++ b/tests/unit/admin/test-class-wc-payments-admin.php
@@ -145,9 +145,6 @@ public function test_it_does_not_render_settings_badge( $is_upe_settings_preview
$this->mock_current_user_is_admin();
- update_option( '_wcpay_feature_upe_settings_preview', $is_upe_settings_preview_enabled ? '1' : '0' );
- update_option( '_wcpay_feature_upe', $is_upe_enabled ? '1' : '0' );
-
// Make sure we render the menu with submenu items.
$this->mock_account->method( 'is_account_fully_onboarded' )->willReturn( true );
$this->mock_account->method( 'is_stripe_connected' )->willReturn( true );
diff --git a/tests/unit/admin/test-class-wc-rest-payments-settings-controller.php b/tests/unit/admin/test-class-wc-rest-payments-settings-controller.php
index 4d42756e1ef..3f109547442 100644
--- a/tests/unit/admin/test-class-wc-rest-payments-settings-controller.php
+++ b/tests/unit/admin/test-class-wc-rest-payments-settings-controller.php
@@ -240,9 +240,6 @@ public function set_up() {
public function tear_down() {
parent::tear_down();
- update_option( WC_Payments_Features::UPE_FLAG_NAME, '0' );
- update_option( WC_Payments_Features::UPE_SPLIT_FLAG_NAME, '0' );
- update_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME, '0' );
WC_Blocks_REST_API_Registration_Preventer::stop_preventing();
}
diff --git a/tests/unit/admin/test-class-wc-rest-upe-flag-toggle-controller.php b/tests/unit/admin/test-class-wc-rest-upe-flag-toggle-controller.php
deleted file mode 100644
index cc5b40ce560..00000000000
--- a/tests/unit/admin/test-class-wc-rest-upe-flag-toggle-controller.php
+++ /dev/null
@@ -1,193 +0,0 @@
-getMockBuilder( WC_Payments_API_Client::class )
- ->disableOriginalConstructor()
- ->getMock();
-
- $mock_wcpay_account = $this->createMock( WC_Payments_Account::class );
- $mock_fraud_service = $this->createMock( WC_Payments_Fraud_Service::class );
- $this->mock_db_cache = $this->createMock( Database_Cache::class );
- $mock_session_service = $this->createMock( WC_Payments_Session_Service::class );
- $customer_service = new WC_Payments_Customer_Service( $mock_api_client, $mock_wcpay_account, $this->mock_db_cache, $mock_session_service );
- $token_service = new WC_Payments_Token_Service( $mock_api_client, $customer_service );
- $order_service = new WC_Payments_Order_Service( $mock_api_client );
- $action_scheduler_service = new WC_Payments_Action_Scheduler_Service( $mock_api_client, $order_service );
- $rate_limiter = new Session_Rate_Limiter( 'wcpay_card_declined_registry', 5, 60 );
- $mock_dpps = $this->createMock( Duplicate_Payment_Prevention_Service::class );
-
- $this->gateway = new WC_Payment_Gateway_WCPay(
- $mock_api_client,
- $mock_wcpay_account,
- $customer_service,
- $token_service,
- $action_scheduler_service,
- $rate_limiter,
- $order_service,
- $mock_dpps,
- $this->createMock( WC_Payments_Localization_Service::class ),
- $mock_fraud_service
- );
- $this->controller = new WC_REST_UPE_Flag_Toggle_Controller( $this->gateway );
- update_option( WC_Payments_Features::UPE_FLAG_NAME, '0' );
- update_option( WC_Payments_Features::UPE_SPLIT_FLAG_NAME, '0' );
- update_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME, '0' );
- }
-
- public function tear_down() {
- parent::tear_down();
- update_option( WC_Payments_Features::UPE_FLAG_NAME, '0' );
- update_option( WC_Payments_Features::UPE_SPLIT_FLAG_NAME, '0' );
- update_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME, '0' );
- }
-
- public function test_get_flag_fails_if_user_cannot_manage_woocommerce() {
- // Set the user so that we can pass the authentication.
- wp_set_current_user( 1 );
-
- $cb = $this->create_can_manage_woocommerce_cap_override( false );
- add_filter( 'user_has_cap', $cb );
- $response = rest_do_request( new WP_REST_Request( 'GET', self::ROUTE ) );
- $this->assertEquals( 403, $response->get_status() );
- remove_filter( 'user_has_cap', $cb );
-
- $cb = $this->create_can_manage_woocommerce_cap_override( true );
- add_filter( 'user_has_cap', $cb );
- $response = rest_do_request( new WP_REST_Request( 'GET', self::ROUTE ) );
- $this->assertEquals( 200, $response->get_status() );
- remove_filter( 'user_has_cap', $cb );
- }
-
- public function test_get_flag_request_returns_status_code_200() {
- $response = $this->controller->get_flag();
-
- $this->assertEquals( 200, $response->get_status() );
- }
-
- public function test_set_flag_without_param_returns_status_code_200() {
- $request = new WP_REST_Request( 'POST', self::ROUTE );
- $response = $this->controller->set_flag( $request );
-
- $this->assertEquals( 200, $response->get_status() );
- // no change from the initial flag value.
- $this->assertEquals( '0', get_option( WC_Payments_Features::UPE_FLAG_NAME ) );
- $this->assertEquals( '0', get_option( WC_Payments_Features::UPE_SPLIT_FLAG_NAME ) );
- $this->assertEquals( '0', get_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME ) );
- }
-
- public function test_set_flag_disabled_with_split_returns_status_code_200() {
- update_option( WC_Payments_Features::UPE_SPLIT_FLAG_NAME, '1' );
- $request = new WP_REST_Request( 'POST', self::ROUTE );
- $request->set_param( 'is_upe_enabled', false );
-
- $response = $this->controller->set_flag( $request );
-
- $this->assertEquals( 200, $response->get_status() );
- $this->assertEquals( '0', get_option( WC_Payments_Features::UPE_FLAG_NAME ) );
- $this->assertEquals( 'disabled', get_option( WC_Payments_Features::UPE_SPLIT_FLAG_NAME ) );
- }
-
- public function test_set_flag_disabled_with_deferred_intent_returns_status_code_200() {
- update_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME, '1' );
- $request = new WP_REST_Request( 'POST', self::ROUTE );
- $request->set_param( 'is_upe_enabled', false );
-
- $response = $this->controller->set_flag( $request );
-
- $this->assertEquals( 200, $response->get_status() );
- $this->assertEquals( '0', get_option( WC_Payments_Features::UPE_FLAG_NAME ) );
- $this->assertEquals( 'disabled', get_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME ) );
- }
-
- public function test_set_flag_enabled_request_returns_status_code_200() {
- $request = new WP_REST_Request( 'POST', self::ROUTE );
- $request->set_param( 'is_upe_enabled', true );
-
- $response = $this->controller->set_flag( $request );
-
- $this->assertEquals( 200, $response->get_status() );
- $this->assertEquals( '1', get_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME ) );
- }
-
- public function test_set_flag_disabled_request_returns_status_code_200() {
- $this->gateway->update_option(
- 'upe_enabled_payment_method_ids',
- [
- 'card',
- 'giropay',
- ]
- );
- update_option( WC_Payments_Features::UPE_FLAG_NAME, '1' );
- $this->assertEquals( '1', get_option( WC_Payments_Features::UPE_FLAG_NAME ) );
-
- $request = new WP_REST_Request( 'POST', self::ROUTE );
- $request->set_param( 'is_upe_enabled', false );
-
- $response = $this->controller->set_flag( $request );
-
- $this->assertEquals( 200, $response->get_status() );
- $this->assertEquals( 'disabled', get_option( WC_Payments_Features::UPE_FLAG_NAME, null ) );
- $this->assertEquals(
- [
- 'card',
- ],
- $this->gateway->get_option(
- 'upe_enabled_payment_method_ids'
- )
- );
- }
-
- /**
- * @param bool $can_manage_woocommerce
- *
- * @return Closure
- */
- private function create_can_manage_woocommerce_cap_override( bool $can_manage_woocommerce ) {
- return function ( $allcaps ) use ( $can_manage_woocommerce ) {
- $allcaps['manage_woocommerce'] = $can_manage_woocommerce;
-
- return $allcaps;
- };
- }
-}
diff --git a/tests/unit/bootstrap.php b/tests/unit/bootstrap.php
index 6feb10417ce..0188cfb4f93 100755
--- a/tests/unit/bootstrap.php
+++ b/tests/unit/bootstrap.php
@@ -87,10 +87,8 @@ function() {
require_once $_plugin_dir . 'includes/admin/class-wc-rest-payments-terminal-locations-controller.php';
require_once $_plugin_dir . 'includes/admin/class-wc-rest-payments-tos-controller.php';
require_once $_plugin_dir . 'includes/admin/class-wc-rest-payments-settings-controller.php';
- require_once $_plugin_dir . 'includes/admin/class-wc-rest-upe-flag-toggle-controller.php';
require_once $_plugin_dir . 'includes/admin/class-wc-rest-payments-survey-controller.php';
require_once $_plugin_dir . 'includes/admin/tracks/class-tracker.php';
- require_once $_plugin_dir . 'includes/notes/class-wc-payments-notes-additional-payment-methods.php';
require_once $_plugin_dir . 'includes/admin/class-wc-rest-payments-reader-controller.php';
require_once $_plugin_dir . 'includes/admin/class-wc-rest-payments-files-controller.php';
require_once $_plugin_dir . 'includes/reports/class-wc-rest-payments-reports-transactions-controller.php';
diff --git a/tests/unit/migrations/test-class-track-upe-status.php b/tests/unit/migrations/test-class-track-upe-status.php
deleted file mode 100644
index 6fbf4817162..00000000000
--- a/tests/unit/migrations/test-class-track-upe-status.php
+++ /dev/null
@@ -1,77 +0,0 @@
-assertEquals(
- [
- 'wcpay_upe_enabled' => [],
- ],
- Tracker::get_admin_events()
- );
-
- $this->assertSame( '1', get_option( Track_Upe_Status::IS_TRACKED_OPTION ) );
- }
-
- public function test_do_nothing_default_on_upgrade() {
- Track_Upe_Status::maybe_track();
-
- $this->assertEquals( [], Tracker::get_admin_events() );
-
- $this->assertSame( '1', get_option( Track_Upe_Status::IS_TRACKED_OPTION ) );
- }
-
- public function test_do_nothing_when_tracked() {
- update_option( Track_Upe_Status::IS_TRACKED_OPTION, '1' );
-
- Track_Upe_Status::maybe_track();
-
- $this->assertEquals( [], Tracker::get_admin_events() );
- }
-}
diff --git a/tests/unit/multi-currency/test-class-payment-methods-compatibility.php b/tests/unit/multi-currency/test-class-payment-methods-compatibility.php
index b71c305ef2d..6a0f24eeba8 100644
--- a/tests/unit/multi-currency/test-class-payment-methods-compatibility.php
+++ b/tests/unit/multi-currency/test-class-payment-methods-compatibility.php
@@ -60,16 +60,6 @@ public function set_up() {
$this->payment_methods_compatibility = new \WCPay\MultiCurrency\PaymentMethodsCompatibility( $this->multi_currency_mock, $this->gateway_mock );
$this->payment_methods_compatibility->init_hooks();
- add_filter( 'pre_option__wcpay_feature_upe', [ $this, 'mock_upe_flag' ], 50, 3 );
- }
-
- public function tear_down() {
- parent::tear_down();
- remove_filter( 'pre_option__wcpay_feature_upe', [ $this, 'mock_upe_flag' ], 50 );
- }
-
- public function mock_upe_flag( $pre_option, $option, $default ) {
- return '1';
}
public function test_it_should_not_update_available_currencies_when_enabled_payment_methods_do_not_need_it() {
diff --git a/tests/unit/notes/test-class-wc-payments-notes-additional-payment-methods.php b/tests/unit/notes/test-class-wc-payments-notes-additional-payment-methods.php
deleted file mode 100644
index 53553340b2b..00000000000
--- a/tests/unit/notes/test-class-wc-payments-notes-additional-payment-methods.php
+++ /dev/null
@@ -1,39 +0,0 @@
-getMockBuilder( \WC_Payments_Account::class )->disableOriginalConstructor()->setMethods( [ 'is_stripe_connected', 'redirect_to_onboarding_welcome_page' ] )->getMock();
- $account_mock->expects( $this->atLeastOnce() )->method( 'is_stripe_connected' )->will( $this->returnValue( false ) );
- $account_mock->expects( $this->once() )->method( 'redirect_to_onboarding_welcome_page' );
- WC_Payments_Notes_Additional_Payment_Methods::set_account( $account_mock );
- $_GET['page'] = 'wc-settings';
- $_GET['action'] = 'enable-upe';
-
- WC_Payments_Notes_Additional_Payment_Methods::maybe_enable_upe_feature_flag();
-
- $this->assertSame( '0', get_option( '_wcpay_feature_upe' ) );
- }
-}
diff --git a/tests/unit/notes/test-class-wc-payments-notes-set-up-stripelink.php b/tests/unit/notes/test-class-wc-payments-notes-set-up-stripelink.php
index 883bd5cd96e..530ea9b9726 100644
--- a/tests/unit/notes/test-class-wc-payments-notes-set-up-stripelink.php
+++ b/tests/unit/notes/test-class-wc-payments-notes-set-up-stripelink.php
@@ -32,12 +32,6 @@ public function set_up() {
->getMock();
}
- public function tear_down() {
- delete_option( '_wcpay_feature_upe' );
-
- parent::tear_down();
- }
-
public function test_stripelink_setup_get_note() {
$this->mock_gateway_data( '1', [ 'card', 'link' ], [ 'card' ] );
@@ -72,8 +66,6 @@ public function test_stripelink_setup_note_null_when_link_enabled() {
}
public function mock_gateway_data( $upe_enabled = '0', $available_methods, $enabled_methods ) {
- update_option( '_wcpay_feature_upe', $upe_enabled );
-
$this->mock_wcpay_gateway
->expects( $this->any() )
->method( 'get_upe_available_payment_methods' )
diff --git a/tests/unit/payment-methods/test-class-upe-payment-gateway.php b/tests/unit/payment-methods/test-class-upe-payment-gateway.php
index 955fc151476..7ca31052a47 100644
--- a/tests/unit/payment-methods/test-class-upe-payment-gateway.php
+++ b/tests/unit/payment-methods/test-class-upe-payment-gateway.php
@@ -312,9 +312,6 @@ public function set_up() {
$this->returnValue( $this->mock_payment_result )
);
- update_option( '_wcpay_feature_upe', '1' );
- update_option( '_wcpay_feature_upe_split', '0' );
-
// Arrange: Define a $_POST array which includes the payment method,
// so that get_payment_method_from_request() does not throw error.
$_POST = [
@@ -345,8 +342,6 @@ public function set_up() {
public function tear_down() {
parent::tear_down();
WC_Payments::set_database_cache( $this->_cache );
- update_option( '_wcpay_feature_upe', '0' );
- update_option( '_wcpay_feature_upe_split', '0' );
wcpay_get_test_container()->reset_all_replacements();
}
diff --git a/tests/unit/payment-methods/test-class-upe-split-payment-gateway.php b/tests/unit/payment-methods/test-class-upe-split-payment-gateway.php
index eb86595cd96..2d6e888229e 100644
--- a/tests/unit/payment-methods/test-class-upe-split-payment-gateway.php
+++ b/tests/unit/payment-methods/test-class-upe-split-payment-gateway.php
@@ -332,8 +332,6 @@ public function set_up() {
$get_payment_gateway_by_id_return_value_map[] = [ $payment_method_id, $mock_gateway ];
WC_Helper_Site_Currency::$mock_site_currency = '';
-
- update_option( '_wcpay_feature_upe_split', '1' );
}
foreach ( $this->mock_payment_gateways as $id => $mock_gateway ) {
@@ -367,8 +365,6 @@ public function set_up() {
public function tear_down() {
parent::tear_down();
WC_Payments::set_database_cache( $this->_cache );
- update_option( '_wcpay_feature_upe_split', '0' );
- update_option( '_wcpay_feature_upe_deferred_intent', '0' );
wcpay_get_test_container()->reset_all_replacements();
}
diff --git a/tests/unit/test-class-wc-payments-features.php b/tests/unit/test-class-wc-payments-features.php
index 5176215dc59..ea5c7a82df4 100644
--- a/tests/unit/test-class-wc-payments-features.php
+++ b/tests/unit/test-class-wc-payments-features.php
@@ -19,12 +19,9 @@ class WC_Payments_Features_Test extends WCPAY_UnitTestCase {
protected $mock_cache;
const FLAG_OPTION_NAME_TO_FRONTEND_KEY_MAPPING = [
- '_wcpay_feature_upe' => 'upe',
- '_wcpay_feature_upe_settings_preview' => 'upeSettingsPreview',
- '_wcpay_feature_customer_multi_currency' => 'multiCurrency',
- '_wcpay_feature_documents' => 'documents',
- '_wcpay_feature_auth_and_capture' => 'isAuthAndCaptureEnabled',
- 'is_deferred_intent_creation_upe_enabled' => 'upeDeferred',
+ '_wcpay_feature_customer_multi_currency' => 'multiCurrency',
+ '_wcpay_feature_documents' => 'documents',
+ '_wcpay_feature_auth_and_capture' => 'isAuthAndCaptureEnabled',
];
public function set_up() {
@@ -62,7 +59,7 @@ public function test_it_returns_expected_to_array_result( array $enabled_flags )
public function enabled_flags_provider() {
return [
- 'no flags' => [ [ '_wcpay_feature_upe', 'is_deferred_intent_creation_upe_enabled' ] ],
+ 'no flags' => [ [] ],
'all flags' => [ array_keys( self::FLAG_OPTION_NAME_TO_FRONTEND_KEY_MAPPING ) ],
];
}
diff --git a/tests/unit/test-class-wc-payments-token-service.php b/tests/unit/test-class-wc-payments-token-service.php
index a5c24e5fb03..7d9f40dfa6e 100644
--- a/tests/unit/test-class-wc-payments-token-service.php
+++ b/tests/unit/test-class-wc-payments-token-service.php
@@ -141,7 +141,6 @@ public function test_add_token_to_user_for_sepa_deferred_intent_creation_upe() {
$this->assertEquals( 'pm_mock', $token->get_token() );
$this->assertEquals( '3000', $token->get_last4() );
$this->assertInstanceOf( WC_Payment_Token_WCPay_SEPA::class, $token );
- update_option( WC_Payments_Features::UPE_SPLIT_FLAG_NAME, '0' );
}
@@ -165,7 +164,6 @@ public function test_add_token_to_user_for_sepa_deferred_upe() {
$this->assertEquals( 'pm_mock', $token->get_token() );
$this->assertEquals( '3000', $token->get_last4() );
$this->assertInstanceOf( WC_Payment_Token_WCPay_SEPA::class, $token );
- update_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME, '0' );
}
@@ -195,7 +193,6 @@ public function test_add_token_to_user_for_link() {
* Test add Link token to user with split UPE.
*/
public function test_add_token_to_user_for_link_split_upe() {
- update_option( WC_Payments_Features::UPE_SPLIT_FLAG_NAME, '1' );
$mock_payment_method = [
'id' => 'pm_mock',
'link' => [
@@ -212,14 +209,12 @@ public function test_add_token_to_user_for_link_split_upe() {
$this->assertSame( 'test@test.com', $token->get_email() );
$this->assertSame( '***test@test.com', $token->get_redacted_email() );
$this->assertInstanceOf( WC_Payment_Token_WCPay_Link::class, $token );
- update_option( WC_Payments_Features::UPE_SPLIT_FLAG_NAME, '0' );
}
/**
* Test add Link token to user with deferred intent UPE.
*/
public function test_add_token_to_user_for_link_deferred_upe() {
- update_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME, '1' );
$mock_payment_method = [
'id' => 'pm_mock',
'link' => [
@@ -236,7 +231,6 @@ public function test_add_token_to_user_for_link_deferred_upe() {
$this->assertSame( 'test@test.com', $token->get_email() );
$this->assertSame( '***test@test.com', $token->get_redacted_email() );
$this->assertInstanceOf( WC_Payment_Token_WCPay_Link::class, $token );
- update_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME, '0' );
}
public function test_add_payment_method_to_user() {
@@ -595,8 +589,6 @@ public function test_woocommerce_get_customer_payment_tokens_not_added_from_diff
$this->assertEquals( $gateway_id, $result_tokens[1]->get_gateway_id() );
$this->assertEquals( 'pm_mock0', $result_tokens[0]->get_token() );
$this->assertEquals( 'pm_222', $result_tokens[1]->get_token() );
-
- update_option( '_wcpay_feature_upe_split', '0' );
}
public function test_woocommerce_get_customer_payment_tokens_payment_methods_only_for_retrievable_types() {
diff --git a/tests/unit/test-class-wc-payments.php b/tests/unit/test-class-wc-payments.php
index 00bd7e0a852..692a45b96df 100644
--- a/tests/unit/test-class-wc-payments.php
+++ b/tests/unit/test-class-wc-payments.php
@@ -102,8 +102,6 @@ public function test_it_skips_stripe_link_gateway_registration() {
$this->assertCount( 1, $registered_gateways );
$this->assertInstanceOf( UPE_Split_Payment_Gateway::class, $registered_gateways[0] );
$this->assertEquals( $registered_gateways[0]->get_stripe_id(), 'card' );
-
- update_option( WC_Payments_Features::UPE_DEFERRED_INTENT_FLAG_NAME, '0' );
}
public function test_rest_endpoints_validate_nonce() {