Skip to content

Commit 7f0e878

Browse files
committed
Merge remote-tracking branch 'origin/release/9.3.1' into trunk
2 parents 6f52b64 + a43ce84 commit 7f0e878

File tree

19 files changed

+140
-109
lines changed

19 files changed

+140
-109
lines changed

.github/workflows/php-tests.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@ jobs:
1616
include:
1717
# WooCommerce
1818
- woocommerce_support_policy: L
19-
woocommerce: '9.5.2'
19+
woocommerce: '9.7.1'
2020
- woocommerce_support_policy: L-1
21-
woocommerce: '9.3.4'
21+
woocommerce: '9.6.2'
2222
- woocommerce_support_policy: L-2
23-
woocommerce: '9.2.3'
23+
woocommerce: '9.5.2'
2424
# WordPress
2525
- wordpress_support_policy: L
26-
wordpress: '6.7'
26+
wordpress: '6.7.2'
2727
- wordpress_support_policy: L-1
28-
wordpress: '6.6'
28+
wordpress: '6.6.2'
29+
# WooCommerce 9.5.0+ requires WordPress 6.6+
30+
# (we'll keep two versions from the 6.6 branch until Apr when WP 6.8 is released)
2931
- wordpress_support_policy: L-2
30-
wordpress: '6.5'
32+
wordpress: '6.6'
3133
# PHP
3234
- php_support_policy: L
3335
php: '8.1'

changelog.txt

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

3+
= 9.3.1 - 2025-03-14 =
4+
* Fix - Temporarily disables the subscriptions detached notice feature due to long loading times on stores with many subscriptions.
5+
* Fix - Update ACH capability check key
6+
* Fix - Update legacy checkout documentation links and deprecation notice display logic
7+
* Fix - Fixes an issue where the order signature retrieval method could throw a fatal error when the received order parameter is actually an OrderRefund object (instead of a WC_Order).
8+
* Fix - Fixes an error with the `filter_thankyou_order_received_text` filter when it does not receive a valid WC_Order instance.
9+
310
= 9.3.0 - 2025-03-13 =
411
* Dev - Adds a new README.md file to the plugin with specific development-focused instructions.
512
* Add - Implements the Single Payment Element feature for the new checkout experience on the block checkout page.

