Skip to content

Commit ac0a45c

Browse files
committed
UPE banner for APM enabled merchants (#3433)
* UPE banner for APM enabled merchants * Fix payment method list override * Changelog and readme entries * Changing the dummy text for the new banner * Adding specific unit tests * Updating promotional surface with the final copy * Fix minor typo
1 parent 95cbb1b commit ac0a45c

File tree

4 files changed

+93
-3
lines changed

4 files changed

+93
-3
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** Changelog ***
22

33
= 8.7.0 - xxxx-xx-xx =
4+
* Add - Introduces a new promotional surface to encourage merchants with the legacy checkout experience and APMs enabled to use the new checkout experience.
45
* Fix - Prevent duplicate failed-order emails from being sent.
56
* Fix - Support custom name and description for Afterpay.
67
* Fix - Link APM charge IDs in Order Details page to their Stripe dashboard payments page.

client/settings/payment-settings/__tests__/promotional-banner-section.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@ import React from 'react';
33
import { screen, render } from '@testing-library/react';
44
import userEvent from '@testing-library/user-event';
55
import PromotionalBannerSection from '../promotional-banner-section';
6+
import { useEnabledPaymentMethodIds } from 'wcstripe/data';
67

78
jest.mock( '@wordpress/data' );
89

910
jest.mock( 'wcstripe/data/account', () => ( {
1011
useAccount: jest.fn(),
1112
} ) );
1213

14+
jest.mock( 'wcstripe/data', () => ( {
15+
useEnabledPaymentMethodIds: jest.fn().mockReturnValue( [ [ 'card' ] ] ),
16+
useTestMode: jest.fn().mockReturnValue( [ false ] ),
17+
} ) );
18+
1319
const noticesDispatch = {
1420
createErrorNotice: jest.fn(),
1521
createSuccessNotice: jest.fn(),
@@ -68,4 +74,19 @@ describe( 'PromotionalBanner', () => {
6874
screen.queryByTestId( 're-connect-account-banner' )
6975
).toBeInTheDocument();
7076
} );
77+
78+
it( 'Display the APM version of the new checkout experience promotional surface when any APM is enabled', () => {
79+
useEnabledPaymentMethodIds.mockReturnValue( [ [ 'card', 'ideal' ] ] );
80+
81+
render(
82+
<PromotionalBannerSection
83+
setShowPromotionalBanner={ setShowPromotionalBanner }
84+
isConnectedViaOAuth={ true }
85+
/>
86+
);
87+
88+
expect(
89+
screen.queryByTestId( 'new-checkout-apms-banner' )
90+
).toBeInTheDocument();
91+
} );
7192
} );

client/settings/payment-settings/promotional-banner-section.js

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { __ } from '@wordpress/i18n';
22
import { useDispatch } from '@wordpress/data';
33
import { React } from 'react';
4-
import { Card, Button } from '@wordpress/components';
4+
import { Card, Button, ExternalLink } from '@wordpress/components';
55
import styled from '@emotion/styled';
6+
import interpolateComponents from 'interpolate-components';
67
import CardBody from '../card-body';
78
import bannerIllustration from './banner-illustration.svg';
89
import bannerIllustrationReConnect from './banner-illustration-re-connect.svg';
910
import Pill from 'wcstripe/components/pill';
1011
import { recordEvent } from 'wcstripe/tracking';
11-
import { useTestMode } from 'wcstripe/data';
12+
import { useEnabledPaymentMethodIds, useTestMode } from 'wcstripe/data';
1213

1314
const NewPill = styled( Pill )`
1415
border-color: #674399;
@@ -66,6 +67,9 @@ const PromotionalBannerSection = ( {
6667
'core/notices'
6768
);
6869
const [ isTestModeEnabled ] = useTestMode();
70+
const [ enabledPaymentMethodIds ] = useEnabledPaymentMethodIds();
71+
const hasAPMEnabled =
72+
enabledPaymentMethodIds.filter( ( e ) => e !== 'card' ).length > 0;
6973

7074
const handleButtonClick = () => {
7175
const callback = async () => {
@@ -159,6 +163,65 @@ const PromotionalBannerSection = ( {
159163
</CardBody>
160164
);
161165

166+
const NewCheckoutExperienceAPMsBanner = () => (
167+
<CardBody data-testid="new-checkout-apms-banner">
168+
<CardInner>
169+
<CardColumn>
170+
<NewPill>
171+
{ __( 'New', 'woocommerce-gateway-stripe' ) }
172+
</NewPill>
173+
<h4>
174+
{ __(
175+
'Enable the new Stripe checkout to continue accepting non-card payments',
176+
'woocommerce-gateway-stripe'
177+
) }
178+
</h4>
179+
<p>
180+
{ interpolateComponents( {
181+
mixedString: __(
182+
'Stripe will end support for non-card payment methods in the {{StripeLegacyLink}}legacy checkout on October 29, 2024{{/StripeLegacyLink}}. To continue accepting non-card payments, you must enable the new checkout experience or remove non-card payment methods from your checkout to avoid payment disruptions.',
183+
'woocommerce-gateway-stripe'
184+
),
185+
components: {
186+
StripeLegacyLink: (
187+
<ExternalLink href="https://support.stripe.com/topics/shutdown-of-the-legacy-sources-api-for-non-card-payment-methods" />
188+
),
189+
},
190+
} ) }
191+
</p>
192+
</CardColumn>
193+
<CardColumn>
194+
<BannerIllustration
195+
src={ bannerIllustration }
196+
alt={ __(
197+
'New Checkout',
198+
'woocommerce-gateway-stripe'
199+
) }
200+
/>
201+
</CardColumn>
202+
</CardInner>
203+
<ButtonsRow>
204+
<MainCTALink
205+
variant="secondary"
206+
data-testid="disable-the-legacy-checkout"
207+
onClick={ handleButtonClick }
208+
>
209+
{ __(
210+
'Enable the new checkout',
211+
'woocommerce-gateway-stripe'
212+
) }
213+
</MainCTALink>
214+
<DismissButton
215+
variant="secondary"
216+
onClick={ handleBannerDismiss }
217+
data-testid="dismiss"
218+
>
219+
{ __( 'Dismiss', 'woocommerce-gateway-stripe' ) }
220+
</DismissButton>
221+
</ButtonsRow>
222+
</CardBody>
223+
);
224+
162225
const NewCheckoutExperienceBanner = () => (
163226
<CardBody>
164227
<CardInner>
@@ -215,7 +278,11 @@ const PromotionalBannerSection = ( {
215278
if ( isConnectedViaOAuth === false ) {
216279
BannerContent = <ReConnectAccountBanner />;
217280
} else if ( ! isUpeEnabled ) {
218-
BannerContent = <NewCheckoutExperienceBanner />;
281+
if ( hasAPMEnabled ) {
282+
BannerContent = <NewCheckoutExperienceAPMsBanner />;
283+
} else {
284+
BannerContent = <NewCheckoutExperienceBanner />;
285+
}
219286
}
220287

221288
return (

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ If you get stuck, you can ask for help in the Plugin Forum.
129129
== Changelog ==
130130

131131
= 8.7.0 - xxxx-xx-xx =
132+
* Add - Introduces a new promotional surface to encourage merchants with the legacy checkout experience and APMs enabled to use the new checkout experience.
132133
* Fix - Prevent duplicate failed-order emails from being sent.
133134
* Fix - Support custom name and description for Afterpay.
134135
* Fix - Link APM charge IDs in Order Details page to their Stripe dashboard payments page.

0 commit comments

Comments
 (0)