Skip to content

Commit f3c4918

Browse files
committed
Merge branch 'develop' into release/8.6.0
2 parents b2a4137 + 00afcc4 commit f3c4918

31 files changed

+916
-238
lines changed

changelog.txt

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

33
= 8.6.0 - xxxx-xx-xx =
4+
* Tweak - Improves the wording of the invalid Stripe keys errors, instructing merchants to click the "Configure connection" button instead of manually setting the keys.
5+
* Add - Includes a new promotional surface to encourage merchants to re-connect their Stripe account using the new flow.
46
* Add - Added filter to enable updating Level 3 data based on order data.
57
* Add - Replace account key sharing and replace it with an OAuth connect flow allowing users to connect their Stripe account automatically without the need to find keys.
68
* Add - Indicate the activation status of each payment method individually, instead of using a general notice.
@@ -11,13 +13,21 @@
1113
* Fix - Display the payment decline reason on the checkout when using Cash App or WeChat.
1214
* Fix - Re-enable the "Place order" button on the block checkout after closing the WeChat or Cash App payment modal.
1315
* Fix - When SEPA tokens are added via the My Account > Payment methods page, ensure they are attached to the Stripe customer.
16+
* Fix - Clear the saved Stripe Link payment methods when a customer cache is cleared to ensure cached methods are updated promptly.
17+
* Fix - Display Stripe Link payment methods correctly in both Block Checkout and My Account pages.
18+
* Fix - Resolve an error when adding a saved card payment method in My Account when Stripe Link is enabled.
1419
* Fix - Resolved an error when using 3D Secure-enabled cards with Stripe Link enabled.
1520
* Fix - Corrected setup intent payment method types to include 'link' when Stripe Link is enabled, resolving errors during subscription signups.
1621
* Fix - Resolved an issue where changing the payment method for subscriptions failed after 3D-Secure authentication.
1722
* Fix - Prevent displaying the default admin description on the checkout page when a payment method description is empty.
23+
* Fix - Adds back the ability to perform direct refunds for giropay orders via the order details page.
24+
* Fix - After configuring webhooks automatically ensure only the latest webhook endpoint is active, deleting duplicates configured manually.
25+
* Fix - Resolved PHP errors related to detaching payment methods after failed 3D-Secure challenges.
1826
* Tweak - Minor text updates to webhook-related configuration labels and buttons.
1927
* Tweak - Improve UX by using the 3DS verification modal to confirm setup intents for subscription sign-ups, ensuring customers stay on the checkout page.
2028
* Tweak - Display a notice when the Stripe connect URL is not available.
29+
* Fix - Prevent adding multiple copies of the same order notes.
30+
* Tweak - Automatically configure webhooks after completing the OAuth Stripe flow.
2131
* Tweak - Don't process webhooks when the webhook secret isn't set in the store.
2232

2333
= 8.5.2 - 2024-07-22 =

