From 812ac5427676f4fcd06115d2c078405e001e075d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3fer=20Reykjal=C3=ADn?= <13835680+reykjalin@users.noreply.github.com> Date: Fri, 5 Jul 2024 21:25:01 -0400 Subject: [PATCH] [ECE] Add button radius support (#9010) --- changelog/add-ece-button-radius-support | 4 + .../woopay-express-checkout-button.js | 14 +- client/checkout/woopay/style.scss | 1 + client/data/settings/actions.js | 6 + client/data/settings/hooks.js | 15 ++ client/data/settings/selectors.js | 8 + .../blocks/hooks/use-express-checkout.js | 1 + client/express-checkout/utils/index.ts | 13 +- client/globals.d.ts | 1 + ...general-payment-request-button-settings.js | 68 ++++++- .../express-checkout-settings/index.scss | 16 ++ .../payment-request-button-preview.js | 3 + .../express-checkout-settings/test/index.js | 1 + .../test/payment-request-settings.test.js | 1 + client/utils/express-checkout/index.js | 7 + includes/admin/class-wc-payments-admin.php | 103 +++++----- ...s-wc-rest-payments-settings-controller.php | 188 +++++++++--------- includes/class-wc-payments-features.php | 1 + ...lass-wc-payments-woopay-button-handler.php | 3 +- ...yments-express-checkout-button-handler.php | 3 +- ...ayments-express-checkout-button-helper.php | 8 +- 21 files changed, 315 insertions(+), 150 deletions(-) create mode 100644 changelog/add-ece-button-radius-support diff --git a/changelog/add-ece-button-radius-support b/changelog/add-ece-button-radius-support new file mode 100644 index 00000000000..214a2da3696 --- /dev/null +++ b/changelog/add-ece-button-radius-support @@ -0,0 +1,4 @@ +Significance: minor +Type: add + +Add support for configuring button radius when ECE is enabled diff --git a/client/checkout/woopay/express-button/woopay-express-checkout-button.js b/client/checkout/woopay/express-button/woopay-express-checkout-button.js index 00b8a38b2c4..b7896b0549a 100644 --- a/client/checkout/woopay/express-button/woopay-express-checkout-button.js +++ b/client/checkout/woopay/express-button/woopay-express-checkout-button.js @@ -46,7 +46,14 @@ export const WoopayExpressCheckoutButton = ( { const onClickCallbackRef = useRef( null ); const buttonRef = useRef( null ); const isLoadingRef = useRef( false ); - const { type: buttonType, height, size, theme, context } = buttonSettings; + const { + type: buttonType, + height, + size, + theme, + context, + radius: borderRadius, + } = buttonSettings; const [ isLoading, setIsLoading ] = useState( false ); const [ buttonWidthType, setButtonWidthType ] = useState( buttonWidthTypes.wide @@ -344,7 +351,10 @@ export const WoopayExpressCheckoutButton = ( { data-size={ size } data-theme={ theme } data-width-type={ buttonWidthType } - style={ { height: `${ height }px` } } + style={ { + height: `${ height }px`, + borderRadius: `${ borderRadius }px`, + } } disabled={ isLoading } type="button" > diff --git a/client/checkout/woopay/style.scss b/client/checkout/woopay/style.scss index c547e812849..b77ed029098 100644 --- a/client/checkout/woopay/style.scss +++ b/client/checkout/woopay/style.scss @@ -141,6 +141,7 @@ justify-content: center; white-space: nowrap; text-transform: none; + list-style-type: none; &:not( :disabled ):hover { background: #e0e0e0 !important; diff --git a/client/data/settings/actions.js b/client/data/settings/actions.js index f35cb3c4d14..38928efff38 100644 --- a/client/data/settings/actions.js +++ b/client/data/settings/actions.js @@ -40,6 +40,12 @@ export function updatePaymentRequestButtonTheme( theme ) { return updateSettingsValues( { payment_request_button_theme: theme } ); } +export function updatePaymentRequestButtonBorderRadius( radius ) { + return updateSettingsValues( { + payment_request_button_border_radius: radius, + } ); +} + export function updateSettings( data ) { return { type: ACTION_TYPES.SET_SETTINGS, diff --git a/client/data/settings/hooks.js b/client/data/settings/hooks.js index 442d7c06d12..aef3408fbcd 100644 --- a/client/data/settings/hooks.js +++ b/client/data/settings/hooks.js @@ -389,6 +389,21 @@ export const usePaymentRequestButtonTheme = () => { return [ paymentRequestButtonTheme, updatePaymentRequestButtonTheme ]; }; +export const usePaymentRequestButtonBorderRadius = () => { + const { updatePaymentRequestButtonBorderRadius } = useDispatch( + STORE_NAME + ); + + const paymentRequestButtonBorderRadius = useSelect( ( select ) => + select( STORE_NAME ).getPaymentRequestButtonBorderRadius() + ); + + return [ + paymentRequestButtonBorderRadius, + updatePaymentRequestButtonBorderRadius, + ]; +}; + export const useGetSavingError = () => { return useSelect( ( select ) => select( STORE_NAME ).getSavingError(), [] ); }; diff --git a/client/data/settings/selectors.js b/client/data/settings/selectors.js index fccbd5a166a..29a1f270433 100644 --- a/client/data/settings/selectors.js +++ b/client/data/settings/selectors.js @@ -4,6 +4,7 @@ * Internal dependencies */ import { ProtectionLevel } from '../../settings/fraud-protection/advanced-settings/constants'; +import { getDefaultBorderRadius } from 'wcpay/utils/express-checkout'; const EMPTY_OBJ = {}; const EMPTY_ARR = []; @@ -184,6 +185,13 @@ export const getPaymentRequestButtonTheme = ( state ) => { return getSettings( state ).payment_request_button_theme || ''; }; +export const getPaymentRequestButtonBorderRadius = ( state ) => { + return ( + getSettings( state )?.payment_request_button_border_radius || + getDefaultBorderRadius() + ); +}; + export const getIsSavedCardsEnabled = ( state ) => { return getSettings( state ).is_saved_cards_enabled || false; }; diff --git a/client/express-checkout/blocks/hooks/use-express-checkout.js b/client/express-checkout/blocks/hooks/use-express-checkout.js index a587fd7a9e9..7efdcd9a6e3 100644 --- a/client/express-checkout/blocks/hooks/use-express-checkout.js +++ b/client/express-checkout/blocks/hooks/use-express-checkout.js @@ -3,6 +3,7 @@ */ import { useCallback } from '@wordpress/element'; import { useStripe, useElements } from '@stripe/react-stripe-js'; + /** * Internal dependencies */ diff --git a/client/express-checkout/utils/index.ts b/client/express-checkout/utils/index.ts index a6cd34cb064..b945ba92974 100644 --- a/client/express-checkout/utils/index.ts +++ b/client/express-checkout/utils/index.ts @@ -1,4 +1,8 @@ +/** + * Internal dependencies + */ export * from './normalize'; +import { getDefaultBorderRadius } from 'wcpay/utils/express-checkout'; /** * An /incomplete/ representation of the data that is loaded into the frontend for the Express Checkout. @@ -15,6 +19,7 @@ export interface WCPayExpressCheckoutParams { height: string; locale: string; branded_type: string; + radius: number; }; /** @@ -116,8 +121,14 @@ export const getErrorMessageFromNotice = ( notice: string ) => { * Currently only configures border radius for the buttons. */ export const getExpressCheckoutButtonAppearance = () => { + const buttonSettings = getExpressCheckoutData( 'button' ); + return { - // variables: { borderRadius: '99999px' }, + variables: { + borderRadius: `${ + buttonSettings?.radius ?? getDefaultBorderRadius() + }px`, + }, }; }; diff --git a/client/globals.d.ts b/client/globals.d.ts index df4adbcfccf..972f0731403 100644 --- a/client/globals.d.ts +++ b/client/globals.d.ts @@ -132,6 +132,7 @@ declare global { }; isOverviewSurveySubmitted: boolean; lifetimeTPV: number; + defaultExpressCheckoutBorderRadius: string; }; const wc: { diff --git a/client/settings/express-checkout-settings/general-payment-request-button-settings.js b/client/settings/express-checkout-settings/general-payment-request-button-settings.js index 492731eb278..9c0af33e335 100644 --- a/client/settings/express-checkout-settings/general-payment-request-button-settings.js +++ b/client/settings/express-checkout-settings/general-payment-request-button-settings.js @@ -4,7 +4,14 @@ */ import React, { useMemo } from 'react'; import { __, sprintf } from '@wordpress/i18n'; -import { SelectControl, RadioControl, Notice } from '@wordpress/components'; +import { + // eslint-disable-next-line @wordpress/no-unsafe-wp-apis + __experimentalNumberControl as NumberControl, + SelectControl, + RadioControl, + Notice, + RangeControl, +} from '@wordpress/components'; import { Elements } from '@stripe/react-stripe-js'; import { loadStripe } from '@stripe/stripe-js'; import { useContext } from '@wordpress/element'; @@ -22,6 +29,7 @@ import { usePaymentRequestButtonType, usePaymentRequestButtonSize, usePaymentRequestButtonTheme, + usePaymentRequestButtonBorderRadius, usePaymentRequestEnabledSettings, useWooPayEnabledSettings, } from 'wcpay/data'; @@ -130,10 +138,14 @@ const GeneralPaymentRequestButtonSettings = ( { type } ) => { const [ buttonType, setButtonType ] = usePaymentRequestButtonType(); const [ size, setSize ] = usePaymentRequestButtonSize(); const [ theme, setTheme ] = usePaymentRequestButtonTheme(); + const [ radius, setRadius ] = usePaymentRequestButtonBorderRadius(); const [ isWooPayEnabled ] = useWooPayEnabledSettings(); const [ isPaymentRequestEnabled ] = usePaymentRequestEnabledSettings(); const { - featureFlags: { woopay: isWooPayFeatureFlagEnabled }, + featureFlags: { + woopay: isWooPayFeatureFlagEnabled, + isStripeEceEnabled: isEceEnabled, + }, } = useContext( WCPaySettingsContext ); const stripePromise = useMemo( () => { @@ -210,6 +222,58 @@ const GeneralPaymentRequestButtonSettings = ( { type } ) => { options={ buttonThemeOptions } onChange={ setTheme } /> + { isEceEnabled && ( + <> +

{ __( 'Border radius', 'woocommerce-payments' ) }

+
+
+

+ { __( + 'Controls the corner roundness of express payment buttons.', + 'woocommerce-payments' + ) } +

+ + ) }

