mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Merge pull request #3531 from woocommerce/PCP-5010-appswitch-flag
Add feature flag for AppSwitch (5010)
This commit is contained in:
commit
7a230ece85
5 changed files with 22 additions and 0 deletions
|
@ -401,6 +401,7 @@ export const PayPalComponent = ( {
|
||||||
const shouldEnableAppSwitch = () => {
|
const shouldEnableAppSwitch = () => {
|
||||||
// AppSwitch should only be enabled in Pay Now flows with server side shipping callback.
|
// AppSwitch should only be enabled in Pay Now flows with server side shipping callback.
|
||||||
return (
|
return (
|
||||||
|
config.scriptData.appswitch.enabled &&
|
||||||
! config.scriptData.final_review_enabled &&
|
! config.scriptData.final_review_enabled &&
|
||||||
config.scriptData.server_side_shipping_callback.enabled
|
config.scriptData.server_side_shipping_callback.enabled
|
||||||
);
|
);
|
||||||
|
|
|
@ -252,6 +252,7 @@ class Renderer {
|
||||||
shouldEnableAppSwitch = () => {
|
shouldEnableAppSwitch = () => {
|
||||||
// AppSwitch should only be enabled in Pay Now flows with server side shipping callback.
|
// AppSwitch should only be enabled in Pay Now flows with server side shipping callback.
|
||||||
return (
|
return (
|
||||||
|
this.defaultSettings.appswitch.enabled &&
|
||||||
! this.defaultSettings.final_review_enabled &&
|
! this.defaultSettings.final_review_enabled &&
|
||||||
this.defaultSettings.server_side_shipping_callback.enabled
|
this.defaultSettings.server_side_shipping_callback.enabled
|
||||||
);
|
);
|
||||||
|
|
|
@ -169,6 +169,7 @@ return array(
|
||||||
$container->get( 'woocommerce.logger.woocommerce' ),
|
$container->get( 'woocommerce.logger.woocommerce' ),
|
||||||
$container->get( 'button.handle-shipping-in-paypal' ),
|
$container->get( 'button.handle-shipping-in-paypal' ),
|
||||||
$container->get( 'wcgateway.server-side-shipping-callback-enabled' ),
|
$container->get( 'wcgateway.server-side-shipping-callback-enabled' ),
|
||||||
|
$container->get( 'wcgateway.appswitch-enabled' ),
|
||||||
$container->get( 'button.helper.disabled-funding-sources' ),
|
$container->get( 'button.helper.disabled-funding-sources' ),
|
||||||
$container->get( 'wcgateway.configuration.card-configuration' ),
|
$container->get( 'wcgateway.configuration.card-configuration' ),
|
||||||
$container->get( 'api.helper.partner-attribution' ),
|
$container->get( 'api.helper.partner-attribution' ),
|
||||||
|
|
|
@ -259,6 +259,11 @@ class SmartButton implements SmartButtonInterface {
|
||||||
*/
|
*/
|
||||||
private bool $server_side_shipping_callback_enabled;
|
private bool $server_side_shipping_callback_enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the AppSwitch is enabled (feature flag).
|
||||||
|
*/
|
||||||
|
private bool $appswitch_enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the final review is enabled in blocks settings.
|
* Whether the final review is enabled in blocks settings.
|
||||||
*/
|
*/
|
||||||
|
@ -291,6 +296,7 @@ class SmartButton implements SmartButtonInterface {
|
||||||
* @param LoggerInterface $logger The logger.
|
* @param LoggerInterface $logger The logger.
|
||||||
* @param bool $should_handle_shipping_in_paypal Whether the shipping should be handled in PayPal.
|
* @param bool $should_handle_shipping_in_paypal Whether the shipping should be handled in PayPal.
|
||||||
* @param bool $server_side_shipping_callback_enabled Whether the server-side shipping callback is enabled (feature flag).
|
* @param bool $server_side_shipping_callback_enabled Whether the server-side shipping callback is enabled (feature flag).
|
||||||
|
* @param bool $appswitch_enabled Whether the AppSwitch is enabled (feature flag).
|
||||||
* @param DisabledFundingSources $disabled_funding_sources List of funding sources to be disabled.
|
* @param DisabledFundingSources $disabled_funding_sources List of funding sources to be disabled.
|
||||||
* @param CardPaymentsConfiguration $dcc_configuration The DCC Gateway Configuration.
|
* @param CardPaymentsConfiguration $dcc_configuration The DCC Gateway Configuration.
|
||||||
* @param PartnerAttribution $partner_attribution The PayPal Partner Attribution Helper.
|
* @param PartnerAttribution $partner_attribution The PayPal Partner Attribution Helper.
|
||||||
|
@ -321,6 +327,7 @@ class SmartButton implements SmartButtonInterface {
|
||||||
LoggerInterface $logger,
|
LoggerInterface $logger,
|
||||||
bool $should_handle_shipping_in_paypal,
|
bool $should_handle_shipping_in_paypal,
|
||||||
bool $server_side_shipping_callback_enabled,
|
bool $server_side_shipping_callback_enabled,
|
||||||
|
bool $appswitch_enabled,
|
||||||
DisabledFundingSources $disabled_funding_sources,
|
DisabledFundingSources $disabled_funding_sources,
|
||||||
CardPaymentsConfiguration $dcc_configuration,
|
CardPaymentsConfiguration $dcc_configuration,
|
||||||
PartnerAttribution $partner_attribution,
|
PartnerAttribution $partner_attribution,
|
||||||
|
@ -350,6 +357,7 @@ class SmartButton implements SmartButtonInterface {
|
||||||
$this->payment_tokens_endpoint = $payment_tokens_endpoint;
|
$this->payment_tokens_endpoint = $payment_tokens_endpoint;
|
||||||
$this->should_handle_shipping_in_paypal = $should_handle_shipping_in_paypal;
|
$this->should_handle_shipping_in_paypal = $should_handle_shipping_in_paypal;
|
||||||
$this->server_side_shipping_callback_enabled = $server_side_shipping_callback_enabled;
|
$this->server_side_shipping_callback_enabled = $server_side_shipping_callback_enabled;
|
||||||
|
$this->appswitch_enabled = $appswitch_enabled;
|
||||||
$this->disabled_funding_sources = $disabled_funding_sources;
|
$this->disabled_funding_sources = $disabled_funding_sources;
|
||||||
$this->dcc_configuration = $dcc_configuration;
|
$this->dcc_configuration = $dcc_configuration;
|
||||||
$this->partner_attribution = $partner_attribution;
|
$this->partner_attribution = $partner_attribution;
|
||||||
|
@ -1365,6 +1373,9 @@ document.querySelector("#payment").before(document.querySelector(".ppcp-messages
|
||||||
'server_side_shipping_callback' => array(
|
'server_side_shipping_callback' => array(
|
||||||
'enabled' => $this->server_side_shipping_callback_enabled,
|
'enabled' => $this->server_side_shipping_callback_enabled,
|
||||||
),
|
),
|
||||||
|
'appswitch' => array(
|
||||||
|
'enabled' => $this->appswitch_enabled,
|
||||||
|
),
|
||||||
'needShipping' => $this->need_shipping(),
|
'needShipping' => $this->need_shipping(),
|
||||||
'vaultingEnabled' => $this->settings->has( 'vault_enabled' ) && $this->settings->get( 'vault_enabled' ),
|
'vaultingEnabled' => $this->settings->has( 'vault_enabled' ) && $this->settings->get( 'vault_enabled' ),
|
||||||
'productType' => null,
|
'productType' => null,
|
||||||
|
|
|
@ -2265,4 +2265,12 @@ return array(
|
||||||
getenv( 'PCP_SERVER_SIDE_SHIPPING_CALLBACK_ENABLED' ) === '1'
|
getenv( 'PCP_SERVER_SIDE_SHIPPING_CALLBACK_ENABLED' ) === '1'
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'wcgateway.appswitch-enabled' => static function( ContainerInterface $container ) : bool {
|
||||||
|
return apply_filters(
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
||||||
|
'woocommerce.feature-flags.woocommerce_paypal_payments.appswitch_enabled',
|
||||||
|
getenv( 'PCP_APPSWITCH_ENABLED' ) === '1'
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue