Require 3DS by default for PSD2 shop countries

This commit is contained in:
Alex P 2021-11-30 14:47:34 +02:00
parent ebabc45dbc
commit 521cbf4e26
2 changed files with 41 additions and 1 deletions

View file

@ -335,6 +335,13 @@ return array(
$location = wc_get_base_location();
return $location['country'];
},
'api.shop.is-psd2-country' => static function ( ContainerInterface $container ) : bool {
return in_array(
$container->get( 'api.shop.country' ),
$container->get( 'api.psd2-countries' ),
true
);
},
/**
* Currencies supported by PayPal.
@ -538,4 +545,37 @@ return array(
),
);
},
'api.psd2-countries' => static function ( ContainerInterface $container ) : array {
return array(
'AT',
'BE',
'BG',
'CY',
'CZ',
'DK',
'EE',
'FI',
'FR',
'DE',
'GB',
'GR',
'HU',
'IE',
'IT',
'LV',
'LT',
'LU',
'MT',
'NL',
'NO',
'PL',
'PT',
'RO',
'SK',
'SI',
'ES',
'SE',
);
},
);

View file

@ -1907,7 +1907,7 @@ return array(
),
'class' => array(),
'input_class' => array( 'wc-enhanced-select' ),
'default' => 'SCA_WHEN_REQUIRED',
'default' => $container->get( 'api.shop.is-psd2-country' ) ? '3D_SECURE' : 'NO_3D_SECURE',
'desc_tip' => true,
'options' => array(
'NO_3D_SECURE' => __( 'No 3D Secure (transaction will be denied if 3D Secure is required)', 'woocommerce-paypal-payments' ),