{ __( 'Preview', 'woocommerce-payments' ) }

{ __( diff --git a/client/settings/express-checkout-settings/index.scss b/client/settings/express-checkout-settings/index.scss index d3e4302e14c..ce46dbae019 100644 --- a/client/settings/express-checkout-settings/index.scss +++ b/client/settings/express-checkout-settings/index.scss @@ -335,6 +335,22 @@ background: #f0f0f0; } } + + &__border-radius { + display: flex; + gap: $gap; + margin-block-end: 0; + + &__slider { + flex-grow: 1; + } + + &__number-control { + &__suffix { + padding-inline: $gap-smaller; + } + } + } } .components-notice { diff --git a/client/settings/express-checkout-settings/payment-request-button-preview.js b/client/settings/express-checkout-settings/payment-request-button-preview.js index d3a922b116d..2d862f54598 100644 --- a/client/settings/express-checkout-settings/payment-request-button-preview.js +++ b/client/settings/express-checkout-settings/payment-request-button-preview.js @@ -20,6 +20,7 @@ import { usePaymentRequestButtonSize, usePaymentRequestButtonTheme, usePaymentRequestButtonType, + usePaymentRequestButtonBorderRadius, usePaymentRequestEnabledSettings, useWooPayEnabledSettings, } from '../../data'; @@ -74,6 +75,7 @@ const PaymentRequestButtonPreview = () => { const [ buttonType ] = usePaymentRequestButtonType(); const [ size ] = usePaymentRequestButtonSize(); const [ theme ] = usePaymentRequestButtonTheme(); + const [ radius ] = usePaymentRequestButtonBorderRadius(); const [ isWooPayEnabled ] = useWooPayEnabledSettings(); const [ isPaymentRequestEnabled ] = usePaymentRequestEnabledSettings(); @@ -129,6 +131,7 @@ const PaymentRequestButtonPreview = () => { buttonSizeToPxMap.medium }px`, size, + radius, } } /> ) } diff --git a/client/settings/express-checkout-settings/test/index.js b/client/settings/express-checkout-settings/test/index.js index 0fad045e17e..78a8101a5b7 100644 --- a/client/settings/express-checkout-settings/test/index.js +++ b/client/settings/express-checkout-settings/test/index.js @@ -26,6 +26,7 @@ jest.mock( '../../../data', () => ( { usePaymentRequestButtonType: jest.fn().mockReturnValue( [ 'buy' ] ), usePaymentRequestButtonSize: jest.fn().mockReturnValue( [ 'small' ] ), usePaymentRequestButtonTheme: jest.fn().mockReturnValue( [ 'dark' ] ), + usePaymentRequestButtonBorderRadius: jest.fn().mockReturnValue( [ 4 ] ), useWooPayLocations: jest .fn() .mockReturnValue( [ [ true, true, true ], jest.fn() ] ), diff --git a/client/settings/express-checkout-settings/test/payment-request-settings.test.js b/client/settings/express-checkout-settings/test/payment-request-settings.test.js index 164eeff6c67..e368d29f41a 100644 --- a/client/settings/express-checkout-settings/test/payment-request-settings.test.js +++ b/client/settings/express-checkout-settings/test/payment-request-settings.test.js @@ -25,6 +25,7 @@ jest.mock( '../../../data', () => ( { usePaymentRequestEnabledSettings: jest.fn(), usePaymentRequestLocations: jest.fn(), usePaymentRequestButtonType: jest.fn().mockReturnValue( [ 'buy' ] ), + usePaymentRequestButtonBorderRadius: jest.fn().mockReturnValue( [ 4 ] ), usePaymentRequestButtonSize: jest.fn().mockReturnValue( [ 'small' ] ), usePaymentRequestButtonTheme: jest.fn().mockReturnValue( [ 'dark' ] ), useWooPayEnabledSettings: jest.fn(), diff --git a/client/utils/express-checkout/index.js b/client/utils/express-checkout/index.js index e0e93470d33..c47ef82f490 100644 --- a/client/utils/express-checkout/index.js +++ b/client/utils/express-checkout/index.js @@ -22,6 +22,13 @@ export const getExpressCheckoutConfig = ( key ) => { return null; }; +export const getDefaultBorderRadius = () => { + return parseInt( + wcpaySettings?.defaultExpressCheckoutBorderRadius ?? 4, + 10 + ); +}; + /** * Get WC AJAX endpoint URL for express checkout endpoints. * diff --git a/includes/admin/class-wc-payments-admin.php b/includes/admin/class-wc-payments-admin.php index e5358ec1c80..864a315768a 100644 --- a/includes/admin/class-wc-payments-admin.php +++ b/includes/admin/class-wc-payments-admin.php @@ -833,73 +833,74 @@ private function get_js_settings(): array { $site_logo_url = $site_logo_id ? ( wp_get_attachment_image_src( $site_logo_id, 'full' )[0] ?? '' ) : ''; $this->wcpay_js_settings = [ - 'version' => WCPAY_VERSION_NUMBER, - 'connectUrl' => $connect_url, - 'connect' => [ + 'version' => WCPAY_VERSION_NUMBER, + 'connectUrl' => $connect_url, + 'connect' => [ 'country' => WC()->countries->get_base_country(), 'availableCountries' => WC_Payments_Utils::supported_countries(), 'availableStates' => WC()->countries->get_states(), ], - 'connectIncentive' => $connect_incentive, - 'devMode' => $dev_mode, - 'testMode' => $test_mode, - 'onboardingTestMode' => WC_Payments_Onboarding_Service::is_test_mode_enabled(), + 'connectIncentive' => $connect_incentive, + 'devMode' => $dev_mode, + 'testMode' => $test_mode, + 'onboardingTestMode' => WC_Payments_Onboarding_Service::is_test_mode_enabled(), // Set this flag for use in the front-end to alter messages and notices if on-boarding has been disabled. - 'onBoardingDisabled' => WC_Payments_Account::is_on_boarding_disabled(), - 'onboardingFieldsData' => $this->onboarding_service->get_fields_data( get_user_locale() ), - 'errorMessage' => $error_message, - 'featureFlags' => $this->get_frontend_feature_flags(), - 'isSubscriptionsActive' => class_exists( 'WC_Subscriptions' ) && version_compare( WC_Subscriptions::$version, '2.2.0', '>=' ), + 'onBoardingDisabled' => WC_Payments_Account::is_on_boarding_disabled(), + 'onboardingFieldsData' => $this->onboarding_service->get_fields_data( get_user_locale() ), + 'errorMessage' => $error_message, + 'featureFlags' => $this->get_frontend_feature_flags(), + 'isSubscriptionsActive' => class_exists( 'WC_Subscriptions' ) && version_compare( WC_Subscriptions::$version, '2.2.0', '>=' ), // Used in the settings page by the AccountFees component. - 'zeroDecimalCurrencies' => WC_Payments_Utils::zero_decimal_currencies(), - 'fraudServices' => $this->fraud_service->get_fraud_services_config(), - 'isJetpackConnected' => $this->payments_api_client->is_server_connected(), - 'isJetpackIdcActive' => Jetpack_Identity_Crisis::has_identity_crisis(), - 'accountStatus' => $account_status_data, - 'accountFees' => $this->account->get_fees(), - 'accountLoans' => $this->account->get_capital(), - 'accountEmail' => $this->account->get_account_email(), - 'showUpdateDetailsTask' => $this->get_should_show_update_business_details_task( $account_status_data ), - 'wpcomReconnectUrl' => $this->payments_api_client->is_server_connected() && ! $this->payments_api_client->has_server_connection_owner() ? WC_Payments_Account::get_wpcom_reconnect_url() : null, - 'multiCurrencySetup' => [ + 'zeroDecimalCurrencies' => WC_Payments_Utils::zero_decimal_currencies(), + 'fraudServices' => $this->fraud_service->get_fraud_services_config(), + 'isJetpackConnected' => $this->payments_api_client->is_server_connected(), + 'isJetpackIdcActive' => Jetpack_Identity_Crisis::has_identity_crisis(), + 'accountStatus' => $account_status_data, + 'accountFees' => $this->account->get_fees(), + 'accountLoans' => $this->account->get_capital(), + 'accountEmail' => $this->account->get_account_email(), + 'showUpdateDetailsTask' => $this->get_should_show_update_business_details_task( $account_status_data ), + 'wpcomReconnectUrl' => $this->payments_api_client->is_server_connected() && ! $this->payments_api_client->has_server_connection_owner() ? WC_Payments_Account::get_wpcom_reconnect_url() : null, + 'multiCurrencySetup' => [ 'isSetupCompleted' => get_option( 'wcpay_multi_currency_setup_completed' ), ], - 'isMultiCurrencyEnabled' => WC_Payments_Features::is_customer_multi_currency_enabled(), - 'shouldUseExplicitPrice' => WC_Payments_Explicit_Price_Formatter::should_output_explicit_price(), - 'overviewTasksVisibility' => [ + 'isMultiCurrencyEnabled' => WC_Payments_Features::is_customer_multi_currency_enabled(), + 'shouldUseExplicitPrice' => WC_Payments_Explicit_Price_Formatter::should_output_explicit_price(), + 'overviewTasksVisibility' => [ 'dismissedTodoTasks' => get_option( 'woocommerce_dismissed_todo_tasks', [] ), 'deletedTodoTasks' => get_option( 'woocommerce_deleted_todo_tasks', [] ), 'remindMeLaterTodoTasks' => get_option( 'woocommerce_remind_me_later_todo_tasks', [] ), ], - 'currentUserEmail' => $current_user_email, - 'currencyData' => $currency_data, - 'restUrl' => get_rest_url( null, '' ), // rest url to concatenate when merchant use Plain permalinks. - 'siteLogoUrl' => $site_logo_url, - 'isFRTReviewFeatureActive' => WC_Payments_Features::is_frt_review_feature_active(), - 'fraudProtection' => [ + 'currentUserEmail' => $current_user_email, + 'currencyData' => $currency_data, + 'restUrl' => get_rest_url( null, '' ), // rest url to concatenate when merchant use Plain permalinks. + 'siteLogoUrl' => $site_logo_url, + 'isFRTReviewFeatureActive' => WC_Payments_Features::is_frt_review_feature_active(), + 'fraudProtection' => [ 'isWelcomeTourDismissed' => WC_Payments_Features::is_fraud_protection_welcome_tour_dismissed(), ], - 'enabledPaymentMethods' => $this->get_enabled_payment_method_ids(), - 'progressiveOnboarding' => $this->account->get_progressive_onboarding_details(), - 'accountDefaultCurrency' => $this->account->get_account_default_currency(), - 'frtDiscoverBannerSettings' => get_option( 'wcpay_frt_discover_banner_settings', '' ), - 'storeCurrency' => get_option( 'woocommerce_currency' ), - 'isWooPayStoreCountryAvailable' => WooPay_Utilities::is_store_country_available(), - 'woopayLastDisableDate' => $this->wcpay_gateway->get_option( 'platform_checkout_last_disable_date' ), - 'isStripeBillingEnabled' => WC_Payments_Features::is_stripe_billing_enabled(), - 'isStripeBillingEligible' => WC_Payments_Features::is_stripe_billing_eligible(), - 'capabilityRequestNotices' => get_option( 'wcpay_capability_request_dismissed_notices ', [] ), - 'storeName' => get_bloginfo( 'name' ), - 'isNextDepositNoticeDismissed' => WC_Payments_Features::is_next_deposit_notice_dismissed(), - 'isInstantDepositNoticeDismissed' => get_option( 'wcpay_instant_deposit_notice_dismissed', false ), - 'reporting' => [ + 'enabledPaymentMethods' => $this->get_enabled_payment_method_ids(), + 'progressiveOnboarding' => $this->account->get_progressive_onboarding_details(), + 'accountDefaultCurrency' => $this->account->get_account_default_currency(), + 'frtDiscoverBannerSettings' => get_option( 'wcpay_frt_discover_banner_settings', '' ), + 'storeCurrency' => get_option( 'woocommerce_currency' ), + 'isWooPayStoreCountryAvailable' => WooPay_Utilities::is_store_country_available(), + 'woopayLastDisableDate' => $this->wcpay_gateway->get_option( 'platform_checkout_last_disable_date' ), + 'isStripeBillingEnabled' => WC_Payments_Features::is_stripe_billing_enabled(), + 'isStripeBillingEligible' => WC_Payments_Features::is_stripe_billing_eligible(), + 'capabilityRequestNotices' => get_option( 'wcpay_capability_request_dismissed_notices ', [] ), + 'storeName' => get_bloginfo( 'name' ), + 'isNextDepositNoticeDismissed' => WC_Payments_Features::is_next_deposit_notice_dismissed(), + 'isInstantDepositNoticeDismissed' => get_option( 'wcpay_instant_deposit_notice_dismissed', false ), + 'reporting' => [ 'exportModalDismissed' => get_option( 'wcpay_reporting_export_modal_dismissed', false ), ], - 'dismissedDuplicateNotices' => get_option( 'wcpay_duplicate_payment_method_notices_dismissed', [] ), - 'locale' => WC_Payments_Utils::get_language_data( get_locale() ), - 'isOverviewSurveySubmitted' => get_option( 'wcpay_survey_payment_overview_submitted', false ), - 'trackingInfo' => $this->account->get_tracking_info(), - 'lifetimeTPV' => $this->account->get_lifetime_total_payment_volume(), + 'dismissedDuplicateNotices' => get_option( 'wcpay_duplicate_payment_method_notices_dismissed', [] ), + 'locale' => WC_Payments_Utils::get_language_data( get_locale() ), + 'isOverviewSurveySubmitted' => get_option( 'wcpay_survey_payment_overview_submitted', false ), + 'trackingInfo' => $this->account->get_tracking_info(), + 'lifetimeTPV' => $this->account->get_lifetime_total_payment_volume(), + 'defaultExpressCheckoutBorderRadius' => WC_Payments_Express_Checkout_Button_Handler::DEFAULT_BORDER_RADIUS_IN_PX, ]; return apply_filters( 'wcpay_js_settings', $this->wcpay_js_settings ); diff --git a/includes/admin/class-wc-rest-payments-settings-controller.php b/includes/admin/class-wc-rest-payments-settings-controller.php index 9325a07984a..7d96afbeaf5 100644 --- a/includes/admin/class-wc-rest-payments-settings-controller.php +++ b/includes/admin/class-wc-rest-payments-settings-controller.php @@ -8,7 +8,6 @@ use WCPay\Constants\Country_Code; use WCPay\Fraud_Prevention\Fraud_Risk_Tools; use WCPay\Constants\Track_Events; - defined( 'ABSPATH' ) || exit; /** @@ -77,7 +76,7 @@ public function register_routes() { 'callback' => [ $this, 'update_settings' ], 'permission_callback' => [ $this, 'check_permission' ], 'args' => [ - 'is_wcpay_enabled' => [ + 'is_wcpay_enabled' => [ 'description' => sprintf( /* translators: %s: WooPayments */ __( 'If %s should be enabled.', 'woocommerce-payments' ), @@ -86,7 +85,7 @@ public function register_routes() { 'type' => 'boolean', 'validate_callback' => 'rest_validate_request_arg', ], - 'enabled_payment_method_ids' => [ + 'enabled_payment_method_ids' => [ 'description' => __( 'Payment method IDs that should be enabled. Other methods will be disabled.', 'woocommerce-payments' ), 'type' => 'array', 'items' => [ @@ -95,7 +94,7 @@ public function register_routes() { ], 'validate_callback' => 'rest_validate_request_arg', ], - 'is_manual_capture_enabled' => [ + 'is_manual_capture_enabled' => [ 'description' => sprintf( /* translators: %s: WooPayments */ __( 'If %s manual capture of charges should be enabled.', 'woocommerce-payments' ), @@ -104,7 +103,7 @@ public function register_routes() { 'type' => 'boolean', 'validate_callback' => 'rest_validate_request_arg', ], - 'is_saved_cards_enabled' => [ + 'is_saved_cards_enabled' => [ 'description' => sprintf( /* translators: %s: WooPayments */ __( 'If %s "Saved cards" should be enabled.', 'woocommerce-payments' ), @@ -113,7 +112,7 @@ public function register_routes() { 'type' => 'boolean', 'validate_callback' => 'rest_validate_request_arg', ], - 'is_test_mode_enabled' => [ + 'is_test_mode_enabled' => [ 'description' => sprintf( /* translators: %s: WooPayments */ __( '%s test mode setting.', 'woocommerce-payments' ), @@ -122,7 +121,7 @@ public function register_routes() { 'type' => 'boolean', 'validate_callback' => 'rest_validate_request_arg', ], - 'is_multi_currency_enabled' => [ + 'is_multi_currency_enabled' => [ 'description' => sprintf( /* translators: %s: WooPayments */ __( '%s Multi-Currency feature flag setting.', 'woocommerce-payments' ), @@ -131,7 +130,7 @@ public function register_routes() { 'type' => 'boolean', 'validate_callback' => 'rest_validate_request_arg', ], - 'is_wcpay_subscription_enabled' => [ + 'is_wcpay_subscription_enabled' => [ 'description' => sprintf( /* translators: %s: WooPayments */ __( '%s Subscriptions feature flag setting.', 'woocommerce-payments' ), @@ -140,7 +139,7 @@ public function register_routes() { 'type' => 'boolean', 'validate_callback' => 'rest_validate_request_arg', ], - 'account_statement_descriptor' => [ + 'account_statement_descriptor' => [ 'description' => sprintf( /* translators: %s: WooPayments */ __( '%s bank account descriptor to be displayed in customers\' bank accounts.', 'woocommerce-payments' ), @@ -149,62 +148,62 @@ public function register_routes() { 'type' => 'string', 'validate_callback' => [ $this, 'validate_statement_descriptor' ], ], - 'account_business_name' => [ + 'account_business_name' => [ 'description' => __( 'The customer-facing business name.', 'woocommerce-payments' ), 'type' => 'string', ], - 'account_business_url' => [ + 'account_business_url' => [ 'description' => __( 'The business’s publicly available website.', 'woocommerce-payments' ), 'type' => 'string', ], - 'account_business_support_address' => [ + 'account_business_support_address' => [ 'description' => __( 'A publicly available mailing address for sending support issues to.', 'woocommerce-payments' ), 'type' => 'object', 'validate_callback' => [ $this, 'validate_business_support_address' ], ], - 'account_business_support_email' => [ + 'account_business_support_email' => [ 'description' => __( 'A publicly available email address for sending support issues to.', 'woocommerce-payments' ), 'type' => 'string', 'validate_callback' => [ $this, 'validate_business_support_email_address' ], ], - 'account_business_support_phone' => [ + 'account_business_support_phone' => [ 'description' => __( 'A publicly available phone number to call with support issues.', 'woocommerce-payments' ), 'type' => 'string', 'validate_callback' => [ $this, 'validate_business_support_phone' ], ], - 'account_branding_logo' => [ + 'account_branding_logo' => [ 'description' => __( 'A logo id for the account that will be used in Checkout', 'woocommerce-payments' ), 'type' => 'string', ], - 'account_branding_icon' => [ + 'account_branding_icon' => [ 'description' => __( 'An icon for the account.', 'woocommerce-payments' ), 'type' => 'string', ], - 'account_branding_primary_color' => [ + 'account_branding_primary_color' => [ 'description' => __( 'A CSS hex color value representing the primary branding color for this account.', 'woocommerce-payments' ), 'type' => 'string', ], - 'account_branding_secondary_color' => [ + 'account_branding_secondary_color' => [ 'description' => __( 'A CSS hex color value representing the secondary branding color for this account.', 'woocommerce-payments' ), 'type' => 'string', ], - 'deposit_schedule_interval' => [ + 'deposit_schedule_interval' => [ 'description' => __( 'An interval for deposit scheduling.', 'woocommerce-payments' ), 'type' => 'string', ], - 'deposit_schedule_weekly_anchor' => [ + 'deposit_schedule_weekly_anchor' => [ 'description' => __( 'Weekly anchor for deposit scheduling when interval is set to weekly', 'woocommerce-payments' ), 'type' => 'string', ], - 'deposit_schedule_monthly_anchor' => [ + 'deposit_schedule_monthly_anchor' => [ 'description' => __( 'Monthly anchor for deposit scheduling when interval is set to monthly', 'woocommerce-payments' ), 'type' => [ 'integer', 'null' ], ], - 'reporting_export_language' => [ + 'reporting_export_language' => [ 'description' => __( 'The language for an exported report for transactions, deposits, or disputes.', 'woocommerce-payments' ), 'type' => 'string', ], - 'is_payment_request_enabled' => [ + 'is_payment_request_enabled' => [ 'description' => sprintf( /* translators: %s: WooPayments */ __( 'If %s express checkouts should be enabled.', 'woocommerce-payments' ), @@ -213,7 +212,7 @@ public function register_routes() { 'type' => 'boolean', 'validate_callback' => 'rest_validate_request_arg', ], - 'payment_request_enabled_locations' => [ + 'payment_request_enabled_locations' => [ 'description' => __( 'Express checkout locations that should be enabled.', 'woocommerce-payments' ), 'type' => 'array', 'items' => [ @@ -222,7 +221,7 @@ public function register_routes() { ], 'validate_callback' => 'rest_validate_request_arg', ], - 'payment_request_button_type' => [ + 'payment_request_button_type' => [ 'description' => __( '1-click checkout button types.', 'woocommerce-payments' ), 'type' => 'string', 'items' => [ @@ -231,7 +230,7 @@ public function register_routes() { ], 'validate_callback' => 'rest_validate_request_arg', ], - 'payment_request_button_size' => [ + 'payment_request_button_size' => [ 'description' => __( '1-click checkout button sizes.', 'woocommerce-payments' ), 'type' => 'string', 'items' => [ @@ -241,7 +240,7 @@ public function register_routes() { ], 'validate_callback' => 'rest_validate_request_arg', ], - 'payment_request_button_theme' => [ + 'payment_request_button_theme' => [ 'description' => __( '1-click checkout button themes.', 'woocommerce-payments' ), 'type' => 'string', 'items' => [ @@ -250,22 +249,27 @@ public function register_routes() { ], 'validate_callback' => 'rest_validate_request_arg', ], - 'is_woopay_enabled' => [ + 'payment_request_button_border_radius' => [ + 'description' => __( '1-click checkout button border radius.', 'woocommerce-payments' ), + 'type' => 'integer', + 'validate_callback' => 'rest_validate_request_arg', + ], + 'is_woopay_enabled' => [ 'description' => __( 'If WooPay should be enabled.', 'woocommerce-payments' ), 'type' => 'boolean', 'validate_callback' => 'rest_validate_request_arg', ], - 'woopay_custom_message' => [ + 'woopay_custom_message' => [ 'description' => __( 'Custom message to display to WooPay customers.', 'woocommerce-payments' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ], - 'woopay_store_logo' => [ + 'woopay_store_logo' => [ 'description' => __( 'Store logo to display to WooPay customers.', 'woocommerce-payments' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ], - 'woopay_enabled_locations' => [ + 'woopay_enabled_locations' => [ 'description' => __( 'Express checkout locations that should be enabled.', 'woocommerce-payments' ), 'type' => 'array', 'items' => [ @@ -275,22 +279,22 @@ public function register_routes() { 'default' => array_keys( $wcpay_form_fields['payment_request_button_locations']['options'] ), 'validate_callback' => 'rest_validate_request_arg', ], - 'is_stripe_billing_enabled' => [ + 'is_stripe_billing_enabled' => [ 'description' => __( 'If Stripe Billing is enabled.', 'woocommerce-payments' ), 'type' => 'boolean', 'validate_callback' => 'rest_validate_request_arg', ], - 'is_migrating_stripe_billing' => [ + 'is_migrating_stripe_billing' => [ 'description' => __( 'Whether there is a Stripe Billing off-site to on-site billing migration in progress.', 'woocommerce-payments' ), 'type' => 'boolean', 'validate_callback' => 'rest_validate_request_arg', ], - 'stripe_billing_subscription_count' => [ + 'stripe_billing_subscription_count' => [ 'description' => __( 'The number of subscriptions using Stripe Billing', 'woocommerce-payments' ), 'type' => 'int', 'validate_callback' => 'rest_validate_request_arg', ], - 'stripe_billing_migrated_count' => [ + 'stripe_billing_migrated_count' => [ 'description' => __( 'The number of subscriptions migrated from Stripe Billing to on-site billing.', 'woocommerce-payments' ), 'type' => 'int', 'validate_callback' => 'rest_validate_request_arg', @@ -470,60 +474,61 @@ public function get_settings(): WP_REST_Response { return new WP_REST_Response( [ - 'enabled_payment_method_ids' => $enabled_payment_methods, - 'available_payment_method_ids' => $available_upe_payment_methods, - 'payment_method_statuses' => $this->wcpay_gateway->get_upe_enabled_payment_method_statuses(), - 'duplicated_payment_method_ids' => $this->wcpay_gateway->find_duplicates(), - 'is_wcpay_enabled' => $this->wcpay_gateway->is_enabled(), - 'is_manual_capture_enabled' => 'yes' === $this->wcpay_gateway->get_option( 'manual_capture' ), - 'is_test_mode_enabled' => WC_Payments::mode()->is_test(), - 'is_dev_mode_enabled' => WC_Payments::mode()->is_dev(), - 'is_multi_currency_enabled' => WC_Payments_Features::is_customer_multi_currency_enabled(), - 'is_wcpay_subscriptions_enabled' => WC_Payments_Features::is_wcpay_subscriptions_enabled(), - 'is_stripe_billing_enabled' => WC_Payments_Features::is_stripe_billing_enabled(), - 'is_wcpay_subscriptions_eligible' => WC_Payments_Features::is_wcpay_subscriptions_eligible(), - 'is_subscriptions_plugin_active' => $this->wcpay_gateway->is_subscriptions_plugin_active(), - 'account_country' => $this->wcpay_gateway->get_option( 'account_country' ), - 'account_statement_descriptor' => $this->wcpay_gateway->get_option( 'account_statement_descriptor' ), - 'account_statement_descriptor_kanji' => $this->wcpay_gateway->get_option( 'account_statement_descriptor_kanji' ), - 'account_statement_descriptor_kana' => $this->wcpay_gateway->get_option( 'account_statement_descriptor_kana' ), - 'account_business_name' => $this->wcpay_gateway->get_option( 'account_business_name' ), - 'account_business_url' => $this->wcpay_gateway->get_option( 'account_business_url' ), - 'account_business_support_address' => $this->wcpay_gateway->get_option( 'account_business_support_address' ), - 'account_business_support_email' => $this->wcpay_gateway->get_option( 'account_business_support_email' ), - 'account_business_support_phone' => $this->wcpay_gateway->get_option( 'account_business_support_phone' ), - 'account_branding_logo' => $this->wcpay_gateway->get_option( 'account_branding_logo' ), - 'account_branding_icon' => $this->wcpay_gateway->get_option( 'account_branding_icon' ), - 'account_branding_primary_color' => $this->wcpay_gateway->get_option( 'account_branding_primary_color' ), - 'account_branding_secondary_color' => $this->wcpay_gateway->get_option( 'account_branding_secondary_color' ), - 'account_domestic_currency' => $this->wcpay_gateway->get_option( 'account_domestic_currency' ), - 'is_payment_request_enabled' => 'yes' === $this->wcpay_gateway->get_option( 'payment_request' ), - 'is_debug_log_enabled' => 'yes' === $this->wcpay_gateway->get_option( 'enable_logging' ), - 'payment_request_enabled_locations' => $this->wcpay_gateway->get_option( 'payment_request_button_locations' ), - 'payment_request_button_size' => $this->wcpay_gateway->get_option( 'payment_request_button_size' ), - 'payment_request_button_type' => $this->wcpay_gateway->get_option( 'payment_request_button_type' ), - 'payment_request_button_theme' => $this->wcpay_gateway->get_option( 'payment_request_button_theme' ), - 'is_saved_cards_enabled' => $this->wcpay_gateway->is_saved_cards_enabled(), - 'is_card_present_eligible' => $this->wcpay_gateway->is_card_present_eligible() && isset( WC()->payment_gateways()->get_available_payment_gateways()['cod'] ), - 'is_woopay_enabled' => 'yes' === $this->wcpay_gateway->get_option( 'platform_checkout' ), - 'show_woopay_incompatibility_notice' => get_option( 'woopay_invalid_extension_found', false ), + 'enabled_payment_method_ids' => $enabled_payment_methods, + 'available_payment_method_ids' => $available_upe_payment_methods, + 'payment_method_statuses' => $this->wcpay_gateway->get_upe_enabled_payment_method_statuses(), + 'duplicated_payment_method_ids' => $this->wcpay_gateway->find_duplicates(), + 'is_wcpay_enabled' => $this->wcpay_gateway->is_enabled(), + 'is_manual_capture_enabled' => 'yes' === $this->wcpay_gateway->get_option( 'manual_capture' ), + 'is_test_mode_enabled' => WC_Payments::mode()->is_test(), + 'is_dev_mode_enabled' => WC_Payments::mode()->is_dev(), + 'is_multi_currency_enabled' => WC_Payments_Features::is_customer_multi_currency_enabled(), + 'is_wcpay_subscriptions_enabled' => WC_Payments_Features::is_wcpay_subscriptions_enabled(), + 'is_stripe_billing_enabled' => WC_Payments_Features::is_stripe_billing_enabled(), + 'is_wcpay_subscriptions_eligible' => WC_Payments_Features::is_wcpay_subscriptions_eligible(), + 'is_subscriptions_plugin_active' => $this->wcpay_gateway->is_subscriptions_plugin_active(), + 'account_country' => $this->wcpay_gateway->get_option( 'account_country' ), + 'account_statement_descriptor' => $this->wcpay_gateway->get_option( 'account_statement_descriptor' ), + 'account_statement_descriptor_kanji' => $this->wcpay_gateway->get_option( 'account_statement_descriptor_kanji' ), + 'account_statement_descriptor_kana' => $this->wcpay_gateway->get_option( 'account_statement_descriptor_kana' ), + 'account_business_name' => $this->wcpay_gateway->get_option( 'account_business_name' ), + 'account_business_url' => $this->wcpay_gateway->get_option( 'account_business_url' ), + 'account_business_support_address' => $this->wcpay_gateway->get_option( 'account_business_support_address' ), + 'account_business_support_email' => $this->wcpay_gateway->get_option( 'account_business_support_email' ), + 'account_business_support_phone' => $this->wcpay_gateway->get_option( 'account_business_support_phone' ), + 'account_branding_logo' => $this->wcpay_gateway->get_option( 'account_branding_logo' ), + 'account_branding_icon' => $this->wcpay_gateway->get_option( 'account_branding_icon' ), + 'account_branding_primary_color' => $this->wcpay_gateway->get_option( 'account_branding_primary_color' ), + 'account_branding_secondary_color' => $this->wcpay_gateway->get_option( 'account_branding_secondary_color' ), + 'account_domestic_currency' => $this->wcpay_gateway->get_option( 'account_domestic_currency' ), + 'is_payment_request_enabled' => 'yes' === $this->wcpay_gateway->get_option( 'payment_request' ), + 'is_debug_log_enabled' => 'yes' === $this->wcpay_gateway->get_option( 'enable_logging' ), + 'payment_request_enabled_locations' => $this->wcpay_gateway->get_option( 'payment_request_button_locations' ), + 'payment_request_button_size' => $this->wcpay_gateway->get_option( 'payment_request_button_size' ), + 'payment_request_button_type' => $this->wcpay_gateway->get_option( 'payment_request_button_type' ), + 'payment_request_button_theme' => $this->wcpay_gateway->get_option( 'payment_request_button_theme' ), + 'payment_request_button_border_radius' => WC_Payments_Features::is_stripe_ece_enabled() ? $this->wcpay_gateway->get_option( 'payment_request_button_border_radius', WC_Payments_Express_Checkout_Button_Handler::DEFAULT_BORDER_RADIUS_IN_PX ) : WC_Payments_Express_Checkout_Button_Handler::DEFAULT_BORDER_RADIUS_IN_PX, + 'is_saved_cards_enabled' => $this->wcpay_gateway->is_saved_cards_enabled(), + 'is_card_present_eligible' => $this->wcpay_gateway->is_card_present_eligible() && isset( WC()->payment_gateways()->get_available_payment_gateways()['cod'] ), + 'is_woopay_enabled' => 'yes' === $this->wcpay_gateway->get_option( 'platform_checkout' ), + 'show_woopay_incompatibility_notice' => get_option( 'woopay_invalid_extension_found', false ), 'show_express_checkout_incompatibility_notice' => $this->should_show_express_checkout_incompatibility_notice(), - 'woopay_custom_message' => $this->wcpay_gateway->get_option( 'platform_checkout_custom_message' ), - 'woopay_store_logo' => $this->wcpay_gateway->get_option( 'platform_checkout_store_logo' ), - 'woopay_enabled_locations' => $this->wcpay_gateway->get_option( 'platform_checkout_button_locations', array_keys( $wcpay_form_fields['payment_request_button_locations']['options'] ) ), - 'deposit_schedule_interval' => $this->wcpay_gateway->get_option( 'deposit_schedule_interval' ), - 'deposit_schedule_monthly_anchor' => $this->wcpay_gateway->get_option( 'deposit_schedule_monthly_anchor' ), - 'deposit_schedule_weekly_anchor' => $this->wcpay_gateway->get_option( 'deposit_schedule_weekly_anchor' ), - 'deposit_delay_days' => $this->wcpay_gateway->get_option( 'deposit_delay_days' ), - 'deposit_status' => $this->wcpay_gateway->get_option( 'deposit_status' ), - 'deposit_restrictions' => $this->wcpay_gateway->get_option( 'deposit_restrictions' ), - 'deposit_completed_waiting_period' => $this->wcpay_gateway->get_option( 'deposit_completed_waiting_period' ), - 'reporting_export_language' => $this->wcpay_gateway->get_option( 'reporting_export_language' ), - 'current_protection_level' => $this->wcpay_gateway->get_option( 'current_protection_level' ), - 'advanced_fraud_protection_settings' => $this->wcpay_gateway->get_option( 'advanced_fraud_protection_settings' ), - 'is_migrating_stripe_billing' => $is_migrating_stripe_billing ?? false, - 'stripe_billing_subscription_count' => $stripe_billing_subscription_count ?? 0, - 'stripe_billing_migrated_count' => $stripe_billing_migrated_count ?? 0, + 'woopay_custom_message' => $this->wcpay_gateway->get_option( 'platform_checkout_custom_message' ), + 'woopay_store_logo' => $this->wcpay_gateway->get_option( 'platform_checkout_store_logo' ), + 'woopay_enabled_locations' => $this->wcpay_gateway->get_option( 'platform_checkout_button_locations', array_keys( $wcpay_form_fields['payment_request_button_locations']['options'] ) ), + 'deposit_schedule_interval' => $this->wcpay_gateway->get_option( 'deposit_schedule_interval' ), + 'deposit_schedule_monthly_anchor' => $this->wcpay_gateway->get_option( 'deposit_schedule_monthly_anchor' ), + 'deposit_schedule_weekly_anchor' => $this->wcpay_gateway->get_option( 'deposit_schedule_weekly_anchor' ), + 'deposit_delay_days' => $this->wcpay_gateway->get_option( 'deposit_delay_days' ), + 'deposit_status' => $this->wcpay_gateway->get_option( 'deposit_status' ), + 'deposit_restrictions' => $this->wcpay_gateway->get_option( 'deposit_restrictions' ), + 'deposit_completed_waiting_period' => $this->wcpay_gateway->get_option( 'deposit_completed_waiting_period' ), + 'reporting_export_language' => $this->wcpay_gateway->get_option( 'reporting_export_language' ), + 'current_protection_level' => $this->wcpay_gateway->get_option( 'current_protection_level' ), + 'advanced_fraud_protection_settings' => $this->wcpay_gateway->get_option( 'advanced_fraud_protection_settings' ), + 'is_migrating_stripe_billing' => $is_migrating_stripe_billing ?? false, + 'stripe_billing_subscription_count' => $stripe_billing_subscription_count ?? 0, + 'stripe_billing_migrated_count' => $stripe_billing_migrated_count ?? 0, ] ); } @@ -823,9 +828,10 @@ private function update_payment_request_enabled_locations( WP_REST_Request $requ */ private function update_payment_request_appearance( WP_REST_Request $request ) { $attributes = [ - 'payment_request_button_type' => 'payment_request_button_type', - 'payment_request_button_size' => 'payment_request_button_size', - 'payment_request_button_theme' => 'payment_request_button_theme', + 'payment_request_button_type' => 'payment_request_button_type', + 'payment_request_button_size' => 'payment_request_button_size', + 'payment_request_button_theme' => 'payment_request_button_theme', + 'payment_request_button_border_radius' => 'payment_request_button_border_radius', ]; foreach ( $attributes as $request_key => $attribute ) { if ( ! $request->has_param( $request_key ) ) { diff --git a/includes/class-wc-payments-features.php b/includes/class-wc-payments-features.php index 51cbc9686d1..4336b059932 100644 --- a/includes/class-wc-payments-features.php +++ b/includes/class-wc-payments-features.php @@ -388,6 +388,7 @@ public static function to_array() { 'isDisputeIssuerEvidenceEnabled' => self::is_dispute_issuer_evidence_enabled(), 'isRefundControlsEnabled' => self::is_streamline_refunds_enabled(), 'isPaymentOverviewWidgetEnabled' => self::is_payment_overview_widget_ui_enabled(), + 'isStripeEceEnabled' => self::is_stripe_ece_enabled(), ] ); } diff --git a/includes/class-wc-payments-woopay-button-handler.php b/includes/class-wc-payments-woopay-button-handler.php index d5fb2005cc6..0cf57cac7f1 100644 --- a/includes/class-wc-payments-woopay-button-handler.php +++ b/includes/class-wc-payments-woopay-button-handler.php @@ -333,6 +333,7 @@ public function display_woopay_button_html() { } $settings = $this->get_button_settings(); + $radius = WC_Payments_Features::is_stripe_ece_enabled() ? $settings['radius'] : WC_Payments_Express_Checkout_Button_Handler::DEFAULT_BORDER_RADIUS_IN_PX; ?>
express_checkout_helper->is_product() ); ?>> @@ -343,7 +344,7 @@ class="woopay-express-button" data-type="" data-theme="" data-size="" - style="height: px" + style="height: px; border-radius: px" disabled >
diff --git a/includes/express-checkout/class-wc-payments-express-checkout-button-handler.php b/includes/express-checkout/class-wc-payments-express-checkout-button-handler.php index 31a75ffbe0c..444977bfb90 100644 --- a/includes/express-checkout/class-wc-payments-express-checkout-button-handler.php +++ b/includes/express-checkout/class-wc-payments-express-checkout-button-handler.php @@ -17,7 +17,8 @@ * WC_Payments_Express_Checkout_Button_Handler class. */ class WC_Payments_Express_Checkout_Button_Handler { - const BUTTON_LOCATIONS = 'payment_request_button_locations'; + const BUTTON_LOCATIONS = 'payment_request_button_locations'; + const DEFAULT_BORDER_RADIUS_IN_PX = 4; /** * WC_Payments_Account instance to get information about the account diff --git a/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php b/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php index 08a2fad1014..378a2c4d7c5 100644 --- a/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php +++ b/includes/express-checkout/class-wc-payments-express-checkout-button-helper.php @@ -249,11 +249,17 @@ public function is_available_at( $location, $option_name ) { */ public function get_common_button_settings() { $button_type = $this->gateway->get_option( 'payment_request_button_type' ); - return [ + $settings = [ 'type' => $button_type, 'theme' => $this->gateway->get_option( 'payment_request_button_theme' ), 'height' => $this->get_button_height(), ]; + + if ( WC_Payments_Features::is_stripe_ece_enabled() ) { + $settings['radius'] = $this->gateway->get_option( 'payment_request_button_border_radius' ); + } + + return $settings; } /**