diff --git a/modules/ppcp-blocks/resources/js/Components/paypal.js b/modules/ppcp-blocks/resources/js/Components/paypal.js index e7e528608..f1f7b3d0f 100644 --- a/modules/ppcp-blocks/resources/js/Components/paypal.js +++ b/modules/ppcp-blocks/resources/js/Components/paypal.js @@ -401,7 +401,7 @@ export const PayPalComponent = ( { const shouldEnableAppSwitch = () => { // AppSwitch should only be enabled in Pay Now flows with server side shipping callback. return ( - config.scriptData.should_handle_shipping_in_paypal && + ! config.scriptData.final_review_enabled && config.scriptData.server_side_shipping_callback.enabled ); }; diff --git a/modules/ppcp-button/resources/js/modules/Renderer/Renderer.js b/modules/ppcp-button/resources/js/modules/Renderer/Renderer.js index 84bda0a49..63e931170 100644 --- a/modules/ppcp-button/resources/js/modules/Renderer/Renderer.js +++ b/modules/ppcp-button/resources/js/modules/Renderer/Renderer.js @@ -252,7 +252,7 @@ class Renderer { shouldEnableAppSwitch = () => { // AppSwitch should only be enabled in Pay Now flows with server side shipping callback. return ( - this.defaultSettings.should_handle_shipping_in_paypal && + ! this.defaultSettings.final_review_enabled && this.defaultSettings.server_side_shipping_callback.enabled ); }; diff --git a/modules/ppcp-button/services.php b/modules/ppcp-button/services.php index 77cc67eac..46792ad38 100644 --- a/modules/ppcp-button/services.php +++ b/modules/ppcp-button/services.php @@ -171,7 +171,8 @@ return array( $container->get( 'wcgateway.server-side-shipping-callback-enabled' ), $container->get( 'button.helper.disabled-funding-sources' ), $container->get( 'wcgateway.configuration.card-configuration' ), - $container->get( 'api.helper.partner-attribution' ) + $container->get( 'api.helper.partner-attribution' ), + $container->get( 'blocks.settings.final_review_enabled' ) ); }, 'button.url' => static function ( ContainerInterface $container ): string { diff --git a/modules/ppcp-button/src/Assets/SmartButton.php b/modules/ppcp-button/src/Assets/SmartButton.php index 7c7b69bd0..17a8ecb42 100644 --- a/modules/ppcp-button/src/Assets/SmartButton.php +++ b/modules/ppcp-button/src/Assets/SmartButton.php @@ -259,6 +259,11 @@ class SmartButton implements SmartButtonInterface { */ private bool $server_side_shipping_callback_enabled; + /** + * Whether the final review is enabled in blocks settings. + */ + private bool $final_review_enabled; + /** * SmartButton constructor. * @@ -289,6 +294,7 @@ class SmartButton implements SmartButtonInterface { * @param DisabledFundingSources $disabled_funding_sources List of funding sources to be disabled. * @param CardPaymentsConfiguration $dcc_configuration The DCC Gateway Configuration. * @param PartnerAttribution $partner_attribution The PayPal Partner Attribution Helper. + * @param bool $final_review_enabled Whether the final review is enabled in blocks settings. */ public function __construct( string $module_url, @@ -317,7 +323,8 @@ class SmartButton implements SmartButtonInterface { bool $server_side_shipping_callback_enabled, DisabledFundingSources $disabled_funding_sources, CardPaymentsConfiguration $dcc_configuration, - PartnerAttribution $partner_attribution + PartnerAttribution $partner_attribution, + bool $final_review_enabled ) { $this->module_url = $module_url; $this->version = $version; @@ -346,6 +353,7 @@ class SmartButton implements SmartButtonInterface { $this->disabled_funding_sources = $disabled_funding_sources; $this->dcc_configuration = $dcc_configuration; $this->partner_attribution = $partner_attribution; + $this->final_review_enabled = $final_review_enabled; } /** @@ -1361,6 +1369,7 @@ document.querySelector("#payment").before(document.querySelector(".ppcp-messages 'vaultingEnabled' => $this->settings->has( 'vault_enabled' ) && $this->settings->get( 'vault_enabled' ), 'productType' => null, 'manualRenewalEnabled' => $this->subscription_helper->accept_manual_renewals(), + 'final_review_enabled' => $this->final_review_enabled, ); if ( is_product() ) {