fix(abha): fix Aadhaar OTP verification rejection and error reporting
This commit is contained in:
parent
e28ed30116
commit
f50d0a10dd
|
|
@ -1187,7 +1187,7 @@ class Abha extends BaseController
|
|||
}
|
||||
|
||||
if (empty($result['ok']) || (int) $result['ok'] !== 1) {
|
||||
$err = $this->extractBridgeErrorText($result, 'Incorrect OTP');
|
||||
$err = $this->extractBridgeErrorText($result, 'Please enter a valid OTP. Entered OTP is either expired or incorrect.');
|
||||
if (stripos($err, 'no abha') !== false || stripos($err, 'not registered') !== false || stripos($err, 'not exist') !== false || stripos($err, 'not found') !== false) {
|
||||
return $this->response->setJSON([
|
||||
'ok' => 0,
|
||||
|
|
@ -1234,7 +1234,9 @@ class Abha extends BaseController
|
|||
);
|
||||
|
||||
// VRFY_ABHA_403: No ABHA user registered with this Aadhaar Number
|
||||
$isNew = ! empty($payload['is_new']) || ! empty($payload['new_user']) || ! empty($result['new_user']);
|
||||
$isNew = ! empty($payload['is_new']) || ! empty($payload['new_user']) || ! empty($result['new_user'])
|
||||
|| (isset($payload['isNew']) && ($payload['isNew'] === true || $payload['isNew'] === 'true'))
|
||||
|| (isset($payload['new']) && ($payload['new'] === true || $payload['new'] === 'true'));
|
||||
if ((strlen($cleanAbha) !== 14 && $abhaAddress === '') || $isNew) {
|
||||
return $this->response->setJSON([
|
||||
'ok' => 0,
|
||||
|
|
|
|||
|
|
@ -1080,7 +1080,7 @@ class EAtriaBridgeConnector implements AbdmConnectorInterface
|
|||
$authResult = strtolower(trim((string) ($result['authResult'] ?? $result['data']['authResult'] ?? $result['auth_result'] ?? $result['data']['auth_result'] ?? '')));
|
||||
$status = strtolower(trim((string) ($result['status'] ?? $result['data']['status'] ?? '')));
|
||||
if ($authResult === 'failed' || in_array($status, ['failed', 'failure', 'error'], true)) {
|
||||
$err = trim((string) ($result['message'] ?? $result['data']['message'] ?? $result['error_text'] ?? 'Please enter a valid OTP. Entered OTP is either expired or incorrect.'));
|
||||
$err = trim((string) ($result['error_text'] ?? $result['message'] ?? $result['data']['message'] ?? 'Please enter a valid OTP. Entered OTP is either expired or incorrect.'));
|
||||
return array_merge($result, [
|
||||
'ok' => 0,
|
||||
'error_text' => $err !== '' ? $err : 'Please enter a valid OTP. Entered OTP is either expired or incorrect.',
|
||||
|
|
|
|||
|
|
@ -405,9 +405,9 @@ window.AbhaAadhaarModal = (function () {
|
|||
}
|
||||
|
||||
if (!res || res.ok != 1) {
|
||||
var err = (res && res.error_text) ? res.error_text : 'Incorrect OTP';
|
||||
if (/incorrect|invalid|fail/i.test(err)) {
|
||||
err = 'Incorrect OTP';
|
||||
var err = (res && res.error_text) ? res.error_text : 'Verification failed. Please try again.';
|
||||
if (/incorrect\s*otp|otp\s*is\s*(either\s*)?incorrect|invalid\s*otp/i.test(err)) {
|
||||
err = 'Incorrect OTP. Please enter the valid OTP received on your Aadhaar-linked mobile.';
|
||||
}
|
||||
alertBox('danger', escapeHtml(err));
|
||||
return;
|
||||
|
|
@ -417,12 +417,15 @@ window.AbhaAadhaarModal = (function () {
|
|||
renderProfile(res);
|
||||
}, 'json').fail(function (xhr) {
|
||||
btn.prop('disabled', false).html('<i class="bi bi-patch-check me-1"></i>Verify OTP & Fetch Profile');
|
||||
var err = (xhr.responseJSON && xhr.responseJSON.error_text) ? xhr.responseJSON.error_text : 'Incorrect OTP';
|
||||
if (xhr.responseJSON && xhr.responseJSON.no_abha_found) {
|
||||
alertBox('warning', '<strong>NO ABHA user registered with this Aadhaar Number</strong>');
|
||||
$('#abhaAadhaarNotFoundCard').removeClass('d-none');
|
||||
return;
|
||||
}
|
||||
var err = (xhr.responseJSON && xhr.responseJSON.error_text) ? xhr.responseJSON.error_text : 'Verification failed. Please try again.';
|
||||
if (/incorrect\s*otp|otp\s*is\s*(either\s*)?incorrect|invalid\s*otp/i.test(err)) {
|
||||
err = 'Incorrect OTP. Please enter the valid OTP received on your Aadhaar-linked mobile.';
|
||||
}
|
||||
alertBox('danger', escapeHtml(err));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user