Commit 3d0fa91475 for woocommerce

commit 3d0fa914750a2b48c6051b3d7660dd1dab91c3c5
Author: Mayisha <33387139+Mayisha@users.noreply.github.com>
Date:   Tue Dec 30 10:39:34 2025 +0600

    PayPal Standard Refactor 3: Move notice file under src folder (#62599)

    * add new notice class

    * deprecate the old notice class

    * use new notice class in gateway

    * move test under new class

    * Add changefile(s) from automation for the following project(s): woocommerce

    * use new constant in new notice class

    * fix lint

    * fix tests

    * use new const class to fix test failures

diff --git a/plugins/woocommerce/changelog/62599-refactor-paypal-standard-3-notice-file b/plugins/woocommerce/changelog/62599-refactor-paypal-standard-3-notice-file
new file mode 100644
index 0000000000..b8efc0edaf
--- /dev/null
+++ b/plugins/woocommerce/changelog/62599-refactor-paypal-standard-3-notice-file
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Deprecate WC_Gateway_Paypal_Notices class in favor of Automattic\WooCommerce\Gateways\PayPal\Notices class.
\ No newline at end of file
diff --git a/plugins/woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php b/plugins/woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php
index 456b5dbc47..7a352b2455 100644
--- a/plugins/woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php
+++ b/plugins/woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php
@@ -15,6 +15,7 @@ use Automattic\WooCommerce\Enums\PaymentGatewayFeature;
 use Automattic\Jetpack\Connection\Manager as Jetpack_Connection_Manager;
 use Automattic\WooCommerce\Gateways\PayPal\Constants as PayPalConstants;
 use Automattic\WooCommerce\Gateways\PayPal\Helper as PayPalHelper;
+use Automattic\WooCommerce\Gateways\PayPal\Notices as PayPalNotices;

 if ( ! defined( 'ABSPATH' ) ) {
 	exit;
@@ -24,10 +25,6 @@ if ( ! class_exists( 'WC_Gateway_Paypal_Buttons' ) ) {
 	require_once __DIR__ . '/class-wc-gateway-paypal-buttons.php';
 }

-if ( ! class_exists( 'WC_Gateway_Paypal_Notices' ) ) {
-	require_once __DIR__ . '/includes/class-wc-gateway-paypal-notices.php';
-}
-
 /**
  * WC_Gateway_Paypal Class.
  */
@@ -1029,7 +1026,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
 			return;
 		}

-		WC_Gateway_Paypal_Notices::manage_account_restriction_flag_for_notice( $http_code, $response_data, $order );
+		PayPalNotices::manage_account_restriction_flag_for_notice( $http_code, $response_data, $order );
 	}
 }

@@ -1042,6 +1039,6 @@ add_action(
 		}

 		include_once __DIR__ . '/includes/class-wc-gateway-paypal-notices.php';
-		new WC_Gateway_Paypal_Notices();
+		new PayPalNotices();
 	}
 );
diff --git a/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-notices.php b/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-notices.php
index d0612fab76..85b45ba146 100644
--- a/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-notices.php
+++ b/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-notices.php
@@ -2,6 +2,7 @@
 /**
  * PayPal Notices Class
  *
+ * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Notices instead. This class will be removed in 11.0.0.
  * @package WooCommerce\Gateways
  */

@@ -13,119 +14,51 @@ if ( ! defined( 'ABSPATH' ) ) {
 	exit;
 }

