Merge branch 'trunk' into PCP-1393-update-to-vault-v-3

This commit is contained in:
Emili Castells Guasch 2023-11-03 11:18:55 +01:00
commit 9aef764ba8
10 changed files with 243 additions and 53 deletions

View file

@ -115,7 +115,7 @@ document.addEventListener(
'currency': PayPalCommerceGatewaySettings.currency,
'integration-date': PayPalCommerceGatewaySettings.integration_date,
'components': PayPalCommerceGatewaySettings.components,
'enable-funding': ['venmo', 'paylater'],
'enable-funding': ['venmo', 'paylater']
};
if (PayPalCommerceGatewaySettings.environment === 'sandbox') {
@ -134,6 +134,11 @@ document.addEventListener(
settings['disable-funding'] = disabledSources;
}
const smartButtonLocale = document.getElementById('ppcp-smart_button_language');
if (smartButtonLocale?.length > 0 && smartButtonLocale?.value !== '') {
settings['locale'] = smartButtonLocale.value;
}
return settings;
}

View file

@ -1422,4 +1422,52 @@ return array(
return new DisplayManager( $settings );
}
),
'wcgateway.wp-paypal-locales-map' => static function( ContainerInterface $container ): array {
return apply_filters(
'woocommerce_paypal_payments_button_locales',
array(
'' => __( 'Browser language', 'woocommerce-paypal-payments' ),
'ar_DZ' => __( 'Arabic (Algeria)', 'woocommerce-paypal-payments' ),
'ar_BH' => __( 'Arabic (Bahrain)', 'woocommerce-paypal-payments' ),
'ar_EG' => __( 'Arabic (Egypt)', 'woocommerce-paypal-payments' ),
'ar_JO' => __( 'Arabic (Jordan)', 'woocommerce-paypal-payments' ),
'ar_KW' => __( 'Arabic (Kuwait)', 'woocommerce-paypal-payments' ),
'ar_MA' => __( 'Arabic (Morocco)', 'woocommerce-paypal-payments' ),
'ar_SA' => __( 'Arabic (Saudi Arabia)', 'woocommerce-paypal-payments' ),
'cs_CZ' => __( 'Czech', 'woocommerce-paypal-payments' ),
'zh_CN' => __( 'Chinese (Simplified)', 'woocommerce-paypal-payments' ),
'zh_HK' => __( 'Chinese (Hong Kong)', 'woocommerce-paypal-payments' ),
'zh_TW' => __( 'Chinese (Traditional)', 'woocommerce-paypal-payments' ),
'da_DK' => __( 'Danish', 'woocommerce-paypal-payments' ),
'nl_NL' => __( 'Dutch', 'woocommerce-paypal-payments' ),
'en_AU' => __( 'English (Australia)', 'woocommerce-paypal-payments' ),
'en_GB' => __( 'English (United Kingdom)', 'woocommerce-paypal-payments' ),
'en_US' => __( 'English (United States)', 'woocommerce-paypal-payments' ),
'fi_FI' => __( 'Finnish', 'woocommerce-paypal-payments' ),
'fr_CA' => __( 'French (Canada)', 'woocommerce-paypal-payments' ),
'fr_FR' => __( 'French (France)', 'woocommerce-paypal-payments' ),
'de_DE' => __( 'German (Germany)', 'woocommerce-paypal-payments' ),
'de_CH' => __( 'German (Switzerland)', 'woocommerce-paypal-payments' ),
'de_AT' => __( 'German (Austria)', 'woocommerce-paypal-payments' ),
'de_LU' => __( 'German (Luxembourg)', 'woocommerce-paypal-payments' ),
'el_GR' => __( 'Greek', 'woocommerce-paypal-payments' ),
'he_IL' => __( 'Hebrew', 'woocommerce-paypal-payments' ),
'hu_HU' => __( 'Hungarian', 'woocommerce-paypal-payments' ),
'id_ID' => __( 'Indonesian', 'woocommerce-paypal-payments' ),
'it_IT' => __( 'Italian', 'woocommerce-paypal-payments' ),
'ja_JP' => __( 'Japanese', 'woocommerce-paypal-payments' ),
'ko_KR' => __( 'Korean', 'woocommerce-paypal-payments' ),
'no_NO' => __( 'Norwegian', 'woocommerce-paypal-payments' ),
'es_ES' => __( 'Spanish (Spain)', 'woocommerce-paypal-payments' ),
'es_MX' => __( 'Spanish (Mexico)', 'woocommerce-paypal-payments' ),
'pl_PL' => __( 'Polish', 'woocommerce-paypal-payments' ),
'pt_BR' => __( 'Portuguese (Brazil)', 'woocommerce-paypal-payments' ),
'pt_PT' => __( 'Portuguese (Portugal)', 'woocommerce-paypal-payments' ),
'ru_RU' => __( 'Russian', 'woocommerce-paypal-payments' ),
'sk_SK' => __( 'Slovak', 'woocommerce-paypal-payments' ),
'sv_SE' => __( 'Swedish', 'woocommerce-paypal-payments' ),
'th_TH' => __( 'Thai', 'woocommerce-paypal-payments' ),
)
);
},
);

View file

@ -71,6 +71,22 @@ return function ( ContainerInterface $container, array $fields ): array {
'requirements' => array(),
'gateway' => 'paypal',
),
'smart_button_language' => array(
'title' => __( 'Smart Button Language', 'woocommerce-paypal-payments' ),
'type' => 'select',
'desc_tip' => true,
'description' => __(
'The language and region used for the displayed PayPal Smart Buttons. The default value is the current language and region setting in a browser.',
'woocommerce-paypal-payments'
),
'class' => array(),
'input_class' => array( 'wc-enhanced-select' ),
'default' => 'en',
'options' => $container->get( 'wcgateway.wp-paypal-locales-map' ),
'screens' => array( State::STATE_ONBOARDED ),
'gateway' => 'paypal',
'requirements' => array(),
),
'smart_button_enable_styling_per_location' => array(
'title' => __( 'Customize Smart Buttons Per Location', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',