From 860372fb7cb50606481f0e1af4a83190c9bd2e5c Mon Sep 17 00:00:00 2001 From: Narek Zakarian Date: Fri, 28 Feb 2025 15:53:32 +0400 Subject: [PATCH] Use the constants from the gateways instead of hard-coding the names --- .../ppcp-compat/src/Settings/StylingSettingsMapHelper.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/ppcp-compat/src/Settings/StylingSettingsMapHelper.php b/modules/ppcp-compat/src/Settings/StylingSettingsMapHelper.php index 079029ce8..acb723b34 100644 --- a/modules/ppcp-compat/src/Settings/StylingSettingsMapHelper.php +++ b/modules/ppcp-compat/src/Settings/StylingSettingsMapHelper.php @@ -10,6 +10,7 @@ declare(strict_types=1); namespace WooCommerce\PayPalCommerce\Compat\Settings; use RuntimeException; +use WooCommerce\PayPalCommerce\Applepay\ApplePayGateway; use WooCommerce\PayPalCommerce\Button\Helper\ContextTrait; use WooCommerce\PayPalCommerce\Googlepay\GooglePayGateway; use WooCommerce\PayPalCommerce\Settings\Data\PaymentSettings; @@ -25,7 +26,7 @@ class StylingSettingsMapHelper { use ContextTrait; - protected const BUTTON_NAMES = array( 'ppcp-googlepay', 'ppcp-applepay', 'pay-later' ); + protected const BUTTON_NAMES = array( GooglePayGateway::ID, ApplePayGateway::ID, 'pay-later' ); /** * Maps old setting keys to new setting style names. @@ -87,10 +88,10 @@ class StylingSettingsMapHelper { return $this->mapped_disabled_funding_value( $styling_models, $payment_settings ); case 'googlepay_button_enabled': - return $this->mapped_button_enabled_value( $styling_models, 'ppcp-googlepay', $payment_settings ); + return $this->mapped_button_enabled_value( $styling_models, GooglePayGateway::ID, $payment_settings ); case 'applepay_button_enabled': - return $this->mapped_button_enabled_value( $styling_models, 'ppcp-applepay', $payment_settings ); + return $this->mapped_button_enabled_value( $styling_models, ApplePayGateway::ID, $payment_settings ); case 'pay_later_button_enabled': return $this->mapped_button_enabled_value( $styling_models, 'pay-later', $payment_settings );