From 4089ba01e0881c89a72332e13bc3a80b6bddec2a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 29 Jun 2026 22:15:55 +0000
Subject: [PATCH] =DashboardManager overhaul. A bit easier to modify the output of pages. Still have to get the account pages to work as expected, as well as verify the integrations and others are working - but registrar/content pages work as expected. Also fixed up the table generation in CRUD.js and CRUDSkeleton.php
---
inc/rest/routes/IntegrationsSquareRoutes.php | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/inc/rest/routes/IntegrationsSquareRoutes.php b/inc/rest/routes/IntegrationsSquareRoutes.php
index 596be1e..ea338e1 100644
--- a/inc/rest/routes/IntegrationsSquareRoutes.php
+++ b/inc/rest/routes/IntegrationsSquareRoutes.php
@@ -20,22 +20,26 @@
Route::for('square/process-payment')
->post([$this, 'handlePaymentProcessing'])
->auth('public')
- ->rateLimit(2);
+ ->rateLimit(2)
+ ->register();
Route::for('square/saved-cards')
->post([$this, 'getSavedCards'])
->auth('user')
- ->rateLimit(5);
+ ->rateLimit(5)
+ ->register();
Route::for('square/order-history')
->get([$this, 'getOrderHistory'])
->auth('user')
- ->rateLimit(5);
+ ->rateLimit(5)
+ ->register();
Route::for(Route::pattern('square/order-status/{order_id}'))
->get([$this, 'getOrderStatus'])
->auth('public')
- ->rateLimit(20);
+ ->rateLimit(20)
+ ->register();
}
//TODO: Are we processing this through our server at all? Or is it in the javascript going straight to square?
@@ -43,6 +47,7 @@
{
$data = $request->get_json_params();
+
// Generate idempotency key from cart_id + timestamp
// This ensures retries use SAME key
$cart_id = $data['cart_id'] ?? '';
@@ -142,9 +147,10 @@
public function getSavedCards(WP_REST_Request $request):WP_REST_Response
{
$data = $request->get_params();
+ error_log('Getting Saved Cards: '.print_r($data, true));
$user_id = absint($data['user']??0);
if ($user_id === 0) {
- return $this->validationError(['message' => 'Not logged in']);
+ return $this->success(['cards' => []]);
}
$square = JVB()->connect('square');
--
Gitblit v1.10.0