Simplify the code

This commit is contained in:
Narek Zakarian 2025-08-04 18:11:49 +04:00
parent 7e43288f74
commit 3587074bab
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7

View file

@ -522,6 +522,10 @@ $services = array(
// TODO: This "merchant_capabilities" service is only used here. Could it be merged to make the code cleaner and less segmented?
$capabilities = $container->get( 'settings.service.merchant_capabilities' );
$settings = $container->get( 'wcgateway.settings' );
assert( $settings instanceof Settings );
$stay_updated = $settings->has( 'stay_updated' ) && $settings->get( 'stay_updated' );
/**
* Initializes TodosEligibilityService with eligibility conditions for various PayPal features.
* Each parameter determines whether a specific feature should be shown in the Things To Do list.
@ -566,7 +570,8 @@ $services = array(
$container->get( 'googlepay.eligible' ) && $capabilities['acdc'] && ! $capabilities['google_pay'], // Add Google Pay to your account.
$container->get( 'applepay.eligible' ) && $capabilities['apple_pay'] && ! $gateways['apple_pay'], // Enable Apple Pay.
$container->get( 'googlepay.eligible' ) && $capabilities['google_pay'] && ! $gateways['google_pay'],
! $capabilities['installments'] && 'MX' === $container->get( 'settings.data.general' )->get_merchant_country() // Enable Installments for Mexico.
! $capabilities['installments'] && 'MX' === $container->get( 'settings.data.general' )->get_merchant_country(), // Enable Installments for Mexico.
$container->get( 'api.shop.country' ) === 'US' && $stay_updated // Enable Working Capital.
);
},
'settings.rest.features' => static function ( ContainerInterface $container ) : FeaturesRestEndpoint {