Skip to content

Commit a39dc9f

Browse files
committed
Merge remote-tracking branch 'origin/release/9.1.1' into trunk
2 parents 88d0cd0 + ab76ee8 commit a39dc9f

11 files changed

+41
-67
lines changed

assets/js/stripe.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
/* global wc_stripe_params, Stripe */
22

3-
import {
4-
PAYMENT_METHOD_BOLETO,
5-
PAYMENT_METHOD_OXXO,
6-
PAYMENT_METHOD_SEPA,
7-
} from 'wcstripe/stripe-utils/constants';
8-
93
jQuery( function($ ) {
104
'use strict';
115

@@ -544,7 +538,7 @@ jQuery( function($ ) {
544538
if ( wc_stripe_form.isSepaChosen() ) {
545539
extra_details.currency = $( '#stripe-sepa_debit-payment-data' ).data( 'currency' );
546540
extra_details.mandate = { notification_method: wc_stripe_params.sepa_mandate_notification };
547-
extra_details.type = PAYMENT_METHOD_SEPA;
541+
extra_details.type = 'sepa_debit';
548542

549543
return stripe.createSource( iban, extra_details ).then( wc_stripe_form.sourceResponse );
550544
}
@@ -701,7 +695,7 @@ jQuery( function($ ) {
701695
* After the customer closes the modal proceeds with checkout normally
702696
*/
703697
handleBoleto: function () {
704-
wc_stripe_form.executeCheckout( PAYMENT_METHOD_BOLETO, function ( checkout_response ) {
698+
wc_stripe_form.executeCheckout( 'boleto', function ( checkout_response ) {
705699
stripe.confirmBoletoPayment(
706700
checkout_response.client_secret,
707701
checkout_response.confirm_payment_data
@@ -785,7 +779,7 @@ jQuery( function($ ) {
785779
* After the customer closes the modal proceeds with checkout normally
786780
*/
787781
handleOxxo: function () {
788-
wc_stripe_form.executeCheckout( PAYMENT_METHOD_OXXO, function ( checkout_response ) {
782+
wc_stripe_form.executeCheckout( 'oxxo', function ( checkout_response ) {
789783
stripe.confirmOxxoPayment(
790784
checkout_response.client_secret,
791785
checkout_response.confirm_payment_data

changelog.txt

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

3+
= 9.1.1 - 2025-01-10 =
4+
* Fix - Fixes the webhook order retrieval by intent charges. The processed event is an object, not an array.
5+
* Fix - Payment request button fails to display when the legacy checkout experience is enabled.
6+
* Fix - Resolves the payment element loading issue in the legacy checkout experience.
7+
38
= 9.1.0 - 2025-01-09 =
49
* Fix - Fixes the new checkout experience not being enabled by default due to conflict with a migration.
510
* Fix - Prevents duplicated credit cards to be added to the customer's account through the My Account page, the shortcode checkout and the block checkout.

includes/class-wc-stripe-blocks-support.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private function register_legacy_payment_method_script_handles() {
178178
* @return array
179179
*/
180180
public function get_payment_method_data() {
181-
$js_params = WC_Stripe_Feature_Flags::is_stripe_ece_enabled()
181+
$js_params = WC_Stripe_Feature_Flags::is_upe_checkout_enabled() && WC_Stripe_Feature_Flags::is_stripe_ece_enabled()
182182
? $this->get_express_checkout_javascript_params()
183183
: $this->get_payment_request_javascript_params();
184184
// We need to call array_merge_recursive so the blocks 'button' setting doesn't overwrite

includes/class-wc-stripe-webhook-handler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,8 +1317,8 @@ private function get_order_from_intent( $intent ) {
13171317
// Try to retrieve from the charges array.
13181318
if ( ! empty( $intent->charges ) ) {
13191319
$charge = $intent->charges[0] ?? [];
1320-
$order_id = $charge['metadata']['order_id'] ?? null;
1321-
return wc_get_order( $order_id );
1320+
$order_id = $charge->metadata->order_id ?? null;
1321+
return $order_id ? wc_get_order( $order_id ) : false;
13221322
}
13231323

13241324
// Fall back to finding the order via the intent ID.

includes/payment-methods/class-wc-stripe-express-checkout-helper.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function is_account_creation_possible() {
8585
* @return string
8686
*/
8787
public function get_button_type() {
88-
return isset( $this->stripe_settings['express_checkout_button_type'] ) ? $this->stripe_settings['express_checkout_button_type'] : 'default';
88+
return isset( $this->stripe_settings['payment_request_button_type'] ) ? $this->stripe_settings['payment_request_button_type'] : 'default';
8989
}
9090

9191
/**
@@ -94,7 +94,7 @@ public function get_button_type() {
9494
* @return string
9595
*/
9696
public function get_button_theme() {
97-
return isset( $this->stripe_settings['express_checkout_button_theme'] ) ? $this->stripe_settings['express_checkout_button_theme'] : 'dark';
97+
return isset( $this->stripe_settings['payment_request_button_theme'] ) ? $this->stripe_settings['payment_request_button_theme'] : 'dark';
9898
}
9999

100100
/**
@@ -103,7 +103,7 @@ public function get_button_theme() {
103103
* @return string
104104
*/
105105
public function get_button_height() {
106-
$height = isset( $this->stripe_settings['express_checkout_button_size'] ) ? $this->stripe_settings['express_checkout_button_size'] : 'default';
106+
$height = isset( $this->stripe_settings['payment_request_button_size'] ) ? $this->stripe_settings['payment_request_button_size'] : 'default';
107107
if ( 'small' === $height ) {
108108
return '40';
109109
}
@@ -121,7 +121,7 @@ public function get_button_height() {
121121
* @return string
122122
*/
123123
public function get_button_radius() {
124-
$height = isset( $this->stripe_settings['express_checkout_button_size'] ) ? $this->stripe_settings['express_checkout_button_size'] : 'default';
124+
$height = isset( $this->stripe_settings['payment_request_button_size'] ) ? $this->stripe_settings['payment_request_button_size'] : 'default';
125125
if ( 'small' === $height ) {
126126
return '2';
127127
}
@@ -1329,18 +1329,18 @@ public function get_login_confirmation_settings() {
13291329
*/
13301330
public function get_button_locations() {
13311331
// If the locations have not been set return the default setting.
1332-
if ( ! isset( $this->stripe_settings['express_checkout_button_locations'] ) ) {
1332+
if ( ! isset( $this->stripe_settings['payment_request_button_locations'] ) ) {
13331333
return [ 'product', 'cart' ];
13341334
}
13351335

13361336
// If all locations are removed through the settings UI the location config will be set to
13371337
// an empty string "". If that's the case (and if the settings are not an array for any
13381338
// other reason) we should return an empty array.
1339-
if ( ! is_array( $this->stripe_settings['express_checkout_button_locations'] ) ) {
1339+
if ( ! is_array( $this->stripe_settings['payment_request_button_locations'] ) ) {
13401340
return [];
13411341
}
13421342

1343-
return $this->stripe_settings['express_checkout_button_locations'];
1343+
return $this->stripe_settings['payment_request_button_locations'];
13441344
}
13451345

13461346
/**
@@ -1351,7 +1351,7 @@ public function get_button_locations() {
13511351
* @return boolean
13521352
*/
13531353
public function is_express_checkout_enabled() {
1354-
return isset( $this->stripe_settings['express_checkout'] ) && 'yes' === $this->stripe_settings['express_checkout'];
1354+
return isset( $this->stripe_settings['payment_request'] ) && 'yes' === $this->stripe_settings['payment_request'];
13551355
}
13561356

13571357
/**

includes/payment-methods/class-wc-stripe-payment-request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function __construct() {
8585
add_action( 'woocommerce_stripe_updated', [ $this, 'migrate_button_size' ] );
8686

8787
// Check if ECE feature flag is enabled.
88-
if ( WC_Stripe_Feature_Flags::is_stripe_ece_enabled() ) {
88+
if ( WC_Stripe_Feature_Flags::is_upe_checkout_enabled() && WC_Stripe_Feature_Flags::is_stripe_ece_enabled() ) {
8989
return;
9090
}
9191

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "woocommerce-gateway-stripe",
33
"title": "WooCommerce Gateway Stripe",
4-
"version": "9.1.0",
4+
"version": "9.1.1",
55
"license": "GPL-3.0",
66
"homepage": "http://wordpress.org/plugins/woocommerce-gateway-stripe/",
77
"repository": {

readme.txt

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: credit card, stripe, apple pay, payment request, google pay, sepa, bancont
44
Requires at least: 6.5
55
Tested up to: 6.7
66
Requires PHP: 7.4
7-
Stable tag: 9.1.0
7+
Stable tag: 9.1.1
88
License: GPLv3
99
License URI: https://www.gnu.org/licenses/gpl-3.0.html
1010
Attributions: thorsten-stripe
@@ -110,40 +110,9 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
110110

111111
== Changelog ==
112112

113-
= 9.1.0 - 2025-01-09 =
114-
* Fix - Fixes the new checkout experience not being enabled by default due to conflict with a migration.
115-
* Fix - Prevents duplicated credit cards to be added to the customer's account through the My Account page, the shortcode checkout and the block checkout.
116-
* Fix - Return to the correct page when redirect-based payment method fails.
117-
* Fix - Show default recipient for Payment Authentication Requested email.
118-
* Fix - Correctly handles IPP failed payments webhook calls by extracting the order ID from the payment intent metadata.
119-
* Fix - Fix ECE crash in classic cart and checkout pages for non-English language sites.
120-
* Fix - Correctly handles UK postcodes redacted by Apple Pay.
121-
* Tweak - Avoid re-sending Processing Order customer email when merchant wins dispute.
122-
* Fix - Allow the saving of iDEAL tokens when SEPA is disabled.
123-
* Fix - Fixes the incompatibility notice in editor due missing style property when instantiating Stripe payment methods.
124-
* Dev - Updates the GitHub caching action (`actions/cache`) to v4 due deprecation.
125-
* Fix - Don't update canceled order status to on-hold when a dispute is opened.
126-
* Fix - Correctly sets the dispute opened note when a dispute does not require any further action.
127-
* Add - Display Multibanco payment instruction details in Order Received page and Order Confirmation email.
128-
* Tweak - Add the transaction limit information to the Afterpay/Clearpay method when listing payment methods.
129-
* Tweak - Add transaction threshold information to Affirm when listing payment methods.
130-
* Fix - Handles additional fields when checking out using ECE on the block checkout.
131-
* Dev - Introduces new payment method name constants for the frontend.
132-
* Dev - Improves the missing intent params error log by appending the payment information array.
133-
* Tweak - Improve error message displayed when payment method creation fails in classic checkout.
134-
* Tweak - Display email address for Link saved payment methods.
135-
* Fix - Only update order status for a Radar review closed event when the order was already captured.
136-
* Dev - Introduces a new class with payment intent statuses constants.
137-
* Add - Correctly handles charge expired webhook events, setting the order status to failed and adding a note.
138-
* Fix - Allow account creation on checkout, if enabled, when purchasing subscriptions using ECE.
139-
* Tweak - Add empty check for cart when checking for allowed products for express checkout.
140-
* Tweak - Improve webhook status related messages on the settings page.
141-
* Update - Prevent editing of orders awaiting payment capture.
142-
* Add - Introduce locking and unlocking in refund flow to prevent double refund due to race condition.
143-
* Dev - Add a GitHub Action workflow to run QIT E2E Integrations tests.
144-
* Fix - Check billing interval and period to set in mandate options.
145-
* Fix - Check order currency on pay for order page to display supported payment methods.
146-
* Update - Migrate payment request settings data to express checkout settings data.
147-
* Update - Make the new Stripe Express Checkout Element enabled by default in all accounts.
113+
= 9.1.1 - 2025-01-10 =
114+
* Fix - Fixes the webhook order retrieval by intent charges. The processed event is an object, not an array.
115+
* Fix - Payment request button fails to display when the legacy checkout experience is enabled.
116+
* Fix - Resolves the payment element loading issue in the legacy checkout experience.
148117

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

tests/phpunit/test-wc-stripe-webhook-handler.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,21 +433,27 @@ public function test_process_payment_intent(
433433
$order->save_meta_data();
434434
$order->save();
435435

436-
$notification = (object) [
436+
$notification = [
437437
'type' => $event_type,
438-
'data' => (object) [
439-
'object' => (object) [
438+
'data' => [
439+
'object' => [
440440
'id' => 'pi_mock',
441-
'metadata' => (object) [
442-
'order_id' => $order->get_id(),
441+
'charges' => [
442+
[
443+
'metadata' => [
444+
'order_id' => $order->get_id(),
445+
],
446+
],
443447
],
444-
'last_payment_error' => (object) [
448+
'last_payment_error' => [
445449
'message' => 'Your card was declined. You can call your bank for details.',
446450
],
447451
],
448452
],
449453
];
450454

455+
$notification = json_decode( wp_json_encode( $notification ) );
456+
451457
$this->mock_webhook_handler->process_payment_intent( $notification );
452458

453459
$final_order = wc_get_order( $order->get_id() );

0 commit comments

Comments
 (0)