From d3a3159a81e8339bf0c69fa104324aafac84d996 Mon Sep 17 00:00:00 2001
From: Jean-Laurent DUZANT <jean-laurent.duzant@xelians.fr>
Date: Wed, 18 Jan 2023 14:00:35 +0100
Subject: [PATCH] FEAT #20284 TIME 0 get queryParams in getReturnFast

---
 rest/index.php                                     | 3 +--
 src/app/workflow/controllers/FastOTPController.php | 6 ++++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/rest/index.php b/rest/index.php
index 7c718c79ae..0e7a0e1465 100755
--- a/rest/index.php
+++ b/rest/index.php
@@ -99,8 +99,7 @@ $app->get('/documents/{id}/history', \History\controllers\HistoryController::cla
 $app->put('/documents/{id}/actions/{actionId}', \Document\controllers\DocumentController::class . ':setAction');
 $app->get('/documents/{id}/workflow', \Workflow\controllers\WorkflowController::class . ':getByDocumentId');
 $app->get('/documents/{id}/workflows/{workflowId}/files/{fileId}', \Workflow\controllers\YousignController::class . ':getByFileId');
-$app->get('/documents/{id}/workflows/{workflowId}/files/{fileId}/fastStatus/{fastStatus}', \Workflow\controllers\FastOTPController::class . ':getReturnFast');
-$app->get('/externalSignatoryBookReturn/{token}/status/{status}', \Workflow\controllers\FastOTPController::class . ':getReturnFast');
+$app->get('/externalSignatoryBookReturn', \Workflow\controllers\FastOTPController::class . ':getReturnFast');
 $app->get('/documents/{id}/linkedMailing', \Document\controllers\DocumentController::class . ':getLinkedMailing');
 $app->get('/documents/{id}/thumbnails/{page}', \Document\controllers\DocumentController::class . ':getThumbnailContent');
 $app->put('/documents/{id}/workflows/interrupt', \Workflow\controllers\WorkflowController::class . ':interrupt');
diff --git a/src/app/workflow/controllers/FastOTPController.php b/src/app/workflow/controllers/FastOTPController.php
index 8ee23d5d05..708fa3ab55 100644
--- a/src/app/workflow/controllers/FastOTPController.php
+++ b/src/app/workflow/controllers/FastOTPController.php
@@ -123,13 +123,15 @@ class FastOTPController
 
     public function getReturnFast(Request $request, Response $response, array $args)
     {
-        $checkToken = FastOTPController::checkToken(['token' => $args['token'] ?? null]);
+        $queryParams = $request->getQueryParams();
+
+        $checkToken = FastOTPController::checkToken(['token' => $queryParams['token'] ?? null]);
         if (!empty($checkToken['errors'])) {
             return $response->withStatus(400)->withJson(['errors' => $checkToken['errors']]);
         }
         $documentId = $checkToken['documentId'];
         $workflowId = $checkToken['workflowId'];
-        $fastStatus = $args['status'] ?? null;
+        $fastStatus = $queryParams['status'] ?? null;
 
 
         $workflow = WorkflowModel::get([
-- 
GitLab