From 9b9dfc68ba6bbbc2076b9a23d876a4d807359ffd Mon Sep 17 00:00:00 2001 From: Razorpay Date: Mon, 13 Jan 2025 10:04:14 +0530 Subject: [PATCH 1/2] PO-272 validation for instrumentation --- includes/plugin-instrumentation.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/plugin-instrumentation.php b/includes/plugin-instrumentation.php index 2f36f3f5..7b60f75b 100644 --- a/includes/plugin-instrumentation.php +++ b/includes/plugin-instrumentation.php @@ -275,7 +275,11 @@ public function getDefaultProperties($timestamp = true) } $paymentSettings = get_option('woocommerce_razorpay_settings'); -if ($paymentSettings !== false) +if (($paymentSettings !== false) and + (isset($paymentSettings['key_id']) === true) and + (empty($paymentSettings['key_id']) === false) and + (isset($paymentSettings['key_secret']) === true) and + (empty($paymentSettings['key_secret']) === false)) { $api = new Api($paymentSettings['key_id'], $paymentSettings['key_secret']); From 6979d38c8608b0cc250afacaf0a7728da02c1549 Mon Sep 17 00:00:00 2001 From: Razorpay Date: Mon, 13 Jan 2025 17:53:33 +0530 Subject: [PATCH 2/2] return if key_id is empty --- woo-razorpay.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/woo-razorpay.php b/woo-razorpay.php index fe1e36db..e8d2fee2 100644 --- a/woo-razorpay.php +++ b/woo-razorpay.php @@ -460,6 +460,11 @@ public function init_form_fields() $api = $this->getRazorpayApiInstance(); } + if (empty($key_id) === true) + { + return; + } + $merchantPreferences = $api->request->request('GET', 'accounts/me/features'); if (isset($merchantPreferences) === false or isset($merchantPreferences['assigned_features']) === false)