Allow GooglePay use for non referral merchants

This commit is contained in:
Pedro Silva 2023-10-11 08:51:22 +01:00
parent c30ddd3b64
commit 8c6a58d05c
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
4 changed files with 28 additions and 24 deletions

View file

@ -10,8 +10,6 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\Googlepay;
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry;
use WooCommerce\PayPalCommerce\AdminNotices\Entity\Message;
use WooCommerce\PayPalCommerce\AdminNotices\Repository\Repository;
use WooCommerce\PayPalCommerce\Button\Assets\ButtonInterface;
use WooCommerce\PayPalCommerce\Googlepay\Helper\ApmProductStatus;
use WooCommerce\PayPalCommerce\Googlepay\Helper\AvailabilityNotice;
@ -62,13 +60,21 @@ class GooglepayModule implements ModuleInterface {
$button->initialize();
// Check if this merchant can activate / use the buttons.
if ( ! $c->get( 'googlepay.available' ) ) {
// We allow non referral merchants as they can potentially still use GooglePay, we just have no way of checking the capability.
if ( ( ! $c->get( 'googlepay.available' ) ) && $c->get( 'googlepay.is_referral' ) ) {
$availability_notice = $c->get( 'googlepay.availability_notice' );
assert( $availability_notice instanceof AvailabilityNotice );
$availability_notice->execute();
return;
}
// Show notice and continue if merchant isn't onboarded via a referral.
if ( ! $c->get( 'googlepay.is_referral' ) ) {
$availability_notice = $c->get( 'googlepay.availability_notice' );
assert( $availability_notice instanceof AvailabilityNotice );
$availability_notice->execute();
}
// Initializes button rendering.
add_action(
'wp',