Skip to content

Commit

Permalink
Fix duplicate order notes/emails on subscription renewal orders (#3572)
Browse files Browse the repository at this point in the history
* Unlock the subscription renewal payment after finishing processing the request

* Unlock the order if a failure occurred creating the intent

* add changelog entry
  • Loading branch information
mattallan authored Nov 6, 2024
1 parent d6c5821 commit 2c6cab0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Add - Add support for Stripe Link payments via the new Stripe Checkout Element on the product, cart, checkout and pay for order pages.
* Add - Show ECE button preview on settings page.
* Tweak - Remove the subscription order notes added each time a source wasn't migrated.
* Fix - Prevent marking renewal orders as processing/completed multiple times due to handling the Stripe webhook in parallel.

= 8.8.1 - 2024-10-28 =
* Tweak - Disables APMs when using the legacy checkout experience due Stripe deprecation by October 29, 2024.
Expand Down
9 changes: 4 additions & 5 deletions includes/compat/trait-wc-stripe-subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,18 +499,15 @@ public function process_subscription_payment( $amount, $renewal_order, $retry =

throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
}

// TODO: Remove when SEPA is migrated to payment intents.
if ( 'stripe_sepa' !== $this->id ) {
$this->unlock_order_payment( $renewal_order );
}
} catch ( WC_Stripe_Exception $e ) {
WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );

do_action( 'wc_gateway_stripe_process_payment_error', $e, $renewal_order );

/* translators: error message */
$renewal_order->update_status( 'failed' );
$this->unlock_order_payment( $renewal_order );

return;
}

Expand Down Expand Up @@ -561,6 +558,8 @@ public function process_subscription_payment( $amount, $renewal_order, $retry =

do_action( 'wc_gateway_stripe_process_payment_error', $e, $renewal_order );
}

$this->unlock_order_payment( $renewal_order );
}

/**
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
* Add - Add support for Stripe Link payments via the new Stripe Checkout Element on the product, cart, checkout and pay for order pages.
* Add - Show ECE button preview on settings page.
* Tweak - Remove the subscription order notes added each time a source wasn't migrated.
* Fix - Prevent marking renewal orders as processing/completed multiple times due to handling the Stripe webhook in parallel.

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

0 comments on commit 2c6cab0

Please sign in to comment.