From a6413da67a4579866f0fd0323ddb23a7b6b9654a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 18 Sep 2026 17:00:53 +0000
Subject: [PATCH] =Cleaning up the Integrations setup a bit, started the Helcim integration work too

---
 inc/rest/routes/IntegrationsRoutes.php |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/inc/rest/routes/IntegrationsRoutes.php b/inc/rest/routes/IntegrationsRoutes.php
index 8df07a2..838cdd5 100644
--- a/inc/rest/routes/IntegrationsRoutes.php
+++ b/inc/rest/routes/IntegrationsRoutes.php
@@ -58,19 +58,16 @@
 
 		$theUserID = current_user_can('manage_options') ? null : get_current_user_id();
 		if ($theUserID === false) {
+			error_log('User not logged in');
 			return $this->validationError(['message' => 'Not logged in']);
 		}
-		$integration = $this->getService($service);
-		if (!method_exists($integration, 'switchUser')) {
-			return $this->validationError(['message' => 'Cannot get user integration']);
-		}
+		$integration = $this->getServiceUser($service, $theUserID);
 
 		if (!$integration || !method_exists($integration, 'processAction')) {
+			error_log('No processAction method');
 			return $this->validationError(['message'=>'Invalid service']);
 		}
 
-		$integration->switchUser($theUserID);
-
 		$integration->getCredentials();
 
 		// Handle the action
@@ -86,6 +83,7 @@
 			return $this->success($result);
 
 		} catch (Exception $e) {
+			error_log(print_r($e->getMessage(), true));
 			return $this->error($e->getMessage());
 		}
 	}

--
Gitblit v1.10.0