Ensure 3ds contingency uses SCA_ALWAYS instead of 3D_SECURE

This commit is contained in:
dinamiko 2022-02-03 12:05:55 +01:00
parent e080189399
commit 3b0a057b31
3 changed files with 24 additions and 1 deletions

View file

@ -14,9 +14,9 @@ use WooCommerce\PayPalCommerce\ApiClient\Authentication\PayPalBearer;
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\Webhooks\WebhookRegistrar;
use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
/**
* Class SettingsListener
@ -208,6 +208,24 @@ class SettingsListener {
exit;
}
/**
* Ensure 3DS contingency use `SCA_ALWAYS` instead of `3D_SECURE`.
*
* @throws NotFoundException When a setting was not found.
*/
public function listen_for_3d_secure_contingency() {
if ( ! $this->is_valid_site_request() || $this->settings->get( '3d_secure_contingency' ) !== '3D_SECURE' ) {
return;
}
$this->settings->set( '3d_secure_contingency', 'SCA_ALWAYS' );
$this->settings->persist();
$redirect_url = admin_url( 'admin.php?page=wc-settings&tab=checkout&section=ppcp-gateway' );
wp_safe_redirect( $redirect_url, 302 );
exit;
}
/**
* Listens to the request.
*

View file

@ -183,6 +183,7 @@ class WCGatewayModule implements ModuleInterface {
*/
$listener->listen_for_merchant_id();
$listener->listen_for_vaulting_enabled();
$listener->listen_for_3d_secure_contingency();
}
);