From 71e0c7cf24c455cf498f43822dc30d61fb56d4e6 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Tue, 28 Jul 2026 02:07:50 +0530 Subject: [PATCH] Treat transient consent 404 as pending --- app/Controllers/Patient.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index 3bf3d02..4159d46 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -1660,11 +1660,10 @@ class Patient extends BaseController return $this->response->setJSON([ 'ok' => 1, 'phase' => 'REQUESTED', - // Avoid repeated not-found polling loops against bridge. - 'poll_again' => 0, - 'reset_request_id' => 1, + // Keep tracking the same first request; bridge may still be processing callbacks. + 'poll_again' => 1, 'request_id' => $flowRefId, - 'message' => 'Consent status not found on bridge for this request yet. Please retry sync after 1-2 minutes.', + 'message' => 'Consent request is still being processed. Waiting for bridge callback update.', 'data' => [ 'consent_request' => $consentResult, 'consent_reconcile' => $reconcileResult, @@ -3103,8 +3102,8 @@ class Patient extends BaseController $phase = 'DENIED'; $priority = 300; } elseif ($status === 'FAILED' && $httpCode === 404 && stripos($errorText, 'consent record not found') !== false) { - $phase = 'FAILED'; - $priority = 280; + $phase = 'REQUESTED'; + $priority = 200; } elseif ($status === 'FAILED') { $phase = 'FAILED'; $priority = 260; @@ -3121,7 +3120,7 @@ class Patient extends BaseController } elseif ($phase === 'DENIED') { $message = 'Consent was denied/revoked/expired in previous attempt.'; } elseif ($status === 'FAILED' && $httpCode === 404) { - $message = 'Last consent request was not found on bridge. Start a new consent request.'; + $message = 'Last consent request is still being processed by bridge. Please wait and refresh.'; } elseif ($phase === 'FAILED') { $message = 'Last consent request failed. Start a new consent request.'; }