+use Automattic\WooCommerce\Gateways\PayPal\Notices as PayPalNotices;
+
 require_once __DIR__ . '/class-wc-gateway-paypal-helper.php';

 /**
  * Class WC_Gateway_Paypal_Notices.
  *
+ * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Notices instead. This class will be removed in 11.0.0.
  * @since 10.3.0
  */
 class WC_Gateway_Paypal_Notices {
 	/**
-	 * The name of the notice for PayPal migration.
+	 * The delegated notices instance.
 	 *
-	 * @since 10.4.0
-	 * @var string
+	 * @var PayPalNotices
 	 */
-	private const PAYPAL_MIGRATION_NOTICE = 'paypal_migration_completed';
-
-	/**
-	 * The name of the notice for PayPal account restriction.
-	 *
-	 * @since 10.4.0
-	 * @var string
-	 */
-	private const PAYPAL_ACCOUNT_RESTRICTED_NOTICE = 'paypal_account_restricted';
-
-	/**
-	 * The name of the notice for PayPal unsupported currency.
-	 *
-	 * @since 10.4.0
-	 * @var string
-	 */
-	private const PAYPAL_UNSUPPORTED_CURRENCY_NOTICE = 'paypal_unsupported_currency';
-
-	/**
-	 * PayPal account restriction issue codes from PayPal API.
-	 *
-	 * @since 10.4.0
-	 * @var array
-	 */
-	protected const PAYPAL_ACCOUNT_RESTRICTION_ISSUES = array(
-		PayPalConstants::PAYPAL_ISSUE_PAYEE_ACCOUNT_LOCKED_OR_CLOSED,
-		PayPalConstants::PAYPAL_ISSUE_PAYEE_ACCOUNT_RESTRICTED,
-	);
-
-	/**
-	 * The PayPal gateway instance.
-	 *
-	 * @var WC_Gateway_Paypal
-	 */
-	private $gateway;
-
+	private $notices;

 	/**
 	 * Constructor.
 	 */
 	public function __construct() {
-		$this->gateway = WC_Gateway_Paypal::get_instance();
-		if ( ! $this->gateway ) {
-			return;
-		}
-
-		// Only register admin notice hooks in the admin area.
-		if ( is_admin() ) {
-			add_action( 'admin_notices', array( $this, 'add_paypal_notices' ) );
-
-			// Use admin_head to inject notice on payments settings page.
-			// This bypasses the suppress_admin_notices() function which removes all admin_notices hooks on the payments page.
-			// This is a workaround to avoid the notice being suppressed by the suppress_admin_notices() function.
-			add_action( 'admin_head', array( $this, 'add_paypal_notices_on_payments_settings_page' ) );
-		}
+		$this->notices = new PayPalNotices();
 	}

 	/**
 	 * Add PayPal Standard notices.
 	 *
+	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Notices::add_paypal_notices() instead.
 	 * @since 10.4.0
 	 * @return void
 	 */
 	public function add_paypal_notices() {
-		// Show only to users who can manage the site.
-		if ( ! current_user_can( 'manage_woocommerce' ) && ! current_user_can( 'manage_options' ) ) {
-			return;
-		}
-
-		// Skip if the gateway is not available or the merchant has not been onboarded.
-		if ( ! WC_Gateway_Paypal_Helper::is_paypal_gateway_available() || ! $this->gateway->should_use_orders_v2() ) {
-			return;
-		}
-
-		$this->add_paypal_migration_notice();
-		$this->add_paypal_account_restricted_notice();
-		$this->add_paypal_unsupported_currency_notice();
+		$this->notices->add_paypal_notices();
 	}

 	/**
 	 * Add PayPal notices on the payments settings page.
 	 *
+	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Notices::add_paypal_notices_on_payments_settings_page() instead.
 	 * @since 10.4.0
 	 * @return void
 	 */
 	public function add_paypal_notices_on_payments_settings_page() {
-		global $current_tab, $current_section;
-
-		$screen    = get_current_screen();
-		$screen_id = $screen ? $screen->id : '';
-
-		$is_payments_settings_page = 'woocommerce_page_wc-settings' === $screen_id && 'checkout' === $current_tab && empty( $current_section );
-
-		// Only add the notice from this callback on the payments settings page.
-		if ( ! $is_payments_settings_page ) {
-			return;
-		}
-
-		$this->add_paypal_notices();
+		$this->notices->add_paypal_notices_on_payments_settings_page();
 	}

 	/**
@@ -142,132 +75,12 @@ class WC_Gateway_Paypal_Notices {
 	/**
 	 * Add notice warning about the migration to PayPal Payments.
 	 *
+	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Notices::add_paypal_migration_notice() instead.
 	 * @since 10.3.0
 	 * @return void
 	 */
 	public function add_paypal_migration_notice() {
-		// Skip if the notice has been dismissed.
-		if ( $this->is_notice_dismissed( self::PAYPAL_MIGRATION_NOTICE ) ) {
-			return;
-		}
-
-		$doc_url     = 'https://woocommerce.com/document/woocommerce-paypal-payments/paypal-payments-upgrade-guide/';
-		$dismiss_url = $this->get_dismiss_url( self::PAYPAL_MIGRATION_NOTICE );
-		$message     = sprintf(
-			/* translators: 1: opening <a> tag, 2: closing </a> tag */
-			esc_html__( 'WooCommerce has upgraded your PayPal integration from PayPal Standard to PayPal Payments (PPCP), for a more reliable and modern checkout experience. If you do not prefer the upgraded integration in WooCommerce, we recommend switching to %1$sPayPal Payments%2$s extension.', 'woocommerce' ),
-			'<a href="' . esc_url( $doc_url ) . '" target="_blank" rel="noopener noreferrer">',
-			'</a>',
-		);
-
-		$notice_html = '<div class="notice notice-warning is-dismissible">'
-			. '<a class="woocommerce-message-close notice-dismiss" style="text-decoration: none;" href="' . esc_url( $dismiss_url ) . '" aria-label="' . esc_attr__( 'Dismiss this notice', 'woocommerce' ) . '"></a>'
-			. '<p>' . $message . '</p>'
-			. '</div>';
-
-		echo wp_kses_post( $notice_html );
-	}
-
-	/**
-	 * Add notice warning about PayPal account restriction.
-	 *
-	 * @since 10.4.0
-	 * @return void
-	 */
-	private function add_paypal_account_restricted_notice() {
-		// Skip if there's no account restriction flag.
-		if ( ! $this->has_account_restriction_flag() ) {
-			return;
-		}
-
-		// Skip if the notice has been dismissed.
-		if ( $this->is_notice_dismissed( self::PAYPAL_ACCOUNT_RESTRICTED_NOTICE ) ) {
-			return;
-		}
-
-		$support_url = 'https://www.paypal.com/smarthelp/contact-us';
-		$dismiss_url = $this->get_dismiss_url( self::PAYPAL_ACCOUNT_RESTRICTED_NOTICE );
-		$message     = sprintf(
-			/* translators: 1: opening <a> tag, 2: closing </a> tag */
-			esc_html__( 'Your PayPal account has been restricted by PayPal. This may prevent customers from completing payments. Please %1$scontact PayPal support%2$s to resolve this issue and restore full functionality to your account.', 'woocommerce' ),
-			'<a href="' . esc_url( $support_url ) . '" target="_blank" rel="noopener noreferrer">',
-			'</a>',
-		);
-
-		$notice_html = '<div class="notice notice-error is-dismissible">'
-			. '<a class="woocommerce-message-close notice-dismiss" style="text-decoration: none;" href="' . esc_url( $dismiss_url ) . '" aria-label="' . esc_attr__( 'Dismiss this notice', 'woocommerce' ) . '"></a>'
-			. '<p><strong>' . esc_html__( 'PayPal Account Restricted', 'woocommerce' ) . '</strong></p>'
-			. '<p>' . $message . '</p>'
-			. '</div>';
-
-		echo wp_kses_post( $notice_html );
-	}
-
-	/**
-	 * Add notice warning when PayPal does not support the store's currency.
-	 *
-	 * @since 10.4.0
-	 * @return void
-	 */
-	private function add_paypal_unsupported_currency_notice() {
-		$currency = get_woocommerce_currency();
-
-		// Skip if the currency is supported by PayPal.
-		if ( $this->gateway->is_valid_for_use() ) {
-			return;
-		}
-
-		// Skip if the notice has been dismissed.
-		if ( $this->is_notice_dismissed( self::PAYPAL_UNSUPPORTED_CURRENCY_NOTICE ) ) {
-			return;
-		}
-
-		$dismiss_url = $this->get_dismiss_url( self::PAYPAL_UNSUPPORTED_CURRENCY_NOTICE );
-		$message     = sprintf(
-			/* translators: %s: Currency code */
-			esc_html__( 'PayPal Standard does not support your store currency (%s).', 'woocommerce' ),
-			$currency
-		);
-
-		$notice_html = '<div class="notice notice-error is-dismissible">'
-			. '<a class="woocommerce-message-close notice-dismiss" style="text-decoration: none;" href="' . esc_url( $dismiss_url ) . '" aria-label="' . esc_attr__( 'Dismiss this notice', 'woocommerce' ) . '"></a>'
-			. '<p>' . $message . '</p>'
-			. '</div>';
-
-		echo wp_kses_post( $notice_html );
-	}
-
-	/**
-	 * Get the dismiss URL for a notice.
-	 *
-	 * @since 10.4.0
-	 * @param string $notice_name The name of the notice.
-	 * @return string
-	 */
-	private function get_dismiss_url( string $notice_name ): string {
-		return wp_nonce_url(
-			add_query_arg( 'wc-hide-notice', $notice_name ),
-			'woocommerce_hide_notices_nonce',
-			'_wc_notice_nonce'
-		);
-	}
-
-	/**
-	 * Check if the notice has been dismissed.
-	 *
-	 * User meta keys for notice dismissals:
-	 * - dismissed_paypal_migration_completed_notice
-	 * - dismissed_paypal_account_restricted_notice
-	 * - dismissed_paypal_unsupported_currency_notice
-	 *
-	 * The meta keys are set by WC_Admin_Notices when the notice is dismissed by the user.
-	 *
-	 * @since 10.4.0
-	 * @param string $notice_name The name of the notice.
-	 * @return bool
-	 */
-	private function is_notice_dismissed( string $notice_name ): bool {
-		return (bool) get_user_meta( get_current_user_id(), 'dismissed_' . $notice_name . '_notice', true );
+		$this->notices->add_paypal_migration_notice();
 	}

 	/**
@@ -281,43 +94,32 @@ class WC_Gateway_Paypal_Notices {
 		return (bool) get_user_meta( get_current_user_id(), 'dismissed_paypal_migration_completed_notice', true );
 	}

-	/**
-	 * Check if there's a flag indicating PayPal account restriction.
-	 *
-	 * @since 10.4.0
-	 * @return bool
-	 */
-	private function has_account_restriction_flag(): bool {
-		return 'yes' === get_option( 'woocommerce_paypal_account_restricted_status', 'no' );
-	}
-
 	/**
 	 * Set the flag indicating PayPal account restriction.
 	 *
+	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Notices::set_account_restriction_flag() instead.
 	 * @since 10.4.0
 	 * @return void
 	 */
 	public static function set_account_restriction_flag(): void {
-		if ( 'no' === get_option( 'woocommerce_paypal_account_restricted_status', 'no' ) ) {
-			update_option( 'woocommerce_paypal_account_restricted_status', 'yes', false );
-		}
+		PayPalNotices::set_account_restriction_flag();
 	}

 	/**
 	 * Clear the flag indicating PayPal account restriction.
 	 *
+	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Notices::clear_account_restriction_flag() instead.
 	 * @since 10.4.0
 	 * @return void
 	 */
 	public static function clear_account_restriction_flag(): void {
-		if ( 'yes' === get_option( 'woocommerce_paypal_account_restricted_status', 'no' ) ) {
-			update_option( 'woocommerce_paypal_account_restricted_status', 'no' );
-		}
+		PayPalNotices::clear_account_restriction_flag();
 	}

 	/**
 	 * Handle PayPal order response to manage account restriction notices.
 	 *
+	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Notices::manage_account_restriction_flag_for_notice() instead.
 	 * @since 10.4.0
 	 * @param int|string $http_code     The HTTP status code from the PayPal API response.
 	 * @param array      $response_data The decoded response data from the PayPal API.
@@ -325,24 +127,6 @@ class WC_Gateway_Paypal_Notices {
 	 * @return void
 	 */
 	public static function manage_account_restriction_flag_for_notice( $http_code, array $response_data, WC_Order $order ): void {
-		// Clear the restriction flag on successful responses.
-		if ( in_array( (int) $http_code, array( 200, 201 ), true ) ) {
-			self::clear_account_restriction_flag();
-			return;
-		}
-
-		if ( empty( $response_data ) ) {
-			return;
-		}
-
-		// Set the restriction flag for account-related errors.
-		if ( 422 === (int) $http_code ) {
-			$issue = isset( $response_data['details'][0]['issue'] ) ? $response_data['details'][0]['issue'] : '';
-
-			if ( in_array( $issue, self::PAYPAL_ACCOUNT_RESTRICTION_ISSUES, true ) ) {
-				WC_Gateway_Paypal::log( 'PayPal account restriction flag set due to issues when handling the order: ' . $order->get_id() );
-				self::set_account_restriction_flag();
-			}
-		}
+		PayPalNotices::manage_account_restriction_flag_for_notice( $http_code, $response_data, $order );
 	}
 }
