From e783a57c4d18e94500ee1c19255da9f6fd8ba548 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Tue, 28 Jul 2026 23:37:31 +0530 Subject: [PATCH] Fix M3 multi-artifact polling: pollNatGateway now passes consent_request_id (not single resolved artifact id) to data_fetch, so the bridge returns merged sessions across ALL linked HIP facilities in one poll --- app/Libraries/Abdm/M3HiuWorkflowService.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/Libraries/Abdm/M3HiuWorkflowService.php b/app/Libraries/Abdm/M3HiuWorkflowService.php index 4de7184..a59933c 100644 --- a/app/Libraries/Abdm/M3HiuWorkflowService.php +++ b/app/Libraries/Abdm/M3HiuWorkflowService.php @@ -242,11 +242,22 @@ class M3HiuWorkflowService continue; } + // IMPORTANT: use the UMBRELLA consent_request_id here, not a single + // resolved consent artifact id. Multi-facility ABDM M3 consents + // produce ONE consent artifact PER linked HIP facility under the + // same consent_request_id. Per the bridge's own contract, calling + // GET /v1/hiu/data/fetch with the consent_request_id (instead of + // one specific artifact id) returns ALL sessions/artifacts merged + // in a single response (verified 2026-07-28: querying by + // consent_request_id surfaced a sibling artifact that had NEVER + // been seen by HMS before, alongside the originally-tracked one). + // Falls back to a single artifact id only if no request id is + // available (should not normally happen for a granted consent). $resolvedConsentId = trim((string) ( - $consentResult['abdm_consent_artifact_id'] - ?? $consentResult['consent_id'] - ?? $consentResult['abdm_consent_request_id'] + $consentResult['abdm_consent_request_id'] ?? $consentResult['consent_request_id'] + ?? $consentResult['abdm_consent_artifact_id'] + ?? $consentResult['consent_id'] ?? '' )); if ($resolvedConsentId === '' || $this->isGatewayRequestIdPattern($resolvedConsentId)) {