From f161ca7ec8296db412b104aa80de64e9eb94545d Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Fri, 15 Sep 2023 16:27:36 +0200 Subject: [PATCH] Move subscription id session clear to payment handlers --- modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php | 1 - modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php b/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php index 0cd9c2eed..a2a42a589 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php @@ -543,7 +543,6 @@ class PayPalGateway extends \WC_Payment_Gateway { } $wc_order->payment_complete(); - WC()->session->set( 'ppcp_subscription_id', '' ); return $this->handle_payment_success( $wc_order ); } diff --git a/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php b/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php index ab16ec178..d330a11a6 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php +++ b/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php @@ -77,6 +77,7 @@ trait ProcessPaymentTrait { } $this->session_handler->destroy_session_data(); + WC()->session->set( 'ppcp_subscription_id', '' ); wc_add_notice( $error->getMessage(), 'error' ); @@ -100,6 +101,7 @@ trait ProcessPaymentTrait { } $this->session_handler->destroy_session_data(); + WC()->session->set( 'ppcp_subscription_id', '' ); return array( 'result' => 'success',