mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add GooglePay onboarding improvements.
This commit is contained in:
parent
bad21380b3
commit
b703f17bbf
7 changed files with 31 additions and 16 deletions
|
@ -16,6 +16,7 @@ use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
|||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
||||
/**
|
||||
* Class GooglepayModule
|
||||
|
@ -77,10 +78,15 @@ class GooglepayModule implements ModuleInterface {
|
|||
// Clear product status handling.
|
||||
add_action(
|
||||
'woocommerce_paypal_payments_clear_apm_product_status',
|
||||
function() use ( $c ): void {
|
||||
function( Settings $settings = null ) use ( $c ): void {
|
||||
$apm_status = $c->get( 'googlepay.helpers.apm-product-status' );
|
||||
assert( $apm_status instanceof ApmProductStatus );
|
||||
$apm_status->clear();
|
||||
|
||||
if ( ! $settings instanceof Settings ) {
|
||||
$settings = null;
|
||||
}
|
||||
|
||||
$apm_status->clear( $settings );
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -121,13 +121,19 @@ class ApmProductStatus {
|
|||
/**
|
||||
* Clears the persisted result to force a recheck.
|
||||
*
|
||||
* @param Settings|null $settings The settings object.
|
||||
* We accept a Settings object to don't override other sequential settings that are being updated elsewhere.
|
||||
* @return void
|
||||
*/
|
||||
public function clear(): void {
|
||||
public function clear( Settings $settings = null ): void {
|
||||
if ( null === $settings ) {
|
||||
$settings = $this->settings;
|
||||
}
|
||||
|
||||
$this->current_status = null;
|
||||
|
||||
$this->settings->set( self::SETTINGS_KEY, self::SETTINGS_VALUE_UNDEFINED );
|
||||
$this->settings->persist();
|
||||
$settings->set( self::SETTINGS_KEY, self::SETTINGS_VALUE_UNDEFINED );
|
||||
$settings->persist();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue