mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Move ensure 3ds contingency logic to woocommerce_paypal_payments_gateway_migrate
action
This commit is contained in:
parent
d12a9d3547
commit
53b017ae31
2 changed files with 11 additions and 20 deletions
|
@ -208,25 +208,6 @@ class SettingsListener {
|
|||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure 3DS contingency use `SCA_ALWAYS` instead of `3D_SECURE`.
|
||||
*
|
||||
* @return void
|
||||
* @throws NotFoundException When a setting was not found.
|
||||
*/
|
||||
public function listen_for_3d_secure_contingency(): void {
|
||||
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§ion=ppcp-gateway' );
|
||||
wp_safe_redirect( $redirect_url, 302 );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listens to the request.
|
||||
*
|
||||
|
|
|
@ -132,6 +132,17 @@ class WCGatewayModule implements ModuleInterface {
|
|||
$endpoint->handle_request();
|
||||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
'woocommerce_paypal_payments_gateway_migrate',
|
||||
static function () use ( $c ) {
|
||||
$settings = $c->get( 'wcgateway.settings' );
|
||||
if ( $settings->get( '3d_secure_contingency' ) === '3D_SECURE' ) {
|
||||
$settings->set( '3d_secure_contingency', 'SCA_ALWAYS' );
|
||||
$settings->persist();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -183,7 +194,6 @@ class WCGatewayModule implements ModuleInterface {
|
|||
*/
|
||||
$listener->listen_for_merchant_id();
|
||||
$listener->listen_for_vaulting_enabled();
|
||||
$listener->listen_for_3d_secure_contingency();
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue