Skip to content

Commit e1607c8

Browse files
annemirasoldiegocurbelo
authored andcommitted
Fix 404 when using ECE and 3D Secure (#3643)
* Fix 404 when using ECE and 3D Secure * Add changelog and readme entries * Update jest tests * Update JSDoc for confirmIntent
1 parent 1d33b0a commit e1607c8

File tree

5 files changed

+32
-16
lines changed

5 files changed

+32
-16
lines changed

changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** Changelog ***
22

33
= 9.0.0 - xxxx-xx-xx =
4+
* Fix - Fix 404 that happens when using ECE and 3D Secure auth is triggered.
45
* Fix - Set correct payment method when using Link and a card that is 3D Secure authenticated.
56
* Fix - Fix total calculation for custom product types when using the Payment Request Button.
67
* Fix - Fix order attribution metadata not included in PRBs or Express Checkout Element.
@@ -16,7 +17,7 @@
1617
* Fix - Return 'is_live' as true in account summary response when test mode is disabled in gateway settings and charge is enabled in Stripe account.
1718
* Fix - Prevents notices being displayed on WordPress 6.7 due to loading translations too early (only shown on stores with WP_DEBUG enabled).
1819
* Fix - Prevent showing the shipping options on express checkout modal for virtual product variations.
19-
* Fix - Do not assume payment is using a saved card when retrying a failed payment.
20+
* Fix - Do not assume payment is using a saved card when retrying a failed payment.
2021
* Tweak - Update links to plugin documentation and Stripe documentation.
2122

2223
= 8.9.0 - 2024-11-14 =

client/api/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ export default class WCStripeAPI {
290290
*
291291
* @param {string} redirectUrl The redirect URL, returned from the server.
292292
* @param {string} paymentMethodToSave The ID of a Payment Method if it should be saved (optional).
293-
* @return {string|true} A redirect URL on success, or `true` if no confirmation is needed.
293+
* @return {Object|true} An object containing the redirect URL on success and a flag indicating
294+
* if the page is the Pay for order page, or `true` if no confirmation is needed.
294295
*/
295296
confirmIntent( redirectUrl, paymentMethodToSave ) {
296297
const partials = redirectUrl.match(

client/express-checkout/__tests__/event-handler.test.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,12 @@ describe( 'Express checkout event handlers', () => {
384384
result: 'success',
385385
redirect: 'https://example.com/redirect',
386386
} );
387-
api.confirmIntent.mockResolvedValue(
388-
'https://example.com/confirmation_redirect'
389-
);
387+
api.confirmIntent.mockReturnValue( {
388+
request: Promise.resolve(
389+
'https://example.com/confirmation_redirect'
390+
),
391+
isOrderPage: false,
392+
} );
390393

391394
await onConfirmHandler(
392395
api,
@@ -415,9 +418,12 @@ describe( 'Express checkout event handlers', () => {
415418
result: 'success',
416419
redirect: 'https://example.com/redirect',
417420
} );
418-
api.confirmIntent.mockRejectedValue(
419-
new Error( 'Intent confirmation error' )
420-
);
421+
api.confirmIntent.mockReturnValue( {
422+
request: Promise.reject(
423+
new Error( 'Intent confirmation error' )
424+
),
425+
isOrderPage: false,
426+
} );
421427

422428
await onConfirmHandler(
423429
api,
@@ -513,9 +519,12 @@ describe( 'Express checkout event handlers', () => {
513519
result: 'success',
514520
redirect: 'https://example.com/redirect',
515521
} );
516-
api.confirmIntent.mockResolvedValue(
517-
'https://example.com/confirmation_redirect'
518-
);
522+
api.confirmIntent.mockReturnValue( {
523+
request: Promise.resolve(
524+
'https://example.com/confirmation_redirect'
525+
),
526+
isOrderPage: false,
527+
} );
519528

520529
await onConfirmHandler(
521530
api,
@@ -545,9 +554,12 @@ describe( 'Express checkout event handlers', () => {
545554
result: 'success',
546555
redirect: 'https://example.com/redirect',
547556
} );
548-
api.confirmIntent.mockRejectedValue(
549-
new Error( 'Intent confirmation error' )
550-
);
557+
api.confirmIntent.mockReturnValue( {
558+
request: Promise.reject(
559+
new Error( 'Intent confirmation error' )
560+
),
561+
isOrderPage: false,
562+
} );
551563

552564
await onConfirmHandler(
553565
api,

client/express-checkout/event-handler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ export const onConfirmHandler = async (
103103
if ( confirmationRequest === true ) {
104104
completePayment( orderResponse.redirect );
105105
} else {
106-
const redirectUrl = await confirmationRequest;
106+
const { request } = confirmationRequest;
107+
const redirectUrl = await request;
107108

108109
completePayment( redirectUrl );
109110
}

readme.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
111111
== Changelog ==
112112

113113
= 9.0.0 - xxxx-xx-xx =
114+
* Fix - Fix 404 that happens when using ECE and 3D Secure auth is triggered.
114115
* Fix - Set correct payment method when using Link and a card that is 3D Secure authenticated.
115116
* Fix - Fix total calculation for custom product types when using the Payment Request Button.
116117
* Fix - Fix order attribution metadata not included in PRBs or Express Checkout Element.
@@ -126,7 +127,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
126127
* Fix - Return 'is_live' as true in account summary response when test mode is disabled in gateway settings and charge is enabled in Stripe account.
127128
* Fix - Prevents notices being displayed on WordPress 6.7 due to loading translations too early (only shown on stores with WP_DEBUG enabled).
128129
* Fix - Prevent showing the shipping options on express checkout modal for virtual product variations.
129-
* Fix - Do not assume payment is using a saved card when retrying a failed payment.
130+
* Fix - Do not assume payment is using a saved card when retrying a failed payment.
130131
* Tweak - Update links to plugin documentation and Stripe documentation.
131132

132133
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

0 commit comments

Comments
 (0)