diff --git a/app/Controllers/Abha.php b/app/Controllers/Abha.php index cdfb877..aa0c51d 100644 --- a/app/Controllers/Abha.php +++ b/app/Controllers/Abha.php @@ -1549,13 +1549,17 @@ class Abha extends BaseController // A missing Bridge endpoint must not block ABHA creation — the modal // keeps the ABDM-assigned address and skips the selection step. $unsupported = in_array((int) ($result['http_code'] ?? 0), [404, 405], true); + $bridgeErr = $this->extractBridgeErrorText($result, 'Unable to load ABHA address suggestions.'); + if (stripos($bridgeErr, 'Internal Server Error') !== false || (int) ($result['http_code'] ?? 0) >= 500) { + $bridgeErr = 'Suggested ABHA addresses are temporarily unavailable from ABDM.'; + } return $this->response->setJSON([ 'ok' => 0, 'supported' => ! $unsupported, 'error_text' => $unsupported ? 'The ABDM Bridge does not expose ABHA address suggestions yet.' - : $this->extractBridgeErrorText($result, 'Unable to load ABHA address suggestions.'), + : $bridgeErr, 'request_id' => (string) ($result['request_id'] ?? ''), ]); } diff --git a/app/Views/partials/abha_create_modal.php b/app/Views/partials/abha_create_modal.php index 2092fb9..4dfc6b2 100644 --- a/app/Views/partials/abha_create_modal.php +++ b/app/Views/partials/abha_create_modal.php @@ -383,6 +383,9 @@ window.AbhaCreateModal = (function () { var raw = response && (response.error_text || response.message) ? String(response.error_text || response.message) : fallback; + if (/Internal Server Error/i.test(raw)) { + raw = 'ABDM server is temporarily unavailable'; + } if (/loginId/i.test(raw) && /invalid/i.test(raw)) { raw = 'Aadhaar Number is not valid. Valid 12-digit Aadhaar number is required.'; } @@ -793,7 +796,12 @@ window.AbhaCreateModal = (function () { $.post('', { txn_id: createTxnId, '': csrf() }, function (response) { if (!response || response.ok != 1 || !(response.suggestions || []).length) { - $('#abhaCreateAddressList').html('
' + apiMessage(response, 'No suggested ABHA addresses are available from the bridge.') + ' Please enter a custom address below.
'); + var msg = apiMessage(response, 'Suggested ABHA addresses are temporarily unavailable from ABDM.'); + if (/Internal Server Error/i.test(msg) || /500/.test(msg)) { + msg = 'Suggested ABHA addresses are temporarily unavailable from ABDM.'; + } + msg = msg.replace(/\.+$/, ''); + $('#abhaCreateAddressList').html('
' + msg + '. Please enter your preferred custom address below.
'); $('#abhaCreateCustomWrap').removeClass('d-none'); return; } @@ -806,7 +814,12 @@ window.AbhaCreateModal = (function () { }); $('#abhaCreateAddressList').html(html); }, 'json').fail(function (xhr) { - $('#abhaCreateAddressList').html('
' + apiMessage(xhr.responseJSON, 'Unable to load address suggestions.') + ' Please enter a custom address below.
'); + var msg = apiMessage(xhr.responseJSON, 'Suggested ABHA addresses are temporarily unavailable from ABDM.'); + if (/Internal Server Error/i.test(msg) || /500/.test(msg)) { + msg = 'Suggested ABHA addresses are temporarily unavailable from ABDM.'; + } + msg = msg.replace(/\.+$/, ''); + $('#abhaCreateAddressList').html('
' + msg + '. Please enter your preferred custom address below.
'); $('#abhaCreateCustomWrap').removeClass('d-none'); }); }