Fix ABDM consent status showing COMPLETED before data actually arrived
computeConsentSessionDetail() treated any data_fetch/hi_data_push_callback row with status=success as proof the session reached COMPLETED. But the DB 'status' column only reflects whether the underlying API call/poll succeeded (no HTTP/transport error) -- NOT whether data was actually received; that's tracked separately via workflow_state (DATA_PENDING vs DATA_RECEIVED). A data_fetch poll that succeeds at the HTTP level but returns decrypted_data=[] (bridge still processing) was incorrectly marked COMPLETED instead of staying at GRANTED. Now also require workflow_state === DATA_RECEIVED for the COMPLETED phase.
This commit is contained in:
parent
67daaf8894
commit
afd1de04bf
|
|
@ -3849,7 +3849,15 @@ class Patient extends BaseController
|
|||
$phase = 'REQUESTED';
|
||||
$priority = 120;
|
||||
|
||||
if (($operation === 'DATA_FETCH' || $operation === 'HI_DATA_PUSH_CALLBACK') && $status === 'SUCCESS') {
|
||||
// NOTE: the `status` column only reflects whether the underlying API
|
||||
// call/poll succeeded (no HTTP/transport error) — it does NOT mean
|
||||
// data was actually received (see M3HiuWorkflowService::runOperation()
|
||||
// / ingestHealthInformationCallback(), which always set status=success
|
||||
// for any error-free response, even one reporting decrypted_data=[]
|
||||
// and consent/session status "requested"). Whether data truly arrived
|
||||
// is tracked separately in workflow_state (DATA_PENDING vs
|
||||
// DATA_RECEIVED), so require that here instead of the generic status.
|
||||
if (($operation === 'DATA_FETCH' || $operation === 'HI_DATA_PUSH_CALLBACK') && $status === 'SUCCESS' && $state === 'DATA_RECEIVED') {
|
||||
$phase = 'COMPLETED';
|
||||
$priority = 500;
|
||||
} elseif (in_array($rawConsentStatus, ['GRANTED', 'APPROVED', 'ACTIVE'], true)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user