Fix GooglePay availability notice when not onboarded.

This commit is contained in:
Pedro Silva 2023-09-22 09:56:23 +01:00
parent b16e2571b1
commit 904beafa1f
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
2 changed files with 14 additions and 1 deletions

View file

@ -83,7 +83,7 @@ class ApmProductStatus {
* @return bool
*/
public function is_active() : bool {
if ( $this->onboarding_state->current_state() < State::STATE_ONBOARDED ) {
if ( ! $this->is_onboarded() ) {
return false;
}
@ -126,6 +126,15 @@ class ApmProductStatus {
return $this->current_status;
}
/**
* Returns if the seller is onboarded.
*
* @return bool
*/
public function is_onboarded(): bool {
return $this->onboarding_state->current_state() >= State::STATE_ONBOARDED;
}
/**
* Returns if there was a request failure.
*

View file

@ -39,6 +39,10 @@ class AvailabilityNotice {
* @return void
*/
public function execute(): void {
if ( ! $this->product_status->is_onboarded() ) {
return;
}
if ( $this->product_status->has_request_failure() ) {
$this->add_seller_status_failure_notice();
} else {