mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
Enable Fastlane by default for compatible setups
This commit is contained in:
parent
6078ec3f59
commit
d7314a3ebc
3 changed files with 160 additions and 38 deletions
|
@ -9,11 +9,13 @@ declare( strict_types = 1 );
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\Settings;
|
||||
|
||||
use Mollie\Api\Resources\Payment;
|
||||
use WC_Payment_Gateway;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PartnersEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
|
||||
use WooCommerce\PayPalCommerce\Applepay\Assets\AppleProductStatus;
|
||||
use WooCommerce\PayPalCommerce\Axo\Gateway\AxoGateway;
|
||||
use WooCommerce\PayPalCommerce\Googlepay\Helper\ApmProductStatus;
|
||||
use WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods\BancontactGateway;
|
||||
use WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods\BlikGateway;
|
||||
|
@ -43,6 +45,8 @@ use WooCommerce\PayPalCommerce\Settings\Service\SettingsDataManager;
|
|||
use WooCommerce\PayPalCommerce\Settings\DTO\ConfigurationFlagsDTO;
|
||||
use WooCommerce\PayPalCommerce\Settings\Enum\ProductChoicesEnum;
|
||||
use WooCommerce\PayPalCommerce\Settings\Data\GeneralSettings;
|
||||
use WooCommerce\PayPalCommerce\Settings\Data\PaymentSettings;
|
||||
use WooCommerce\PayPalCommerce\Axo\Helper\CompatibilityChecker;
|
||||
|
||||
/**
|
||||
* Class SettingsModule
|
||||
|
@ -578,6 +582,24 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
|||
}
|
||||
);
|
||||
|
||||
// Enable Fastlane after onboarding if the store is compatible.
|
||||
add_action(
|
||||
'woocommerce_paypal_payments_apply_default_configuration',
|
||||
static function () use ( $container ) {
|
||||
$compatibility_checker = $container->get( 'axo.helpers.compatibility-checker' );
|
||||
assert( $compatibility_checker instanceof CompatibilityChecker );
|
||||
|
||||
$payment_settings = $container->get( 'settings.data.payment' );
|
||||
assert( $payment_settings instanceof PaymentSettings );
|
||||
|
||||
if ( $compatibility_checker->is_fastlane_compatible() ) {
|
||||
$payment_settings->toggle_method_state( AxoGateway::ID, true );
|
||||
}
|
||||
|
||||
$payment_settings->save();
|
||||
}
|
||||
);
|
||||
|
||||
// Redirect payment method links in the WC Payment Gateway to the new UI Payment Methods tab.
|
||||
$gateway_redirect_service = $container->get( 'settings.service.gateway-redirect' );
|
||||
assert( $gateway_redirect_service instanceof GatewayRedirectService );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue