Skip to content

Commit

Permalink
Fix call to a member function get_token() on null (#3626)
Browse files Browse the repository at this point in the history
* call process_payment function when retrying a payment

* add changelog
  • Loading branch information
Mayisha authored Dec 5, 2024
1 parent 7779798 commit 9a75c56
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* 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.
* Fix - Prevents notices being displayed on WordPress 6.7 due to loading translations too early (only shown on stores with WP_DEBUG enabled).
* Fix - Prevent showing the shipping options on express checkout modal for virtual product variations.
* Fix - Do not assume payment is using a saved card when retrying a failed payment.
* Tweak - Update links to plugin documentation and Stripe documentation.

= 8.9.0 - 2024-11-14 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ public function save_payment_method_to_order( $order, $payment_method ) {
/**
* Retries the payment process once an error occured.
*
* @param object $intent The Payment Intent response from the Stripe API.
* @param object $response The response from the Stripe API.
* @param WC_Order $order An order that is being paid for.
* @param bool $retry A flag that indicates whether another retry should be attempted.
* @param bool $force_save_source Force save the payment source.
Expand All @@ -1424,7 +1424,7 @@ public function save_payment_method_to_order( $order, $payment_method ) {
* @throws WC_Stripe_Exception If the payment is not accepted.
* @return array|void
*/
public function retry_after_error( $intent, $order, $retry, $force_save_source = false, $previous_error = false, $use_order_source = false ) {
public function retry_after_error( $response, $order, $retry, $force_save_source = false, $previous_error = false, $use_order_source = false ) {
if ( ! $retry ) {
$localized_message = __( 'Sorry, we are unable to process your payment at this time. Please retry later.', 'woocommerce-gateway-stripe' );
$order->add_order_note( $localized_message );
Expand All @@ -1433,13 +1433,13 @@ public function retry_after_error( $intent, $order, $retry, $force_save_source =

// Don't do anymore retries after this.
if ( 5 <= $this->retry_interval ) {
return $this->process_payment_with_saved_payment_method( $order->get_id(), false );
return $this->process_payment( $order->get_id(), false, $force_save_source, $response->error, $previous_error );
}

sleep( $this->retry_interval );
$this->retry_interval++;

return $this->process_payment_with_saved_payment_method( $order->get_id(), true );
return $this->process_payment( $order->get_id(), true, $force_save_source, $response->error, $previous_error );
}

/**
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
* 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.
* Fix - Prevents notices being displayed on WordPress 6.7 due to loading translations too early (only shown on stores with WP_DEBUG enabled).
* Fix - Prevent showing the shipping options on express checkout modal for virtual product variations.
* Fix - Do not assume payment is using a saved card when retrying a failed payment.
* Tweak - Update links to plugin documentation and Stripe documentation.

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

0 comments on commit 9a75c56

Please sign in to comment.