EAtria auth: include bridge hospital id in header and records.push body
This commit is contained in:
parent
c632f28482
commit
bf3345b2ce
|
|
@ -21,6 +21,7 @@ class EAtriaBridgeConnector implements AbdmConnectorInterface
|
||||||
private string $baseUrl;
|
private string $baseUrl;
|
||||||
private string $token;
|
private string $token;
|
||||||
private string $hfrId;
|
private string $hfrId;
|
||||||
|
private string $bridgeHospitalId;
|
||||||
private int $timeoutSec;
|
private int $timeoutSec;
|
||||||
/** @var array<int, string> */
|
/** @var array<int, string> */
|
||||||
private array $tokenCandidates = [];
|
private array $tokenCandidates = [];
|
||||||
|
|
@ -40,6 +41,7 @@ class EAtriaBridgeConnector implements AbdmConnectorInterface
|
||||||
$this->tokenSource = 'config.eatriaBridgeToken';
|
$this->tokenSource = 'config.eatriaBridgeToken';
|
||||||
}
|
}
|
||||||
$this->hfrId = '';
|
$this->hfrId = '';
|
||||||
|
$this->bridgeHospitalId = '';
|
||||||
$this->timeoutSec = (int) ($config->eatriaBridgeTimeoutSec ?? 30);
|
$this->timeoutSec = (int) ($config->eatriaBridgeTimeoutSec ?? 30);
|
||||||
|
|
||||||
// DB (Admin Panel → ABDM Gateway Config) is the authoritative source for
|
// DB (Admin Panel → ABDM Gateway Config) is the authoritative source for
|
||||||
|
|
@ -69,6 +71,8 @@ class EAtriaBridgeConnector implements AbdmConnectorInterface
|
||||||
'ABDM_HFR_ID',
|
'ABDM_HFR_ID',
|
||||||
'H_HFR_ID',
|
'H_HFR_ID',
|
||||||
'ABDM_HOSPITAL_HFR_ID',
|
'ABDM_HOSPITAL_HFR_ID',
|
||||||
|
'ABDM_BRIDGE_HOSPITAL_ID',
|
||||||
|
'EATRIA_BRIDGE_HOSPITAL_ID',
|
||||||
])
|
])
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
@ -119,6 +123,15 @@ class EAtriaBridgeConnector implements AbdmConnectorInterface
|
||||||
if ($dbHfrId !== '') {
|
if ($dbHfrId !== '') {
|
||||||
$this->hfrId = $dbHfrId;
|
$this->hfrId = $dbHfrId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dbBridgeHospitalId = trim((string) (
|
||||||
|
$dbSettings['ABDM_BRIDGE_HOSPITAL_ID']
|
||||||
|
?? $dbSettings['EATRIA_BRIDGE_HOSPITAL_ID']
|
||||||
|
?? ''
|
||||||
|
));
|
||||||
|
if ($dbBridgeHospitalId !== '') {
|
||||||
|
$this->bridgeHospitalId = $dbBridgeHospitalId;
|
||||||
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
log_message('warning', '[EAtriaBridge] refreshRuntimeSettingsFromDb failed: ' . $e->getMessage());
|
log_message('warning', '[EAtriaBridge] refreshRuntimeSettingsFromDb failed: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -262,6 +275,9 @@ class EAtriaBridgeConnector implements AbdmConnectorInterface
|
||||||
if ($tokenValue !== '') {
|
if ($tokenValue !== '') {
|
||||||
$headers[] = 'Authorization: Bearer ' . $tokenValue;
|
$headers[] = 'Authorization: Bearer ' . $tokenValue;
|
||||||
}
|
}
|
||||||
|
if ($this->bridgeHospitalId !== '') {
|
||||||
|
$headers[] = 'X-Hospital-Id: ' . $this->bridgeHospitalId;
|
||||||
|
}
|
||||||
|
|
||||||
$maskedToken = $tokenValue !== '' ? (substr($tokenValue, 0, 6) . '***' . substr($tokenValue, -4)) : '(none)';
|
$maskedToken = $tokenValue !== '' ? (substr($tokenValue, 0, 6) . '***' . substr($tokenValue, -4)) : '(none)';
|
||||||
$tokenSource = $this->tokenSourceByValue[$tokenValue] ?? $this->tokenSource;
|
$tokenSource = $this->tokenSourceByValue[$tokenValue] ?? $this->tokenSource;
|
||||||
|
|
@ -638,6 +654,11 @@ class EAtriaBridgeConnector implements AbdmConnectorInterface
|
||||||
'queue_id' => $queueId,
|
'queue_id' => $queueId,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($this->bridgeHospitalId !== '') {
|
||||||
|
$body['hospital_id'] = $this->bridgeHospitalId;
|
||||||
|
$body['bridge_hospital_id'] = $this->bridgeHospitalId;
|
||||||
|
}
|
||||||
|
|
||||||
if ($abhaAddress !== '') {
|
if ($abhaAddress !== '') {
|
||||||
$body['abha_address'] = $abhaAddress;
|
$body['abha_address'] = $abhaAddress;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user