Skip to content

Commit

Permalink
call process_payment function when retrying a payment
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayisha committed Nov 25, 2024
1 parent 09bac72 commit b041509
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit b041509

Please sign in to comment.