diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index 9294d06..07feae4 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -1285,7 +1285,7 @@ class Patient extends BaseController $payload = [ 'patient_id' => $pno, 'abha_address' => $abhaContext['abha_address'], - 'hiTypes' => ['OPConsultation', 'Prescription', 'DiagnosticReport', 'HealthDocument'], + 'hiTypes' => ['OPConsultation', 'Prescription', 'DiagnosticReport', 'HealthDocumentRecord'], ]; try { @@ -1584,7 +1584,7 @@ class Patient extends BaseController $consentPayload = [ 'patient_id' => $pno, 'abha_address' => $abhaContext['abha_address'], - 'hiTypes' => ['OPConsultation', 'Prescription', 'DiagnosticReport', 'HealthDocument'], + 'hiTypes' => ['OPConsultation', 'Prescription', 'DiagnosticReport', 'HealthDocumentRecord'], ]; try { diff --git a/app/Libraries/Abdm/M3HiuGatewayClient.php b/app/Libraries/Abdm/M3HiuGatewayClient.php index 0ed98e9..a5f1286 100644 --- a/app/Libraries/Abdm/M3HiuGatewayClient.php +++ b/app/Libraries/Abdm/M3HiuGatewayClient.php @@ -516,14 +516,22 @@ class M3HiuGatewayClient return 'HTTP ' . $httpCode . ' non-JSON response'; } - $code = trim((string) ( - $decoded['data']['error']['code'] - ?? $decoded['error']['code'] - ?? '' - )); + // Some bridge error responses wrap the error object in a list, e.g. + // {"data": [{"error": {"code": "...", "message": "..."}}]}, instead of + // a single {"data": {"error": {...}}} object. Normalize both shapes. + $errorNode = $decoded['data']['error'] ?? $decoded['error'] ?? null; + if (! is_array($errorNode) && isset($decoded['data']) && is_array($decoded['data'])) { + foreach ($decoded['data'] as $item) { + if (is_array($item) && isset($item['error']) && is_array($item['error'])) { + $errorNode = $item['error']; + break; + } + } + } + + $code = trim((string) ($errorNode['code'] ?? '')); $message = trim((string) ( - $decoded['data']['error']['message'] - ?? $decoded['error']['message'] + $errorNode['message'] ?? $decoded['message'] ?? $decoded['error_text'] ?? (is_string($decoded['error'] ?? null) ? $decoded['error'] : '') diff --git a/app/Libraries/Abdm/M3HiuWorkflowService.php b/app/Libraries/Abdm/M3HiuWorkflowService.php index 11874ba..4de7184 100644 --- a/app/Libraries/Abdm/M3HiuWorkflowService.php +++ b/app/Libraries/Abdm/M3HiuWorkflowService.php @@ -1042,12 +1042,12 @@ class M3HiuWorkflowService 'prescription' => 'Prescription', 'dischargesummaryrecord' => 'DischargeSummary', 'dischargesummary' => 'DischargeSummary', - 'healthdocumentrecord' => 'HealthDocument', - 'healthdocument' => 'HealthDocument', + 'healthdocumentrecord' => 'HealthDocumentRecord', + 'healthdocument' => 'HealthDocumentRecord', 'immunization' => 'ImmunizationRecord', 'immunizationrecord' => 'ImmunizationRecord', - 'wellness' => 'Wellness', - 'wellnessrecord' => 'Wellness', + 'wellness' => 'WellnessRecord', + 'wellnessrecord' => 'WellnessRecord', 'invoice' => 'Invoice', 'invoicerecord' => 'Invoice', ]; diff --git a/app/Views/abdm/hiu_m3.php b/app/Views/abdm/hiu_m3.php index ff37e3b..9bd43be 100644 --- a/app/Views/abdm/hiu_m3.php +++ b/app/Views/abdm/hiu_m3.php @@ -1199,12 +1199,12 @@ dischargesummary: 'DischargeSummary', invoice: 'Invoice', invoicerecord: 'Invoice', - healthdocumentrecord: 'HealthDocument', - healthdocument: 'HealthDocument', + healthdocumentrecord: 'HealthDocumentRecord', + healthdocument: 'HealthDocumentRecord', immunization: 'ImmunizationRecord', immunizationrecord: 'ImmunizationRecord', - wellness: 'Wellness', - wellnessrecord: 'Wellness' + wellness: 'WellnessRecord', + wellnessrecord: 'WellnessRecord' }; var out = []; diff --git a/app/Views/billing/Patient_Profile_Opd_V.php b/app/Views/billing/Patient_Profile_Opd_V.php index 1dac82e..e1f878d 100644 --- a/app/Views/billing/Patient_Profile_Opd_V.php +++ b/app/Views/billing/Patient_Profile_Opd_V.php @@ -480,7 +480,7 @@ if ($patientPhotoPath === '') {
- +
@@ -492,7 +492,7 @@ if ($patientPhotoPath === '') {
- +