From 3d25ad7de4fdbb3eba2cde2a62422e6be5d79a0a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 25 Aug 2026 22:57:22 +0000
Subject: [PATCH] =It's been a minute. I went through the Routes and associated Managers and ensured they played together well. Reworked the Cache.php, and I think I caught all the references. Moving away from JVBase() root class, to individuall classes that are Instanced. Double checked for the ABSPATH check in every file, and added index.php to every directory that didn't already have it. Also still working on the MenuBlock to work with WooCommerce for now for Northeh
---
inc/rest/routes/IntegrationsHelcimRoutes.php | 48 +++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/inc/rest/routes/IntegrationsHelcimRoutes.php b/inc/rest/routes/IntegrationsHelcimRoutes.php
index b626ecb..f735618 100644
--- a/inc/rest/routes/IntegrationsHelcimRoutes.php
+++ b/inc/rest/routes/IntegrationsHelcimRoutes.php
@@ -1,6 +1,9 @@
<?php
namespace JVBase\rest\routes;
+use JVBase\base\Site;
+use JVBase\Instance;
+use JVBase\integrations\services\Helcim;
use JVBase\rest\Rest;
use JVBase\rest\Route;
use WP_REST_Request;
@@ -13,6 +16,7 @@
class IntegrationsHelcimRoutes extends Rest
{
+ use Instance;
public function registerRoutes(): void
{
Route::for('helcim/initialize-checkout')
@@ -56,6 +60,9 @@
{
$data = $request->get_json_params();
$user_id = get_current_user_id();
+ if (!Site::hasIntegration('helcim')) {
+ return $this->validationError(['message' => 'Helcim not setup']);
+ }
if (!$user_id) {
return $this->unauthorized();
}
@@ -65,7 +72,12 @@
}
try {
- $helcim = JVB()->connect('helcim');
+ $helcim = Helcim::getInstance();
+ if (!method_exists($helcim, 'resolveCustomerId') ||
+ !method_exists($helcim, 'initializeCheckout')
+ ) {
+ return $this->validationError(['message' => 'Helcim not complete']);
+ }
// Auto-resolve customer ID from logged-in user
if (empty($data['customerId']) && $user_id) {
@@ -96,9 +108,16 @@
if (!$user_id) {
return $this->validationError(['message' => 'Not logged in']);
}
+ if (!Site::hasIntegration('helcim')) {
+ return $this->validationError(['message' => 'Helcim not setup']);
+ }
+
try {
- $helcim = JVB()->connect('helcim');
+ $helcim = Helcim::getInstance();
+ if (!method_exists($helcim, 'handleGetInvoices')) {
+ return $this->validationError(['message' => 'Helcim not complete']);
+ }
$user = get_userdata($user_id);
$result = $helcim->handleGetInvoices([
'email' => $user->user_email,
@@ -122,8 +141,15 @@
return $this->validationError(['message' => 'Invoice ID required']);
}
+ if (!Site::hasIntegration('helcim')) {
+ return $this->validationError(['message' => 'Helcim not setup']);
+ }
+
try {
- $helcim = JVB()->connect('helcim');
+ $helcim = Helcim::getInstance();
+ if (!method_exists($helcim, 'handleGetInvoice')) {
+ return $this->validationError(['message' => 'Helcim not complete']);
+ }
$result = $helcim->handleGetInvoice(['invoiceId' => $invoiceId]);
return $this->success($result);
@@ -143,9 +169,15 @@
if (!$user_id) {
return $this->validationError(['message' => 'Not logged in']);
}
+ if (!Site::hasIntegration('helcim')) {
+ return $this->validationError(['message' => 'Helcim not setup']);
+ }
try {
- $helcim = JVB()->connect('helcim');
+ $helcim = Helcim::getInstance();
+ if (!method_exists($helcim, 'handleGetCustomerCards')) {
+ return $this->validationError(['message' => 'Helcim not complete']);
+ }
$result = $helcim->handleGetCustomerCards([
'email' => get_userdata($user_id)->user_email,
]);
@@ -171,9 +203,15 @@
if (empty($data['secretToken']) || empty($data['transactionData'])) {
return $this->validationError(['message' => 'Missing secretToken or transactionData']);
}
+ if (!Site::hasIntegration('helcim')) {
+ return $this->validationError(['message' => 'Helcim not setup']);
+ }
try {
- $helcim = JVB()->connect('helcim');
+ $helcim = Helcim::getInstance();
+ if (!method_exists($helcim, 'validateTransaction')) {
+ return $this->validationError(['message' => 'Helcim not complete']);
+ }
$valid = $helcim->validateTransaction(
$data['secretToken'],
$data['transactionData']
--
Gitblit v1.10.0