Skip to content

Commit

Permalink
Rename WooPayment related funtion and fix camelcase issue
Browse files Browse the repository at this point in the history
  • Loading branch information
james-allan committed Sep 19, 2024
1 parent bd7dacd commit 1168099
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions client/entrypoints/express-checkout/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ export const getErrorMessageFromNotice = ( notice ) => {
* @return {*|null} Value of the object prop or null.
*/
export const getExpressCheckoutData = ( key ) => {
// eslint-disable-next-line camelcase
const wcStripeExpressCheckoutParams = wc_stripe_express_checkout_params;

if (
// eslint-disable-next-line camelcase
! wc_stripe_express_checkout_params ||
! wc_stripe_express_checkout_params[ key ]
! wcStripeExpressCheckoutParams ||
! wcStripeExpressCheckoutParams[ key ]
) {
return null;
}
return wc_stripe_express_checkout_params[ key ];

return wcStripeExpressCheckoutParams[ key ];
};

/**
Expand Down Expand Up @@ -116,7 +119,8 @@ export const getExpressCheckoutButtonAppearance = () => {
export const getExpressCheckoutButtonStyleSettings = () => {
const buttonSettings = getExpressCheckoutData( 'button' );

const mapWooPaymentsThemeToButtonTheme = ( buttonType, theme ) => {
// Maps the WC Stripe theme from settings to the button theme.
const mapButtonSettingToStripeButtonTheme = ( buttonType, theme ) => {
switch ( theme ) {
case 'dark':
return 'black';
Expand Down Expand Up @@ -156,11 +160,11 @@ export const getExpressCheckoutButtonStyleSettings = () => {
},
layout: { overflow: 'never' },
buttonTheme: {
googlePay: mapWooPaymentsThemeToButtonTheme(
googlePay: mapButtonSettingToStripeButtonTheme(
'googlePay',
buttonSettings.theme ? buttonSettings.theme : 'black'
),
applePay: mapWooPaymentsThemeToButtonTheme(
applePay: mapButtonSettingToStripeButtonTheme(
'applePay',
buttonSettings.theme ? buttonSettings.theme : 'black'
),
Expand Down

0 comments on commit 1168099

Please sign in to comment.