mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-10 23:42:39 +08:00
Fix GooglePay notice placement.
This commit is contained in:
parent
59219009c3
commit
b96e556257
2 changed files with 43 additions and 4 deletions
|
@ -52,7 +52,9 @@ return array(
|
||||||
|
|
||||||
'googlepay.availability_notice' => static function ( ContainerInterface $container ): AvailabilityNotice {
|
'googlepay.availability_notice' => static function ( ContainerInterface $container ): AvailabilityNotice {
|
||||||
return new AvailabilityNotice(
|
return new AvailabilityNotice(
|
||||||
$container->get( 'googlepay.helpers.apm-product-status' )
|
$container->get( 'googlepay.helpers.apm-product-status' ),
|
||||||
|
$container->get( 'wcgateway.is-wc-gateways-list-page' ),
|
||||||
|
$container->get( 'wcgateway.is-ppcp-settings-page' )
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -24,13 +24,35 @@ class AvailabilityNotice {
|
||||||
*/
|
*/
|
||||||
private $product_status;
|
private $product_status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if we're on the WooCommerce gateways list page.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $is_wc_gateways_list_page;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if we're on a PPCP Settings page.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $is_ppcp_settings_page;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ApmProductStatus constructor.
|
* Class ApmProductStatus constructor.
|
||||||
|
|
||||||
* @param ApmProductStatus $product_status The product status handler.
|
* @param ApmProductStatus $product_status The product status handler.
|
||||||
|
* @param bool $is_wc_gateways_list_page Indicates if we're on the WooCommerce gateways list page.
|
||||||
|
* @param bool $is_ppcp_settings_page Indicates if we're on a PPCP Settings page.
|
||||||
*/
|
*/
|
||||||
public function __construct( ApmProductStatus $product_status ) {
|
public function __construct(
|
||||||
$this->product_status = $product_status;
|
ApmProductStatus $product_status,
|
||||||
|
bool $is_wc_gateways_list_page,
|
||||||
|
bool $is_ppcp_settings_page
|
||||||
|
) {
|
||||||
|
$this->product_status = $product_status;
|
||||||
|
$this->is_wc_gateways_list_page = $is_wc_gateways_list_page;
|
||||||
|
$this->is_ppcp_settings_page = $is_ppcp_settings_page;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +61,7 @@ class AvailabilityNotice {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function execute(): void {
|
public function execute(): void {
|
||||||
if ( ! $this->product_status->is_onboarded() ) {
|
if ( ! $this->should_display() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +72,21 @@ class AvailabilityNotice {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the message should display.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function should_display(): bool {
|
||||||
|
if ( ! $this->product_status->is_onboarded() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( ! $this->is_wc_gateways_list_page && ! $this->is_ppcp_settings_page ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds seller status failure notice.
|
* Adds seller status failure notice.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue