diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index 940e1c7c7..f6d470a5c 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -351,7 +351,7 @@ return array( 'wcgateway.notice.dcc-without-paypal' => static function ( ContainerInterface $container ): GatewayWithoutPayPalAdminNotice { return new GatewayWithoutPayPalAdminNotice( CreditCardGateway::ID, - $container->get( 'onboarding.state' ), + $container->get( 'settings.flag.is-connected' ), $container->get( 'wcgateway.settings' ), $container->get( 'wcgateway.is-wc-payments-page' ), $container->get( 'wcgateway.is-ppcp-settings-page' ) @@ -360,7 +360,7 @@ return array( 'wcgateway.notice.card-button-without-paypal' => static function ( ContainerInterface $container ): GatewayWithoutPayPalAdminNotice { return new GatewayWithoutPayPalAdminNotice( CardButtonGateway::ID, - $container->get( 'onboarding.state' ), + $container->get( 'settings.flag.is-connected' ), $container->get( 'wcgateway.settings' ), $container->get( 'wcgateway.is-wc-payments-page' ), $container->get( 'wcgateway.is-ppcp-settings-page' ), diff --git a/modules/ppcp-wc-gateway/src/Notice/GatewayWithoutPayPalAdminNotice.php b/modules/ppcp-wc-gateway/src/Notice/GatewayWithoutPayPalAdminNotice.php index 2dfc88904..627d23e97 100644 --- a/modules/ppcp-wc-gateway/src/Notice/GatewayWithoutPayPalAdminNotice.php +++ b/modules/ppcp-wc-gateway/src/Notice/GatewayWithoutPayPalAdminNotice.php @@ -11,7 +11,6 @@ namespace WooCommerce\PayPalCommerce\WcGateway\Notice; use WC_Payment_Gateway; use WooCommerce\PayPalCommerce\AdminNotices\Entity\Message; -use WooCommerce\PayPalCommerce\Onboarding\State; use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\WcGateway\Helper\SettingsStatus; @@ -32,11 +31,11 @@ class GatewayWithoutPayPalAdminNotice { private $id; /** - * The state. + * Whether the merchant completed onboarding. * - * @var State + * @var bool */ - private $state; + private bool $is_connected; /** * The settings. @@ -70,7 +69,7 @@ class GatewayWithoutPayPalAdminNotice { * ConnectAdminNotice constructor. * * @param string $id The gateway ID. - * @param State $state The state. + * @param bool $is_connected Whether onboading was completed. * @param ContainerInterface $settings The settings. * @param bool $is_payments_page Whether the current page is the WC payment page. * @param bool $is_ppcp_settings_page Whether the current page is the PPCP settings page. @@ -78,14 +77,14 @@ class GatewayWithoutPayPalAdminNotice { */ public function __construct( string $id, - State $state, + bool $is_connected, ContainerInterface $settings, bool $is_payments_page, bool $is_ppcp_settings_page, ?SettingsStatus $settings_status = null ) { $this->id = $id; - $this->state = $state; + $this->is_connected = $is_connected; $this->settings = $settings; $this->is_payments_page = $is_payments_page; $this->is_ppcp_settings_page = $is_ppcp_settings_page; @@ -161,7 +160,7 @@ class GatewayWithoutPayPalAdminNotice { * @return string One of the NOTICE_* constants. */ protected function check(): string { - if ( State::STATE_ONBOARDED !== $this->state->current_state() || + if ( ! $this->is_connected || ( ! $this->is_payments_page && ! $this->is_ppcp_settings_page ) ) { return self::NOTICE_OK; }