From 7501991a22ace366a66c3b8b9958610fd3cebdf7 Mon Sep 17 00:00:00 2001 From: "daan.rijpkema" Date: Sat, 25 Nov 2023 18:45:09 +0100 Subject: [PATCH] Bug fix not-set IDIN brand ID breaking checkout --- bluem-idin.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bluem-idin.php b/bluem-idin.php index c75cc9c..4915a1f 100644 --- a/bluem-idin.php +++ b/bluem-idin.php @@ -844,11 +844,12 @@ function bluem_idin_shortcode_callback() { $bluem_config = bluem_woocommerce_get_config(); // fallback until this is corrected in bluem-php - $bluem_config->brandID = $bluem_config->IDINBrandID; + $bluem_config->brandID = $bluem_config->IDINBrandID ?? $bluem_config->brandID ?? ''; try { $bluem = new Bluem( $bluem_config ); } catch ( Exception $e ) { + return; // @todo: deal with incorrectly configured Bluem here } @@ -1402,15 +1403,20 @@ function bluem_idin_validation_needed() { $bluem_config = bluem_woocommerce_get_config(); - $bluem_config->brandID = $bluem_config->IDINBrandID; + $bluem_config->brandID = $bluem_config->IDINBrandID ?? $bluem_config->brandID ?? ''; + + if(empty($bluem_config->brandID)) { + return false; + } try { $bluem = new Bluem( $bluem_config ); } catch ( Exception $e ) { - // @todo: deal with non-configured bluem, or assert that is has been configured on a higher level + // @todo: deal with non-configured bluem brandID, or assert that is has been configured on a higher level + return false; } - // Check if IP filtering is enabled + // Check if IP filtering is enabled if ( $idin_enable_ip_country_filtering ) { // override international IP's - don't validate idin when not NL if ( ! $bluem->VerifyIPIsNetherlands() ) {