diff --git a/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php b/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php
index 37223ffe70..1e7fd53ae3 100644
--- a/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php
+++ b/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php
@@ -131,7 +131,7 @@ class WC_Gateway_Paypal_Request {
 	 */
 	public function create_paypal_order(
 		$order,
-		$payment_source = WC_Gateway_Paypal_Constants::PAYMENT_SOURCE_PAYPAL,
+		$payment_source = PayPalConstants::PAYMENT_SOURCE_PAYPAL,
 		$js_sdk_params = array()
 	) {
 		$paypal_debug_id = null;
@@ -140,8 +140,8 @@ class WC_Gateway_Paypal_Request {
 		// Orders v2 API does not accept it. We will use 'paypal' instead.
 		// Accepted payment_source values for Orders v2:
 		// https://developer.paypal.com/docs/api/orders/v2/#orders_create!ct=application/json&path=payment_source&t=request.
-		if ( WC_Gateway_Paypal_Constants::PAYMENT_SOURCE_PAYLATER === $payment_source ) {
-			$payment_source = WC_Gateway_Paypal_Constants::PAYMENT_SOURCE_PAYPAL;
+		if ( PayPalConstants::PAYMENT_SOURCE_PAYLATER === $payment_source ) {
+			$payment_source = PayPalConstants::PAYMENT_SOURCE_PAYPAL;
 		}

 		try {
@@ -265,7 +265,7 @@ class WC_Gateway_Paypal_Request {
 	 * @return void
 	 * @throws Exception If the PayPal payment authorization or capture fails.
 	 */
-	public function authorize_or_capture_payment( $order, $action_url, $action = WC_Gateway_Paypal_Constants::PAYMENT_ACTION_CAPTURE ) {
+	public function authorize_or_capture_payment( $order, $action_url, $action = PayPalConstants::PAYMENT_ACTION_CAPTURE ) {
 		$paypal_debug_id = null;
 		$paypal_order_id = $order->get_meta( '_paypal_order_id' );
 		if ( ! $paypal_order_id ) {
@@ -279,13 +279,13 @@ class WC_Gateway_Paypal_Request {
 		}

 		// Skip if the payment is already captured.
-		if ( WC_Gateway_Paypal_Constants::STATUS_COMPLETED === $order->get_meta( '_paypal_status', true ) ) {
+		if ( PayPalConstants::STATUS_COMPLETED === $order->get_meta( '_paypal_status', true ) ) {
 			WC_Gateway_Paypal::log( 'PayPal payment is already captured. Skipping capture. Order ID: ' . $order->get_id() );
 			return;
 		}

 		try {
-			if ( WC_Gateway_Paypal_Constants::PAYMENT_ACTION_CAPTURE === $action ) {
+			if ( PayPalConstants::PAYMENT_ACTION_CAPTURE === $action ) {
 				$endpoint     = self::WPCOM_PROXY_PAYMENT_CAPTURE_ENDPOINT;
 				$request_body = array(
 					'capture_url'     => $action_url,
@@ -369,19 +369,19 @@ class WC_Gateway_Paypal_Request {
 		$paypal_status = $order->get_meta( '_paypal_status', true );

 		// Skip if the payment is already captured.
-		if ( WC_Gateway_Paypal_Constants::STATUS_CAPTURED === $paypal_status || WC_Gateway_Paypal_Constants::STATUS_COMPLETED === $paypal_status ) {
+		if ( PayPalConstants::STATUS_CAPTURED === $paypal_status || PayPalConstants::STATUS_COMPLETED === $paypal_status ) {
 			WC_Gateway_Paypal::log( 'PayPal payment is already captured. Skipping capture. Order ID: ' . $order->get_id() );
 			return;
 		}

 		// Skip if the payment requires payer action.
-		if ( WC_Gateway_Paypal_Constants::STATUS_PAYER_ACTION_REQUIRED === $paypal_status ) {
+		if ( PayPalConstants::STATUS_PAYER_ACTION_REQUIRED === $paypal_status ) {
 			WC_Gateway_Paypal::log( 'PayPal payment requires payer action. Skipping capture. Order ID: ' . $order->get_id() );
 			return;
 		}

 		// Skip if the payment is voided.
-		if ( WC_Gateway_Paypal_Constants::VOIDED === $paypal_status ) {
+		if ( PayPalConstants::VOIDED === $paypal_status ) {
 			WC_Gateway_Paypal::log( 'PayPal payment voided. Skipping capture. Order ID: ' . $order->get_id() );
 			return;
 		}
@@ -503,7 +503,7 @@ class WC_Gateway_Paypal_Request {
 				if ( $capture_data && isset( $capture_data['id'] ) ) {
 					$capture_id = $capture_data['id'];
 					$order->update_meta_data( '_paypal_capture_id', $capture_id );
-					$order->update_meta_data( '_paypal_status', $capture_data['status'] ?? WC_Gateway_Paypal_Constants::STATUS_CAPTURED );
+					$order->update_meta_data( '_paypal_status', $capture_data['status'] ?? PayPalConstants::STATUS_CAPTURED );
 					$order->save();
 					WC_Gateway_Paypal::log( 'Storing capture ID from Paypal. Order ID: ' . $order->get_id() . '; capture ID: ' . $capture_id );
 					return null;
@@ -511,14 +511,14 @@ class WC_Gateway_Paypal_Request {

 				if ( $authorization_data && isset( $authorization_data['id'], $authorization_data['status'] ) ) {
 					// If the payment is already captured, return null as there is no authorization ID that needs to be captured.
-					if ( WC_Gateway_Paypal_Constants::STATUS_CAPTURED === $authorization_data['status'] ) {
-						$order->update_meta_data( '_paypal_status', WC_Gateway_Paypal_Constants::STATUS_CAPTURED );
+					if ( PayPalConstants::STATUS_CAPTURED === $authorization_data['status'] ) {
+						$order->update_meta_data( '_paypal_status', PayPalConstants::STATUS_CAPTURED );
 						$order->save();
 						return null;
 					}
 					$authorization_id = $authorization_data['id'];
 					$order->update_meta_data( '_paypal_authorization_id', $authorization_id );
-					$order->update_meta_data( '_paypal_status', WC_Gateway_Paypal_Constants::STATUS_AUTHORIZED );
+					$order->update_meta_data( '_paypal_status', PayPalConstants::STATUS_AUTHORIZED );
 					WC_Gateway_Paypal::log( 'Storing authorization ID from Paypal. Order ID: ' . $order->get_id() . '; authorization ID: ' . $authorization_id );
 					$order->save();
 				} else {
@@ -576,7 +576,7 @@ class WC_Gateway_Paypal_Request {
 	 */
 	private function get_approve_link( $http_code, $response_data ) {
 		// See https://developer.paypal.com/docs/api/orders/v2/#orders_create.
-		if ( isset( $response_data['status'] ) && WC_Gateway_Paypal_Constants::STATUS_PAYER_ACTION_REQUIRED === $response_data['status'] ) {
+		if ( isset( $response_data['status'] ) && PayPalConstants::STATUS_PAYER_ACTION_REQUIRED === $response_data['status'] ) {
 			$rel = 'payer-action';
 		} else {
 			$rel = 'approve';
@@ -615,7 +615,7 @@ class WC_Gateway_Paypal_Request {
 		 */
 		$supported_currencies = apply_filters(
 			'woocommerce_paypal_supported_currencies',
-			WC_Gateway_Paypal_Constants::SUPPORTED_CURRENCIES
+			PayPalConstants::SUPPORTED_CURRENCIES
 		);
 		if ( ! in_array( strtoupper( $order->get_currency() ), $supported_currencies, true ) ) {
 			throw new Exception( 'Currency is not supported by PayPal. Order ID: ' . esc_html( $order->get_id() ) );
@@ -637,7 +637,7 @@ class WC_Gateway_Paypal_Request {

 		$src_locale = get_locale();
 		// If the locale is longer than PayPal's string limit (10).
-		if ( strlen( $src_locale ) > WC_Gateway_Paypal_Constants::PAYPAL_LOCALE_MAX_LENGTH ) {
+		if ( strlen( $src_locale ) > PayPalConstants::PAYPAL_LOCALE_MAX_LENGTH ) {
 			// Keep only the main language and region parts.
 			$locale_parts = explode( '_', $src_locale );
 			if ( count( $locale_parts ) > 2 ) {
@@ -650,7 +650,7 @@ class WC_Gateway_Paypal_Request {
 			'payment_source' => array(
 				$payment_source => array(
 					'experience_context' => array(
-						'user_action'           => WC_Gateway_Paypal_Constants::USER_ACTION_PAY_NOW,
+						'user_action'           => PayPalConstants::USER_ACTION_PAY_NOW,
 						'shipping_preference'   => $shipping_preference,
 						// Customer redirected here on approval.
 						'return_url'            => $this->normalize_url_for_paypal( add_query_arg( 'utm_nooverride', '1', $this->gateway->get_return_url( $order ) ) ),
@@ -668,7 +668,7 @@ class WC_Gateway_Paypal_Request {
 				array(
 					'custom_id'  => $this->get_paypal_order_custom_id( $order ),
 					'amount'     => $purchase_unit_amount,
-					'invoice_id' => $this->limit_length( $this->gateway->get_option( 'invoice_prefix' ) . $order->get_order_number(), WC_Gateway_Paypal_Constants::PAYPAL_INVOICE_ID_MAX_LENGTH ),
+					'invoice_id' => $this->limit_length( $this->gateway->get_option( 'invoice_prefix' ) . $order->get_order_number(), PayPalConstants::PAYPAL_INVOICE_ID_MAX_LENGTH ),
 					'items'      => $order_items,
 					'payee'      => array(
 						'email_address' => $payee_email,
@@ -680,8 +680,8 @@ class WC_Gateway_Paypal_Request {
 		if ( ! in_array(
 			$shipping_preference,
 			array(
-				WC_Gateway_Paypal_Constants::SHIPPING_NO_SHIPPING,
-				WC_Gateway_Paypal_Constants::SHIPPING_SET_PROVIDED_ADDRESS,
+				PayPalConstants::SHIPPING_NO_SHIPPING,
+				PayPalConstants::SHIPPING_SET_PROVIDED_ADDRESS,
 			),
 			true
 		) ) {
@@ -802,7 +802,7 @@ class WC_Gateway_Paypal_Request {
 			}

 			$items[] = array(
-				'name'        => $this->limit_length( $item->get_name(), WC_Gateway_Paypal_Constants::PAYPAL_ORDER_ITEM_NAME_MAX_LENGTH ),
+				'name'        => $this->limit_length( $item->get_name(), PayPalConstants::PAYPAL_ORDER_ITEM_NAME_MAX_LENGTH ),
 				'quantity'    => $item->get_quantity(),
 				'unit_amount' => array(
 					'currency_code' => $order->get_currency(),
@@ -853,10 +853,10 @@ class WC_Gateway_Paypal_Request {
 	private function get_paypal_order_intent() {
 		$payment_action = $this->gateway->get_option( 'paymentaction' );
 		if ( 'authorization' === $payment_action ) {
-			return WC_Gateway_Paypal_Constants::INTENT_AUTHORIZE;
+			return PayPalConstants::INTENT_AUTHORIZE;
 		}

-		return WC_Gateway_Paypal_Constants::INTENT_CAPTURE;
+		return PayPalConstants::INTENT_CAPTURE;
 	}

 	/**
@@ -867,11 +867,11 @@ class WC_Gateway_Paypal_Request {
 	 */
 	private function get_paypal_shipping_preference( $order ) {
 		if ( ! $order->needs_shipping() ) {
-			return WC_Gateway_Paypal_Constants::SHIPPING_NO_SHIPPING;
+			return PayPalConstants::SHIPPING_NO_SHIPPING;
 		}

 		$address_override = $this->gateway->get_option( 'address_override' ) === 'yes';
-		return $address_override ? WC_Gateway_Paypal_Constants::SHIPPING_SET_PROVIDED_ADDRESS : WC_Gateway_Paypal_Constants::SHIPPING_GET_FROM_FILE;
+		return $address_override ? PayPalConstants::SHIPPING_SET_PROVIDED_ADDRESS : PayPalConstants::SHIPPING_GET_FROM_FILE;
 	}

 	/**
@@ -933,11 +933,11 @@ class WC_Gateway_Paypal_Request {
 				'full_name' => $full_name,
 			),
 			'address' => array(
-				'address_line_1' => $this->limit_length( $address_line_1, WC_Gateway_Paypal_Constants::PAYPAL_ADDRESS_LINE_MAX_LENGTH ),
-				'address_line_2' => $this->limit_length( $address_line_2, WC_Gateway_Paypal_Constants::PAYPAL_ADDRESS_LINE_MAX_LENGTH ),
-				'admin_area_1'   => $this->limit_length( $state, WC_Gateway_Paypal_Constants::PAYPAL_STATE_MAX_LENGTH ),
-				'admin_area_2'   => $this->limit_length( $city, WC_Gateway_Paypal_Constants::PAYPAL_CITY_MAX_LENGTH ),
-				'postal_code'    => $this->limit_length( $postcode, WC_Gateway_Paypal_Constants::PAYPAL_POSTAL_CODE_MAX_LENGTH ),
+				'address_line_1' => $this->limit_length( $address_line_1, PayPalConstants::PAYPAL_ADDRESS_LINE_MAX_LENGTH ),
+				'address_line_2' => $this->limit_length( $address_line_2, PayPalConstants::PAYPAL_ADDRESS_LINE_MAX_LENGTH ),
+				'admin_area_1'   => $this->limit_length( $state, PayPalConstants::PAYPAL_STATE_MAX_LENGTH ),
+				'admin_area_2'   => $this->limit_length( $city, PayPalConstants::PAYPAL_CITY_MAX_LENGTH ),
+				'postal_code'    => $this->limit_length( $postcode, PayPalConstants::PAYPAL_POSTAL_CODE_MAX_LENGTH ),
 				'country_code'   => strtoupper( $country ),
 			),
 		);
@@ -954,7 +954,7 @@ class WC_Gateway_Paypal_Request {
 		$code = strtoupper( trim( (string) $country_code ) );

 		// Check if it's a valid alpha-2 code.
-		if ( strlen( $code ) === WC_Gateway_Paypal_Constants::PAYPAL_COUNTRY_CODE_LENGTH ) {
+		if ( strlen( $code ) === PayPalConstants::PAYPAL_COUNTRY_CODE_LENGTH ) {
 			if ( WC()->countries->country_exists( $code ) ) {
 				return $code;
 			}
@@ -967,7 +967,7 @@ class WC_Gateway_Paypal_Request {
 		WC_Gateway_Paypal::log( sprintf( 'Unexpected country code length (%d) for country: %s', strlen( $code ), $code ) );

 		// Truncate to the expected maximum length (3).
-		$max_country_code_length = WC_Gateway_Paypal_Constants::PAYPAL_COUNTRY_CODE_LENGTH + 1;
+		$max_country_code_length = PayPalConstants::PAYPAL_COUNTRY_CODE_LENGTH + 1;
 		if ( strlen( $code ) > $max_country_code_length ) {
 			$code = substr( $code, 0, $max_country_code_length );
 		}
@@ -1077,7 +1077,7 @@ class WC_Gateway_Paypal_Request {
 					'User-Agent'   => 'TransactGateway/woocommerce/' . WC()->version,
 				),
 				'method'  => $method,
-				'timeout' => WC_Gateway_Paypal_Constants::WPCOM_PROXY_REQUEST_TIMEOUT,
+				'timeout' => PayPalConstants::WPCOM_PROXY_REQUEST_TIMEOUT,
 			),
 			'GET' === $method ? null : wp_json_encode( $request_body ),
 			'wpcom'
@@ -1125,7 +1125,7 @@ class WC_Gateway_Paypal_Request {
 				'cancel_return' => esc_url_raw( $order->get_cancel_order_url_raw() ),
 				'image_url'     => esc_url_raw( $this->gateway->get_option( 'image_url' ) ),
 				'paymentaction' => $this->gateway->get_option( 'paymentaction' ),
-				'invoice'       => $this->limit_length( $this->gateway->get_option( 'invoice_prefix' ) . $order->get_order_number(), WC_Gateway_Paypal_Constants::PAYPAL_INVOICE_ID_MAX_LENGTH ),
+				'invoice'       => $this->limit_length( $this->gateway->get_option( 'invoice_prefix' ) . $order->get_order_number(), PayPalConstants::PAYPAL_INVOICE_ID_MAX_LENGTH ),
 				'custom'        => wp_json_encode(
 					array(
 						'order_id'  => $order->get_id(),
diff --git a/plugins/woocommerce/src/Gateways/PayPal/Notices.php b/plugins/woocommerce/src/Gateways/PayPal/Notices.php
new file mode 100644
index 0000000000..eb2d61e092
--- /dev/null
+++ b/plugins/woocommerce/src/Gateways/PayPal/Notices.php
@@ -0,0 +1,322 @@
+<?php
+
+declare( strict_types=1 );
+
+namespace Automattic\WooCommerce\Gateways\PayPal;
+
+use WC_Order;
+use Automattic\WooCommerce\Gateways\PayPal\Helper as PayPalHelper;
+
+defined( 'ABSPATH' ) || exit;
+
+/**
+ * PayPal Notices Class
+ *
+ * Handles admin notices for PayPal gateway including migration notices,
+ * account restriction warnings, and currency support notifications.
+ *
+ * @since 10.5.0
+ */
+class Notices {
+	/**
+	 * The name of the notice for PayPal migration.
+	 *
+	 * @since 10.5.0
+	 * @var string
+	 */
+	private const PAYPAL_MIGRATION_NOTICE = 'paypal_migration_completed';
+
+	/**
+	 * The name of the notice for PayPal account restriction.
+	 *
+	 * @since 10.5.0
+	 * @var string
+	 */
+	private const PAYPAL_ACCOUNT_RESTRICTED_NOTICE = 'paypal_account_restricted';
+
+	/**
+	 * The name of the notice for PayPal unsupported currency.
+	 *
+	 * @since 10.5.0
+	 * @var string
+	 */
+	private const PAYPAL_UNSUPPORTED_CURRENCY_NOTICE = 'paypal_unsupported_currency';
+
+	/**
+	 * PayPal account restriction issue codes from PayPal API.
+	 *
+	 * @since 10.5.0
+	 * @var array
+	 */
+	protected const PAYPAL_ACCOUNT_RESTRICTION_ISSUES = array(
+		Constants::PAYPAL_ISSUE_PAYEE_ACCOUNT_LOCKED_OR_CLOSED,
+		Constants::PAYPAL_ISSUE_PAYEE_ACCOUNT_RESTRICTED,
+	);
+
+	/**
+	 * The PayPal gateway instance.
+	 *
+	 * @var \WC_Gateway_Paypal
+	 */
+	private $gateway;
+
+	/**
+	 * Constructor.
+	 */
+	public function __construct() {
+		$this->gateway = \WC_Gateway_Paypal::get_instance();
+		if ( ! $this->gateway ) {
+			return;
+		}
+
+		// Only register admin notice hooks in the admin area.
+		if ( is_admin() ) {
+			add_action( 'admin_notices', array( $this, 'add_paypal_notices' ) );
+
+			// Use admin_head to inject notice on payments settings page.
+			// This bypasses the suppress_admin_notices() function which removes all admin_notices hooks on the payments page.
+			// This is a workaround to avoid the notice being suppressed by the suppress_admin_notices() function.
+			add_action( 'admin_head', array( $this, 'add_paypal_notices_on_payments_settings_page' ) );
+		}
+	}
+
+	/**
+	 * Add PayPal Standard notices.
+	 *
+	 * @since 10.5.0
+	 * @return void
+	 */
+	public function add_paypal_notices(): void {
+		// Show only to users who can manage the site.
+		if ( ! current_user_can( 'manage_woocommerce' ) && ! current_user_can( 'manage_options' ) ) {
+			return;
+		}
+
+		// Skip if the gateway is not available or the merchant has not been onboarded.
+		if ( ! PayPalHelper::is_paypal_gateway_available() || ! $this->gateway->should_use_orders_v2() ) {
+			return;
+		}
+
+		$this->add_paypal_migration_notice();
+		$this->add_paypal_account_restricted_notice();
+		$this->add_paypal_unsupported_currency_notice();
+	}
+
+	/**
+	 * Add PayPal notices on the payments settings page.
+	 *
+	 * @since 10.5.0
+	 * @return void
+	 */
+	public function add_paypal_notices_on_payments_settings_page(): void {
+		global $current_tab, $current_section;
+
+		$screen    = get_current_screen();
+		$screen_id = $screen ? $screen->id : '';
+
+		$is_payments_settings_page = 'woocommerce_page_wc-settings' === $screen_id && 'checkout' === $current_tab && empty( $current_section );
+
+		// Only add the notice from this callback on the payments settings page.
+		if ( ! $is_payments_settings_page ) {
+			return;
+		}
+
+		$this->add_paypal_notices();
+	}
+
+	/**
+	 * Add notice warning about the migration to PayPal Payments.
+	 *
+	 * @since 10.5.0
+	 * @return void
+	 */
+	public function add_paypal_migration_notice(): void {
+		// Skip if the notice has been dismissed.
+		if ( $this->is_notice_dismissed( self::PAYPAL_MIGRATION_NOTICE ) ) {
+			return;
+		}
+
+		$doc_url     = 'https://woocommerce.com/document/woocommerce-paypal-payments/paypal-payments-upgrade-guide/';
+		$dismiss_url = $this->get_dismiss_url( self::PAYPAL_MIGRATION_NOTICE );
+		$message     = sprintf(
+			/* translators: 1: opening <a> tag, 2: closing </a> tag */
+			esc_html__( 'WooCommerce has upgraded your PayPal integration from PayPal Standard to PayPal Payments (PPCP), for a more reliable and modern checkout experience. If you do not prefer the upgraded integration in WooCommerce, we recommend switching to %1$sPayPal Payments%2$s extension.', 'woocommerce' ),
+			'<a href="' . esc_url( $doc_url ) . '" target="_blank" rel="noopener noreferrer">',
+			'</a>',
+		);
+
+		$notice_html = '<div class="notice notice-warning is-dismissible">'
+			. '<a class="woocommerce-message-close notice-dismiss" style="text-decoration: none;" href="' . esc_url( $dismiss_url ) . '" aria-label="' . esc_attr__( 'Dismiss this notice', 'woocommerce' ) . '"></a>'
+			. '<p>' . $message . '</p>'
+			. '</div>';
+
+		echo wp_kses_post( $notice_html );
+	}
+
+	/**
+	 * Add notice warning about PayPal account restriction.
+	 *
+	 * @since 10.5.0
+	 * @return void
+	 */
+	private function add_paypal_account_restricted_notice(): void {
+		// Skip if there's no account restriction flag.
+		if ( ! $this->has_account_restriction_flag() ) {
+			return;
+		}
+
+		// Skip if the notice has been dismissed.
+		if ( $this->is_notice_dismissed( self::PAYPAL_ACCOUNT_RESTRICTED_NOTICE ) ) {
+			return;
+		}
+
+		$support_url = 'https://www.paypal.com/smarthelp/contact-us';
+		$dismiss_url = $this->get_dismiss_url( self::PAYPAL_ACCOUNT_RESTRICTED_NOTICE );
+		$message     = sprintf(
+			/* translators: 1: opening <a> tag, 2: closing </a> tag */
+			esc_html__( 'Your PayPal account has been restricted by PayPal. This may prevent customers from completing payments. Please %1$scontact PayPal support%2$s to resolve this issue and restore full functionality to your account.', 'woocommerce' ),
+			'<a href="' . esc_url( $support_url ) . '" target="_blank" rel="noopener noreferrer">',
+			'</a>',
+		);
+
+		$notice_html = '<div class="notice notice-error is-dismissible">'
+			. '<a class="woocommerce-message-close notice-dismiss" style="text-decoration: none;" href="' . esc_url( $dismiss_url ) . '" aria-label="' . esc_attr__( 'Dismiss this notice', 'woocommerce' ) . '"></a>'
+			. '<p><strong>' . esc_html__( 'PayPal Account Restricted', 'woocommerce' ) . '</strong></p>'
+			. '<p>' . $message . '</p>'
+			. '</div>';
+
+		echo wp_kses_post( $notice_html );
+	}
+
+	/**
+	 * Add notice warning when PayPal does not support the store's currency.
+	 *
+	 * @since 10.5.0
+	 * @return void
+	 */
+	private function add_paypal_unsupported_currency_notice(): void {
+		$currency = get_woocommerce_currency();
+
+		// Skip if the currency is supported by PayPal.
+		if ( $this->gateway->is_valid_for_use() ) {
+			return;
+		}
+
+		// Skip if the notice has been dismissed.
+		if ( $this->is_notice_dismissed( self::PAYPAL_UNSUPPORTED_CURRENCY_NOTICE ) ) {
+			return;
+		}
+
+		$dismiss_url = $this->get_dismiss_url( self::PAYPAL_UNSUPPORTED_CURRENCY_NOTICE );
+		$message     = sprintf(
+			/* translators: %s: Currency code */
+			esc_html__( 'PayPal Standard does not support your store currency (%s).', 'woocommerce' ),
+			$currency
+		);
+
+		$notice_html = '<div class="notice notice-error is-dismissible">'
+			. '<a class="woocommerce-message-close notice-dismiss" style="text-decoration: none;" href="' . esc_url( $dismiss_url ) . '" aria-label="' . esc_attr__( 'Dismiss this notice', 'woocommerce' ) . '"></a>'
+			. '<p>' . $message . '</p>'
+			. '</div>';
+
+		echo wp_kses_post( $notice_html );
+	}
+
+	/**
+	 * Get the dismiss URL for a notice.
+	 *
+	 * @since 10.5.0
+	 * @param string $notice_name The name of the notice.
+	 * @return string
+	 */
+	private function get_dismiss_url( string $notice_name ): string {
+		return wp_nonce_url(
+			add_query_arg( 'wc-hide-notice', $notice_name ),
+			'woocommerce_hide_notices_nonce',
+			'_wc_notice_nonce'
+		);
+	}
+
+	/**
+	 * Check if the notice has been dismissed.
+	 *
+	 * User meta keys for notice dismissals:
+	 * - dismissed_paypal_migration_completed_notice
+	 * - dismissed_paypal_account_restricted_notice
+	 * - dismissed_paypal_unsupported_currency_notice
+	 *
+	 * The meta keys are set by WC_Admin_Notices when the notice is dismissed by the user.
+	 *
+	 * @since 10.5.0
+	 * @param string $notice_name The name of the notice.
+	 * @return bool
+	 */
+	private function is_notice_dismissed( string $notice_name ): bool {
+		return (bool) get_user_meta( get_current_user_id(), 'dismissed_' . $notice_name . '_notice', true );
+	}
+
+	/**
+	 * Check if there's a flag indicating PayPal account restriction.
+	 *
+	 * @since 10.5.0
+	 * @return bool
+	 */
+	private function has_account_restriction_flag(): bool {
+		return 'yes' === get_option( 'woocommerce_paypal_account_restricted_status', 'no' );
+	}
+
+	/**
+	 * Set the flag indicating PayPal account restriction.
+	 *
+	 * @since 10.5.0
+	 * @return void
+	 */
+	public static function set_account_restriction_flag(): void {
+		if ( 'no' === get_option( 'woocommerce_paypal_account_restricted_status', 'no' ) ) {
+			update_option( 'woocommerce_paypal_account_restricted_status', 'yes', false );
+		}
+	}
+
+	/**
+	 * Clear the flag indicating PayPal account restriction.
+	 *
+	 * @since 10.5.0
+	 * @return void
+	 */
+	public static function clear_account_restriction_flag(): void {
+		if ( 'yes' === get_option( 'woocommerce_paypal_account_restricted_status', 'no' ) ) {
+			update_option( 'woocommerce_paypal_account_restricted_status', 'no' );
+		}
+	}
+
+	/**
+	 * Handle PayPal order response to manage account restriction notices.
+	 *
+	 * @since 10.5.0
+	 * @param int|string $http_code     The HTTP status code from the PayPal API response.
+	 * @param array      $response_data The decoded response data from the PayPal API.
+	 * @param WC_Order   $order         The WooCommerce order object.
+	 * @return void
+	 */
+	public static function manage_account_restriction_flag_for_notice( $http_code, array $response_data, WC_Order $order ): void {
+		// Clear the restriction flag on successful responses.
+		if ( in_array( (int) $http_code, array( 200, 201 ), true ) ) {
+			self::clear_account_restriction_flag();
+			return;
+		}
+
+		if ( empty( $response_data ) ) {
+			return;
+		}
+
+		// Set the restriction flag for account-related errors.
+		if ( 422 === (int) $http_code ) {
+			$issue = isset( $response_data['details'][0]['issue'] ) ? $response_data['details'][0]['issue'] : '';
+
+			if ( in_array( $issue, self::PAYPAL_ACCOUNT_RESTRICTION_ISSUES, true ) ) {
+				\WC_Gateway_Paypal::log( 'PayPal account restriction flag set due to issues when handling the order: ' . $order->get_id() );
+				self::set_account_restriction_flag();
+			}
+		}
+	}
+}
diff --git a/plugins/woocommerce/tests/php/includes/gateways/paypal/class-wc-gateway-paypal-notices-test.php b/plugins/woocommerce/tests/php/src/Gateways/PayPal/NoticesTest.php
similarity index 90%
rename from plugins/woocommerce/tests/php/includes/gateways/paypal/class-wc-gateway-paypal-notices-test.php
rename to plugins/woocommerce/tests/php/src/Gateways/PayPal/NoticesTest.php
index 3bac86538b..34e48984af 100644
--- a/plugins/woocommerce/tests/php/includes/gateways/paypal/class-wc-gateway-paypal-notices-test.php
+++ b/plugins/woocommerce/tests/php/src/Gateways/PayPal/NoticesTest.php
@@ -1,23 +1,25 @@
 <?php
 /**
- * Unit tests for WC_Gateway_Paypal_Notices class.
+ * Unit tests for Automattic\WooCommerce\Gateways\PayPal\Notices class.
  *
- * @package WooCommerce\Tests\Paypal.
+ * @package WooCommerce\Tests\Gateways\PayPal
  */

 declare(strict_types=1);

-require_once WC_ABSPATH . 'includes/gateways/paypal/includes/class-wc-gateway-paypal-notices.php';
+namespace Automattic\WooCommerce\Tests\Gateways\PayPal;
+
+use Automattic\WooCommerce\Gateways\PayPal\Notices;

 /**
- * Class WC_Gateway_Paypal_Notices_Test.
+ * Class NoticesTest.
  */
-class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
+class NoticesTest extends \WC_Unit_Test_Case {

 	/**
 	 * The PayPal gateway instance.
 	 *
-	 * @var WC_Gateway_Paypal
+	 * @var \WC_Gateway_Paypal
 	 */
 	private $gateway;

@@ -97,7 +99,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		delete_option( 'woocommerce_paypal_account_restricted_status' );

 		// Reset the gateway singleton to null.
-		WC_Gateway_Paypal::set_instance( null );
+		\WC_Gateway_Paypal::set_instance( null );

 		parent::tearDown();
 	}
@@ -110,7 +112,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		remove_all_actions( 'admin_notices' );
 		remove_all_actions( 'admin_head' );

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		$this->assertNotFalse( has_action( 'admin_notices', array( $notices, 'add_paypal_notices' ) ) );
 		$this->assertNotFalse( has_action( 'admin_head', array( $notices, 'add_paypal_notices_on_payments_settings_page' ) ) );
@@ -153,7 +155,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		);
 		wp_set_current_user( $user_id_map[ $user_role ] );

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices();
@@ -170,7 +172,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 	 * Test that migration notice is displayed when not dismissed.
 	 */
 	public function test_migration_notice_displayed_when_not_dismissed() {
-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices();
@@ -187,7 +189,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 	public function test_migration_notice_not_displayed_when_dismissed() {
 		update_user_meta( $this->admin_user_id, 'dismissed_paypal_migration_completed_notice', true );

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices();
@@ -203,7 +205,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		update_option( 'woocommerce_paypal_account_restricted_status', 'yes' );
 		$this->mock_gateway_available();

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices();
@@ -220,7 +222,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 	public function test_account_restricted_notice_not_displayed_when_flag_not_set() {
 		$this->mock_gateway_available();

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices();
@@ -238,7 +240,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		$this->create_mock_gateway();
 		update_user_meta( $this->admin_user_id, 'dismissed_paypal_account_restricted_notice', true );

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices();
@@ -285,7 +287,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		// Set the currency.
 		update_option( 'woocommerce_currency', $currency );

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices();
@@ -311,7 +313,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		update_option( 'woocommerce_currency', 'TRY' );
 		update_user_meta( $this->admin_user_id, 'dismissed_paypal_unsupported_currency_notice', true );

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices();
@@ -330,7 +332,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		// Ensure the flag is not set initially.
 		update_option( 'woocommerce_paypal_account_restricted_status', 'no' );

-		WC_Gateway_Paypal_Notices::set_account_restriction_flag();
+		Notices::set_account_restriction_flag();

 		// Verify the flag was set.
 		$this->assertEquals( 'yes', get_option( 'woocommerce_paypal_account_restricted_status', 'no' ) );
@@ -354,7 +356,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		add_filter( 'pre_update_option_woocommerce_paypal_account_restricted_status', $track_updates, 10, 3 );

 		// Call set again - should not change the value.
-		WC_Gateway_Paypal_Notices::set_account_restriction_flag();
+		Notices::set_account_restriction_flag();

 		// Verify update_option was not called (the filter would have been triggered).
 		$this->assertEquals( 0, $update_calls, 'update_option should not be called when flag is already set' );
@@ -373,7 +375,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		// Set the flag initially.
 		update_option( 'woocommerce_paypal_account_restricted_status', 'yes' );

-		WC_Gateway_Paypal_Notices::clear_account_restriction_flag();
+		Notices::clear_account_restriction_flag();

 		// Verify the flag was cleared.
 		$this->assertEquals( 'no', get_option( 'woocommerce_paypal_account_restricted_status', 'no' ) );
@@ -397,7 +399,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		add_filter( 'pre_update_option_woocommerce_paypal_account_restricted_status', $track_updates, 10, 3 );

 		// Call clear again - should not change the value.
-		WC_Gateway_Paypal_Notices::clear_account_restriction_flag();
+		Notices::clear_account_restriction_flag();

 		// Verify update_option was not called (the filter would have been triggered).
 		$this->assertEquals( 0, $update_calls, 'update_option should not be called when flag is already cleared' );
@@ -415,7 +417,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 	public function test_notices_not_displayed_when_gateway_not_available() {
 		$this->mock_gateway_not_available();

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices();
@@ -428,13 +430,13 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 	 * Test that notices are not displayed when Orders v2 is not enabled.
 	 */
 	public function test_notices_not_displayed_when_orders_v2_not_enabled() {
-		$mock_gateway = $this->getMockBuilder( WC_Gateway_Paypal::class )
+		$mock_gateway = $this->getMockBuilder( \WC_Gateway_Paypal::class )
 			->onlyMethods( array( 'should_use_orders_v2' ) )
 			->getMock();
 		$mock_gateway->method( 'should_use_orders_v2' )->willReturn( false );
-		WC_Gateway_Paypal::set_instance( $mock_gateway );
+		\WC_Gateway_Paypal::set_instance( $mock_gateway );

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices();
@@ -455,7 +457,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		$current_tab     = 'checkout';
 		$current_section = '';

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices_on_payments_settings_page();
@@ -477,7 +479,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		$current_tab     = 'general';
 		$current_section = '';

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices_on_payments_settings_page();
@@ -496,7 +498,7 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 		$store_currency = get_option( 'woocommerce_currency' );
 		update_option( 'woocommerce_currency', 'TRY' );

-		$notices = new WC_Gateway_Paypal_Notices();
+		$notices = new Notices();

 		ob_start();
 		$notices->add_paypal_notices();
@@ -542,17 +544,17 @@ class WC_Gateway_Paypal_Notices_Test extends \WC_Unit_Test_Case {
 	/**
 	 * Create a mock gateway instance.
 	 *
-	 * @return WC_Gateway_Paypal|\PHPUnit\Framework\MockObject\MockObject
+	 * @return \WC_Gateway_Paypal|\PHPUnit\Framework\MockObject\MockObject
 	 */
 	private function create_mock_gateway() {
-		$mock_gateway = $this->getMockBuilder( WC_Gateway_Paypal::class )
+		$mock_gateway = $this->getMockBuilder( \WC_Gateway_Paypal::class )
 			->onlyMethods( array( 'should_use_orders_v2' ) )
 			->getMock();

 		$mock_gateway->method( 'should_use_orders_v2' )->willReturn( true );

 		// Inject the mock gateway as the singleton instance.
-		WC_Gateway_Paypal::set_instance( $mock_gateway );
+		\WC_Gateway_Paypal::set_instance( $mock_gateway );

 		return $mock_gateway;
 	}