mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Refactor GooglePay onboarding
This commit is contained in:
parent
62e10387cb
commit
bad21380b3
12 changed files with 289 additions and 24 deletions
|
@ -11,6 +11,7 @@ namespace WooCommerce\PayPalCommerce\Googlepay;
|
|||
|
||||
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry;
|
||||
use WooCommerce\PayPalCommerce\Button\Assets\ButtonInterface;
|
||||
use WooCommerce\PayPalCommerce\Googlepay\Helper\ApmProductStatus;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
|
@ -34,13 +35,13 @@ class GooglepayModule implements ModuleInterface {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
$button = $c->get( 'googlepay.button' );
|
||||
assert( $button instanceof ButtonInterface );
|
||||
|
||||
if ( ! $c->get( 'googlepay.eligible' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$button = $c->get( 'googlepay.button' );
|
||||
assert( $button instanceof ButtonInterface );
|
||||
$button->initialize();
|
||||
|
||||
if ( ! $c->get( 'googlepay.available' ) ) {
|
||||
|
@ -72,6 +73,17 @@ class GooglepayModule implements ModuleInterface {
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Clear product status handling.
|
||||
add_action(
|
||||
'woocommerce_paypal_payments_clear_apm_product_status',
|
||||
function() use ( $c ): void {
|
||||
$apm_status = $c->get( 'googlepay.helpers.apm-product-status' );
|
||||
assert( $apm_status instanceof ApmProductStatus );
|
||||
$apm_status->clear();
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue