From c204185ae86a98994f80010abf35a190c9406739 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 12 Jul 2026 18:08:19 +0000
Subject: [PATCH] =Refactor of Integrations.php. Separated different functionality into traits that classes can use to add that functionality. Hopefully will make maintaining it a little easier. Still have to finish up, as well as refactoring the individual classes to utilize the new system.
---
inc/rest/routes/IntegrationsHelcimRoutes.php | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/inc/rest/routes/IntegrationsHelcimRoutes.php b/inc/rest/routes/IntegrationsHelcimRoutes.php
index 6476e16..b626ecb 100644
--- a/inc/rest/routes/IntegrationsHelcimRoutes.php
+++ b/inc/rest/routes/IntegrationsHelcimRoutes.php
@@ -55,7 +55,10 @@
public function handleInitializeCheckout(WP_REST_Request $request): WP_REST_Response
{
$data = $request->get_json_params();
- $user_id = absint($data['user'] ?? get_current_user_id());
+ $user_id = get_current_user_id();
+ if (!$user_id) {
+ return $this->unauthorized();
+ }
if (empty($data['amount'])) {
return $this->validationError(['message' => 'Amount is required']);
@@ -88,7 +91,7 @@
*/
public function getInvoices(WP_REST_Request $request): WP_REST_Response
{
- $user_id = absint($request->get_param('user') ?? get_current_user_id());
+ $user_id = get_current_user_id();
if (!$user_id) {
return $this->validationError(['message' => 'Not logged in']);
@@ -135,7 +138,7 @@
*/
public function getSavedCards(WP_REST_Request $request): WP_REST_Response
{
- $user_id = absint($request->get_param('user') ?? get_current_user_id());
+ $user_id = get_current_user_id();
if (!$user_id) {
return $this->validationError(['message' => 'Not logged in']);
--
Gitblit v1.10.0