FIX_LOG_MESSAGE
This commit is contained in:
parent
bb0501a8b4
commit
4f48a5335a
@ -266,6 +266,16 @@ class ICICILombardController extends AdminController
|
||||
$flagStatus = $requested_data['flag_status'] ?? $this->request->getGet('flag_status') ?? null;
|
||||
$action = $requested_data['event'] ?? $this->request->getGet('event') ?? null;
|
||||
$event = "ADD";
|
||||
$fileModel = new BatchFileModel();
|
||||
$updateBatchFileStatus = function (string $status) use ($file_id, $fileModel) {
|
||||
if (empty($file_id)) {
|
||||
log_message('error', 'ICICI - ICICIPushEmployeeDetails | file_id missing, skipped batch_files.status update.');
|
||||
return;
|
||||
}
|
||||
|
||||
$fileModel->where('id', $file_id)->set('status', $status)->update();
|
||||
log_message('error', "ICICI - ICICIPushEmployeeDetails | batch_files.status updated for file_id {$file_id} => {$status}");
|
||||
};
|
||||
|
||||
//fetch token
|
||||
$tokenResponse = $this->generateAuthToken('esbgpabatchcreation');
|
||||
@ -278,6 +288,7 @@ class ICICILombardController extends AdminController
|
||||
];
|
||||
|
||||
log_message('error', 'ICICI - ICICIPushEmployeeDetails Failed: ' . json_encode($return_respond_data, JSON_PRETTY_PRINT));
|
||||
$updateBatchFileStatus('failed-8');
|
||||
|
||||
if ($function_calling_type == "job") {
|
||||
return $return_respond_data;
|
||||
@ -351,6 +362,7 @@ class ICICILombardController extends AdminController
|
||||
];
|
||||
|
||||
log_message('error', 'ICICI - ICICIPushEmployeeDetails Failed: ' . json_encode($return_respond_data, JSON_PRETTY_PRINT));
|
||||
$updateBatchFileStatus('failed-8');
|
||||
|
||||
if ($function_calling_type == "job") {
|
||||
return $return_respond_data;
|
||||
@ -369,6 +381,7 @@ class ICICILombardController extends AdminController
|
||||
];
|
||||
|
||||
log_message('error', 'ICICI - ICICIPushEmployeeDetails Failed: ' . json_encode($return_respond_data, JSON_PRETTY_PRINT));
|
||||
$updateBatchFileStatus('failed-8');
|
||||
|
||||
if ($function_calling_type == "job") {
|
||||
return $return_respond_data;
|
||||
@ -386,6 +399,7 @@ class ICICILombardController extends AdminController
|
||||
];
|
||||
|
||||
log_message('error', 'ICICI - ICICIPushEmployeeDetails Failed: ' . json_encode($return_respond_data, JSON_PRETTY_PRINT));
|
||||
$updateBatchFileStatus('failed-8');
|
||||
|
||||
if ($function_calling_type == "job") {
|
||||
return $return_respond_data;
|
||||
@ -418,8 +432,10 @@ class ICICILombardController extends AdminController
|
||||
}
|
||||
|
||||
if ($function_calling_type == "job") {
|
||||
$updateBatchFileStatus(!empty($response['status']) && $response['status'] === true ? 'success' : 'failed-8');
|
||||
return $response;
|
||||
} else {
|
||||
$updateBatchFileStatus(!empty($response['status']) && $response['status'] === true ? 'success' : 'failed-8');
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
@ -437,6 +453,12 @@ class ICICILombardController extends AdminController
|
||||
];
|
||||
|
||||
log_message('error', 'ICICI - Exception thrown while calling ICICIPushEmployeeDetails API: ' . json_encode($errorData, JSON_PRETTY_PRINT));
|
||||
if (!empty($requested_data['file_id'])) {
|
||||
$catchFileModel = new BatchFileModel();
|
||||
$catchFileModel->where('id', $requested_data['file_id'])->set('status', 'failed-8')->update();
|
||||
log_message('error', "ICICI - ICICIPushEmployeeDetails | batch_files.status updated in catch for file_id {$requested_data['file_id']} => failed-8");
|
||||
}
|
||||
$updateBatchFileStatus('failed-8');
|
||||
|
||||
if ($function_calling_type == "job") {
|
||||
return ['status' => false, 'message' => 'API call failed', 'data' => $errorData];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user