♻️ Refactor the Fastlane UK feature flag to a separate service

This commit is contained in:
Daniel Dudzic 2025-04-17 14:00:51 +02:00
parent 9d2cbdbe51
commit e5cd2b30ec
No known key found for this signature in database
GPG key ID: 31B40D33E3465483

View file

@ -167,21 +167,9 @@ return array(
),
);
// phpcs:disable WordPress.NamingConventions.ValidHookName.UseUnderscores
/**
* Filter to determine if Fastlane UK with 3D Secure should be enabled.
*
* @param bool $enabled Whether Fastlane UK is enabled.
*/
if ( apply_filters(
'woocommerce.feature-flags.woocommerce_paypal_payments.axo_uk_enabled',
getenv( 'PCP_AXO_UK_ENABLED' ) !== '0'
) ) {
$matrix['GB'] = array(
'GBP',
);
if ( $container->get( 'axo.uk.enabled' ) ) {
$matrix['GB'] = array( 'GBP' );
}
// phpcs:enable WordPress.NamingConventions.ValidHookName.UseUnderscores
/**
* Returns which countries and currency combinations can be used for AXO.
@ -210,16 +198,7 @@ return array(
),
);
// phpcs:disable WordPress.NamingConventions.ValidHookName.UseUnderscores
/**
* Filter to determine if Fastlane UK with 3D Secure should be enabled.
*
* @param bool $enabled Whether Fastlane UK is enabled.
*/
if ( apply_filters(
'woocommerce.feature-flags.woocommerce_paypal_payments.axo_uk_enabled',
getenv( 'PCP_AXO_UK_ENABLED' ) !== '0'
) ) {
if ( $container->get( 'axo.uk.enabled' ) ) {
$matrix['GB'] = array(
'VISA',
'MASTERCARD',
@ -227,7 +206,6 @@ return array(
'DISCOVER',
);
}
// phpcs:enable WordPress.NamingConventions.ValidHookName.UseUnderscores
/**
* Returns which countries and card type combinations can be used for AXO.
@ -418,4 +396,17 @@ return array(
)
);
},
'axo.uk.enabled' => static function ( ContainerInterface $container ): bool {
// phpcs:disable WordPress.NamingConventions.ValidHookName.UseUnderscores
/**
* Filter to determine if Fastlane UK with 3D Secure should be enabled.
*
* @param bool $enabled Whether Fastlane UK is enabled.
*/
return apply_filters(
'woocommerce.feature-flags.woocommerce_paypal_payments.axo_uk_enabled',
getenv( 'PCP_AXO_UK_ENABLED' ) !== '0'
);
// phpcs:enable WordPress.NamingConventions.ValidHookName.UseUnderscores
},
);