From 849b02e44f895848358369266a9d0e4863c6e8f9 Mon Sep 17 00:00:00 2001 From: dinamiko Date: Mon, 7 Feb 2022 11:07:06 +0100 Subject: [PATCH] Caught `NotFoundException` in case it does not exist --- modules/ppcp-wc-gateway/src/WCGatewayModule.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/ppcp-wc-gateway/src/WCGatewayModule.php b/modules/ppcp-wc-gateway/src/WCGatewayModule.php index a9184bf5c..ee8746ca5 100644 --- a/modules/ppcp-wc-gateway/src/WCGatewayModule.php +++ b/modules/ppcp-wc-gateway/src/WCGatewayModule.php @@ -21,6 +21,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Assets\SettingsPageAssets; use WooCommerce\PayPalCommerce\WcGateway\Checkout\CheckoutPayPalAddressPreset; use WooCommerce\PayPalCommerce\WcGateway\Checkout\DisableGateways; use WooCommerce\PayPalCommerce\WcGateway\Endpoint\ReturnUrlEndpoint; +use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException; use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway; use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway; use WooCommerce\PayPalCommerce\WcGateway\Notice\ConnectAdminNotice; @@ -139,9 +140,13 @@ class WCGatewayModule implements ModuleInterface { $settings = $c->get( 'wcgateway.settings' ); assert( $settings instanceof Settings ); - if ( $settings->get( '3d_secure_contingency' ) === '3D_SECURE' ) { - $settings->set( '3d_secure_contingency', 'SCA_ALWAYS' ); - $settings->persist(); + try { + if ( $settings->get( '3d_secure_contingency' ) === '3D_SECURE' ) { + $settings->set( '3d_secure_contingency', 'SCA_ALWAYS' ); + $settings->persist(); + } + } catch ( NotFoundException $exception ) { + return; } } );