diff --git a/modules/ppcp-webhooks/src/Handler/PaymentSaleCompleted.php b/modules/ppcp-webhooks/src/Handler/PaymentSaleCompleted.php index 54d63f2b1..6f5cb491d 100644 --- a/modules/ppcp-webhooks/src/Handler/PaymentSaleCompleted.php +++ b/modules/ppcp-webhooks/src/Handler/PaymentSaleCompleted.php @@ -94,7 +94,7 @@ class PaymentSaleCompleted implements RequestHandler { foreach ( $subscriptions as $subscription ) { $parent_order = wc_get_order( $subscription->get_parent() ); $transaction_id = wc_clean( wp_unslash( $request['resource']['id'] ?? '' ) ); - if ( $transaction_id && is_a( $parent_order, WC_Order::class ) ) { + if ( $transaction_id && is_string( $transaction_id ) && is_a( $parent_order, WC_Order::class ) ) { $this->update_transaction_id( $transaction_id, $parent_order, $this->logger ); } } diff --git a/modules/ppcp-webhooks/src/Handler/PaymentSaleRefunded.php b/modules/ppcp-webhooks/src/Handler/PaymentSaleRefunded.php index 99679f477..ff3c1dc6a 100644 --- a/modules/ppcp-webhooks/src/Handler/PaymentSaleRefunded.php +++ b/modules/ppcp-webhooks/src/Handler/PaymentSaleRefunded.php @@ -12,6 +12,7 @@ namespace WooCommerce\PayPalCommerce\Webhooks\Handler; use Psr\Log\LoggerInterface; use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundMetaTrait; use WooCommerce\PayPalCommerce\WcGateway\Processor\TransactionIdHandlingTrait; +use WP_Error; use WP_REST_Request; use WP_REST_Response; @@ -100,7 +101,7 @@ class PaymentSaleRefunded implements RequestHandler { ) ); - if ( is_wp_error( $refund ) ) { + if ( $refund instanceof WP_Error ) { $this->logger->warning( sprintf( // translators: %s is the order id.