client/components/payment-method-capability-status-pill/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ const IconComponent = ( { children, ...props } ) => (
4747

4848
const PaymentMethodCapabilityStatusPill = ( { id, label } ) => {
4949
const capabilities = useGetCapabilities();
50-
const capabilityStatus = capabilities[ `${ id }_payments` ];
50+
const capabilityStatus =
51+
id === 'us_bank_account'
52+
? capabilities[ `${ id }_ach_payments` ]
53+
: capabilities[ `${ id }_payments` ];
5154

5255
return (
5356
<>

client/components/payment-method-deprecation-pill/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const PaymentMethodDeprecationPill = () => {
6060
components: {
6161
currencySettingsLink: (
6262
<StyledLink
63-
href="https://support.stripe.com/topics/shutdown-of-the-legacy-sources-api-for-non-card-payment-methods"
63+
href="https://woocommerce.com/document/stripe/admin-experience/legacy-checkout-experience/"
6464
target="_blank"
6565
rel="noreferrer"
6666
onClick={ ( ev ) => {

client/data/account/actions.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,18 @@ export function* refreshAccount() {
4040

4141
// Check new payment methods available for account.
4242
const newPaymentMethods = activeCapabilitiesAfterRefresh.filter(
43-
( paymentMethod ) =>
44-
! activeCapabilitiesBeforeRefresh.includes( paymentMethod ) &&
45-
PaymentMethodsMap[
46-
paymentMethod.replace( '_payments', '' )
47-
] !== undefined
43+
( capability ) => {
44+
const paymentMethodFromCapability =
45+
capability === 'us_bank_account_ach_payments'
46+
? 'us_bank_account'
47+
: capability.replace( '_payments', '' );
48+
49+
return (
50+
! activeCapabilitiesBeforeRefresh.includes( capability ) &&
51+
PaymentMethodsMap[ paymentMethodFromCapability ] !==
52+
undefined
53+
);
54+
}
4855
);
4956

5057
// If there are new payment methods available, show a toast informing the user.
@@ -57,9 +64,14 @@ export function* refreshAccount() {
5764
'woocommerce-gateway-stripe'
5865
),
5966
newPaymentMethods
60-
.map( ( method ) => {
67+
.map( ( capability ) => {
68+
const paymentMethodFromCapability =
69+
capability === 'us_bank_account_ach_payments'
70+
? 'us_bank_account'
71+
: capability.replace( '_payments', '' );
72+
6173
return PaymentMethodsMap[
62-
method.replace( '_payments', '' )
74+
paymentMethodFromCapability
6375
].label;
6476
} )
6577
.join( ', ' )

client/settings/general-settings-section/payment-methods-unavailable-list.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ const PaymentMethodsUnavailableList = () => {
1010
const capabilities = useGetCapabilities();
1111
const upePaymentMethodIds = useGetAvailablePaymentMethodIds();
1212
const unavailablePaymentMethodIds = upePaymentMethodIds
13-
.filter(
14-
( methodId ) =>
15-
! capabilities.hasOwnProperty( `${ methodId }_payments` )
16-
)
13+
.filter( ( methodId ) => {
14+
const capabilityId =
15+
methodId === 'us_bank_account'
16+
? `${ methodId }_ach_payments`
17+
: `${ methodId }_payments`;
18+
return ! capabilities.hasOwnProperty( capabilityId );
19+
} )
1720
.filter( ( id ) => id !== PAYMENT_METHOD_LINK );
1821
const unavailablePaymentMethods = unavailablePaymentMethodIds
1922
.filter( ( methodId, idx ) => idx < countIconsToDisplay )

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ const PromotionalBannerSection = ( {
9999
'woocommerce-gateway-stripe'
100100
)
101101
);
102+
103+
window.location.reload();
102104
} catch ( err ) {
103105
createErrorNotice(
104106
__(

includes/abstracts/abstract-wc-stripe-payment-gateway.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
use Automattic\WooCommerce\Admin\Overrides\OrderRefund;
4+
25
if ( ! defined( 'ABSPATH' ) ) {
36
exit;
47
}
@@ -2389,10 +2392,12 @@ public function get_balance_transaction_id_from_charge( $charge ) {
23892392
*
23902393
* This signature is included as metadata in Stripe requests and used to identify the order when webhooks are received.
23912394
*
2392-
* @param WC_Order $order The Order object.
2395+
* @param WC_Order|OrderRefund $order The Order object.
23932396
* @return string The order's unique signature. Format: order_id:md5(order_id-order_key-customer_id-order_total).
23942397
*/
23952398
protected function get_order_signature( $order ) {
2399+
$order = ! is_a( $order, 'WC_Order' ) ? wc_get_order( $order ) : $order;
2400+
23962401
$signature = [
23972402
absint( $order->get_id() ),
23982403
$order->get_order_key(),

includes/admin/class-wc-stripe-admin-notices.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function admin_notices() {
104104
public static function display_legacy_deprecation_notice( $plugin_file ) {
105105
global $wp_list_table;
106106

107-
if ( version_compare( WC_STRIPE_VERSION, '9.3.0', '!=' ) || WC_Stripe_Feature_Flags::is_upe_checkout_enabled() ) {
107+
if ( WC_Stripe_Feature_Flags::is_upe_checkout_enabled() ) {
108108
return;
109109
}
110110

@@ -372,7 +372,7 @@ public function stripe_check_environment() {
372372

373373
if ( empty( $legacy_deprecation_notice ) ) {
374374
// Show legacy deprecation notice in version 9.3.0 if legacy checkout experience is enabled.
375-
if ( ! WC_Stripe_Feature_Flags::is_upe_checkout_enabled() && version_compare( WC_STRIPE_VERSION, '9.3.0', '==' ) ) {
375+
if ( ! WC_Stripe_Feature_Flags::is_upe_checkout_enabled() ) {
376376
$setting_link = $this->get_setting_link();
377377
$message = sprintf(
378378
/* translators: 1) HTML anchor open tag 2) HTML anchor closing tag */
@@ -469,22 +469,30 @@ public function payment_methods_check_environment() {
469469
* @return void
470470
*/
471471
public function subscriptions_check_environment() {
472+
// @todo Temporarily disabling this due long load times on stores with too many subscriptions.
473+
return;
474+
475+
$show_notice = get_option( 'wc_stripe_show_subscriptions_notice' );
476+
if ( 'yes' !== $show_notice ) {
477+
return;
478+
}
479+
472480
$detached_messages = '';
473481
$subscriptions = WC_Stripe_Subscriptions_Helper::get_detached_subscriptions();
474482
foreach ( $subscriptions as $subscription ) {
475483
$customer_payment_method_link = sprintf(
476484
'<a href="%s">%s</a>',
477485
esc_url( $subscription['change_payment_method_url'] ),
478486
esc_html(
479-
/* translators: this is a text for a link pointing to the customer's payment method page */
487+
/* translators: this is a text for a link pointing to the customer's payment method page */
480488
__( 'this link &rarr;', 'woocommerce-gateway-stripe' )
481489
)
482490
);
483491
$customer_stripe_page = sprintf(
484492
'<a href="%s">%s</a>',
485493
esc_url( self::STRIPE_CUSTOMER_PAGE_BASE_URL . $subscription['customer_id'] ),
486494
esc_html(
487-
/* translators: this is a text for a link pointing to the customer's page on Stripe */
495+
/* translators: this is a text for a link pointing to the customer's page on Stripe */
488496
__( 'here &rarr;', 'woocommerce-gateway-stripe' )
489497
)
490498
);
@@ -496,8 +504,7 @@ public function subscriptions_check_environment() {
496504
$customer_stripe_page
497505
);
498506
}
499-
$show_notice = get_option( 'wc_stripe_show_subscriptions_notice' );
500-
if ( ! empty( $detached_messages ) && 'no' !== $show_notice ) {
507+
if ( ! empty( $detached_messages ) ) {
501508
$this->add_admin_notice( 'subscriptions', 'notice notice-error', $detached_messages, true );
502509
}
503510
}

includes/class-wc-stripe-helper.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ public static function filter_payment_methods_with_capabilities( $payment_method
737737
$payment_method_ids_with_capability = [];
738738

739739
foreach ( $payment_method_ids as $payment_method_id ) {
740-
$key = $payment_method_id . '_payments';
740+
$key = self::get_payment_method_capability_id( $payment_method_id );
741741
// Check if the payment method has capabilities set in the account data.
742742
// Generally the key is the payment method id appended with '_payments' (i.e. 'card_payments', 'sepa_debit_payments', 'klarna_payments').
743743
// In some cases, the Stripe account might have the legacy key set. For example, for Klarna, the legacy key is 'klarna'.
@@ -1653,4 +1653,19 @@ public static function maybe_log_ip_issues( $ip_address ) {
16531653
WC_Stripe_Logger::log( 'Invalid IP address detected. Data: ' . wp_json_encode( $log_data ) );
16541654
}
16551655
}
1656+
1657+
/**
1658+
* Return capability ID based on payment method ID.
1659+
*
1660+
* @param string $payment_method_id The payment method ID.
1661+
* @return string The capability ID.
1662+
*/
1663+
public static function get_payment_method_capability_id( $payment_method_id ) {
1664+
// "_payments" is a suffix that comes from Stripe API, except when it is "transfers" or ACH.
1665+
if ( WC_Stripe_UPE_Payment_Method_ACH::STRIPE_ID === $payment_method_id ) {
1666+
return $payment_method_id . '_ach_payments';
1667+
}
1668+
1669+
return $payment_method_id . '_payments';
1670+
}
16561671
}

0 commit comments

Comments
 (0)