client/api/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ export default class WCStripeAPI {
225225

226226
// Card Payments.
227227
return this.getStripe()
228-
.confirmCardSetup( response.data.client_secret )
228+
.confirmSetup( {
229+
clientSecret: response.data.client_secret,
230+
redirect: 'if_required',
231+
} )
229232
.then( ( confirmedSetupIntent ) => {
230233
const { setupIntent, error } = confirmedSetupIntent;
231234
if ( error ) {

client/data/account-keys/actions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function* saveAccountKeys( accountKeys ) {
6868
yield dispatch( 'core/notices' ).createSuccessNotice(
6969
isDisconnecting
7070
? __( 'Account disconnected.', 'woocommerce-gateway-stripe' )
71-
: __( 'Account keys saved.', 'woocommerce-gateway-stripe' )
71+
: __( 'Account connected.', 'woocommerce-gateway-stripe' )
7272
);
7373
} catch ( e ) {
7474
error = e;
@@ -79,7 +79,7 @@ export function* saveAccountKeys( accountKeys ) {
7979
'woocommerce-gateway-stripe'
8080
)
8181
: __(
82-
'Error saving account keys.',
82+
'Error connecting account.',
8383
'woocommerce-gateway-stripe'
8484
)
8585
);

client/settings/account-details/index.js

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { createInterpolateElement } from '@wordpress/element';
33
import React from 'react';
44
import { ExternalLink, Icon } from '@wordpress/components';
55
import { help } from '@wordpress/icons';
6-
import interpolateComponents from 'interpolate-components';
76
import styled from '@emotion/styled';
87
import SectionStatus from '../section-status';
98
import Tooltip from 'wcstripe/components/tooltip';
@@ -144,29 +143,20 @@ const AccountDetails = () => {
144143
return (
145144
<AccountDetailsContainer>
146145
<AccountDetailsError>
147-
{ isTestModeEnabled
148-
? interpolateComponents( {
149-
mixedString: __(
150-
"Seems like the test keys we've saved for you are no longer valid. If you recently updated them, enter the new test keys from your {{accountLink}}Stripe Account{{/accountLink}}.",
146+
{ createInterpolateElement(
147+
isTestModeEnabled
148+
? __(
149+
"Seems like the test API keys we've saved for you are no longer valid. If you recently updated them, use the <strong>Configure Connection</strong> button below to reconnect.",
151150
'woocommerce-gateway-stripe'
152-
),
153-
components: {
154-
accountLink: (
155-
<ExternalLink href="https://dashboard.stripe.com/test/apikeys" />
156-
),
157-
},
158-
} )
159-
: interpolateComponents( {
160-
mixedString: __(
161-
"Seems like the live keys we've saved for you are no longer valid. If you recently updated them, enter the new live keys from your {{accountLink}}Stripe Account{{/accountLink}}.",
151+
)
152+
: __(
153+
"Seems like the live API keys we've saved for you are no longer valid. If you recently updated them, use the <strong>Configure Connection</strong> button below to reconnect.",
162154
'woocommerce-gateway-stripe'
163-
),
164-
components: {
165-
accountLink: (
166-
<ExternalLink href="https://dashboard.stripe.com/apikeys" />
167-
),
168-
},
169-
} ) }
155+
),
156+
{
157+
strong: <strong />,
158+
}
159+
) }
170160
</AccountDetailsError>
171161
</AccountDetailsContainer>
172162
);

client/settings/payment-methods/index.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
/* global wc_stripe_settings_params */
12
import { __ } from '@wordpress/i18n';
2-
import React from 'react';
3+
import React, { useContext, useState } from 'react';
34
import { ExternalLink } from '@wordpress/components';
45
import SettingsSection from '../settings-section';
56
import PaymentRequestSection from '../payment-request-section';
67
import GeneralSettingsSection from '../general-settings-section';
78
import LoadableSettingsSection from '../loadable-settings-section';
89
import CustomizationOptionsNotice from '../customization-options-notice';
910
import DisplayOrderCustomizationNotice from '../display-order-customization-notice';
11+
import PromotionalBannerSection from 'wcstripe/settings/payment-settings/promotional-banner-section';
12+
import UpeToggleContext from 'wcstripe/settings/upe-toggle/context';
13+
import { useAccount } from 'wcstripe/data/account';
1014

1115
const PaymentMethodsDescription = () => {
1216
return (
@@ -46,8 +50,32 @@ const PaymentRequestDescription = () => (
4650
);
4751

4852
const PaymentMethodsPanel = ( { onSaveChanges } ) => {
53+
const [ showPromotionalBanner, setShowPromotionalBanner ] = useState(
54+
true
55+
);
56+
const { isUpeEnabled, setIsUpeEnabled } = useContext( UpeToggleContext );
57+
const { data } = useAccount();
58+
const isTestModeEnabled = Boolean( data.testmode );
59+
const oauthConnected = isTestModeEnabled
60+
? data?.oauth_connections?.test
61+
: data?.oauth_connections?.live;
62+
4963
return (
5064
<>
65+
{ showPromotionalBanner && (
66+
<SettingsSection>
67+
<PromotionalBannerSection
68+
setShowPromotionalBanner={ setShowPromotionalBanner }
69+
isUpeEnabled={ isUpeEnabled }
70+
setIsUpeEnabled={ setIsUpeEnabled }
71+
isConnectedViaOAuth={ oauthConnected }
72+
oauthUrl={ wc_stripe_settings_params.stripe_oauth_url }
73+
testOauthUrl={
74+
wc_stripe_settings_params.stripe_test_oauth_url
75+
}
76+
/>
77+
</SettingsSection>
78+
) }
5179
<SettingsSection Description={ PaymentMethodsDescription }>
5280
<DisplayOrderCustomizationNotice />
5381
<GeneralSettingsSection onSaveChanges={ onSaveChanges } />

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import PromotionalBannerSection from '../promotional-banner-section';
66

77
jest.mock( '@wordpress/data' );
88

9+
jest.mock( 'wcstripe/data/account', () => ( {
10+
useAccount: jest.fn(),
11+
} ) );
12+
913
const noticesDispatch = {
1014
createErrorNotice: jest.fn(),
1115
createSuccessNotice: jest.fn(),
@@ -26,6 +30,7 @@ describe( 'PromotionalBanner', () => {
2630
render(
2731
<PromotionalBannerSection
2832
setShowPromotionalBanner={ setShowPromotionalBanner }
33+
isConnectedViaOAuth={ true }
2934
/>
3035
);
3136

@@ -44,10 +49,23 @@ describe( 'PromotionalBanner', () => {
4449
setShowPromotionalBanner={ setShowPromotionalBanner }
4550
isUpeEnabled={ false }
4651
setIsUpeEnabled={ setIsUpeEnabledMock }
52+
isConnectedViaOAuth={ true }
4753
/>
4854
);
4955

5056
userEvent.click( screen.getByText( 'Enable the new checkout' ) );
5157
expect( setIsUpeEnabledMock ).toHaveBeenCalled();
5258
} );
59+
60+
it( 'Display the re-connect promotional surface when OAuth connection is not set', () => {
61+
render(
62+
<PromotionalBannerSection
63+
setShowPromotionalBanner={ setShowPromotionalBanner }
64+
isConnectedViaOAuth={ false }
65+
/>
66+
);
67+
expect(
68+
screen.queryByTestId( 're-connect-account-banner' )
69+
).toBeInTheDocument();
70+
} );
5371
} );

client/settings/payment-settings/account-details-section.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ const AccountDetailsSection = ( { setModalType, setKeepModalContent } ) => {
112112
<CardFooter>
113113
<Button
114114
variant="secondary"
115+
id="btn-configure-connection"
115116
onClick={ () =>
116117
setModalType( isTestMode ? 'test' : 'live' )
117118
}

client/settings/payment-settings/account-keys-connection-status.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const AccountKeysConnectionStatus = ( { formRef } ) => {
5858
) {
5959
dispatch( 'core/notices' ).createErrorNotice(
6060
__(
61-
'Only live account keys should be entered.',
61+
'Only a live account should be connected.',
6262
'woocommerce-gateway-stripe'
6363
)
6464
);
@@ -79,7 +79,7 @@ export const AccountKeysConnectionStatus = ( { formRef } ) => {
7979
) {
8080
dispatch( 'core/notices' ).createErrorNotice(
8181
__(
82-
'Only test account keys should be entered.',
82+
'Only a test account should be connected.',
8383
'woocommerce-gateway-stripe'
8484
)
8585
);
Lines changed: 7 additions & 0 deletions
Loading

client/settings/payment-settings/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global wc_stripe_settings_params */
12
import { __ } from '@wordpress/i18n';
23
import { React, useContext, useState } from 'react';
34
import { ExternalLink } from '@wordpress/components';
@@ -13,6 +14,7 @@ import './style.scss';
1314
import LoadableAccountSection from 'wcstripe/settings/loadable-account-section';
1415
import PromotionalBannerSection from 'wcstripe/settings/payment-settings/promotional-banner-section';
1516
import UpeToggleContext from 'wcstripe/settings/upe-toggle/context';
17+
import { useAccount } from 'wcstripe/data/account';
1618

1719
const GeneralSettingsDescription = () => (
1820
<>
@@ -75,6 +77,11 @@ const PaymentSettingsPanel = () => {
7577
true
7678
);
7779
const { isUpeEnabled, setIsUpeEnabled } = useContext( UpeToggleContext );
80+
const { data } = useAccount();
81+
const isTestModeEnabled = Boolean( data.testmode );
82+
const oauthConnected = isTestModeEnabled
83+
? data?.oauth_connections?.test
84+
: data?.oauth_connections?.live;
7885

7986
const handleModalDismiss = () => {
8087
setModalType( '' );
@@ -102,6 +109,13 @@ const PaymentSettingsPanel = () => {
102109
}
103110
isUpeEnabled={ isUpeEnabled }
104111
setIsUpeEnabled={ setIsUpeEnabled }
112+
isConnectedViaOAuth={ oauthConnected }
113+
oauthUrl={
114+
wc_stripe_settings_params.stripe_oauth_url
115+
}
116+
testOauthUrl={
117+
wc_stripe_settings_params.stripe_test_oauth_url
118+
}
105119
/>
106120
</LoadableAccountSection>
107121
</LoadableSettingsSection>

0 commit comments

Comments
 (0)