digi locker fixes 2 : ps

This commit is contained in:
VE10-Sanjeev 2022-07-15 23:46:39 +05:30
parent de35af21eb
commit 3f17bd53fe
3 changed files with 50 additions and 24 deletions

View File

@ -2200,7 +2200,8 @@ class Flyhi_Controller extends REST_Controller {
}else{
$view_data['list'] = json_decode($response_data['records'], true);
$view_data['token']= $response_data['token'];
$view_data['dtls']=$response_data['dtls'];
$view_data['pd_id']=$response_data['pd_id'];
$view_data['applicant_name']=$response_data['applicant_name'];
log_message('ERROR',"### 1st : Inside Controller GetDigilockerDocs reponse :".json_encode($response_data));
log_message('ERROR',"### 1st : Inside Controller GetDigilockerDocs viewdata :".json_encode($view_data));
$this->load->view("digital_locker",$view_data);
@ -2221,13 +2222,24 @@ class Flyhi_Controller extends REST_Controller {
unset($form_data['token']);
unset($form_data['pd_id']);
unset($form_data['applicant_name']);
for($i=0;$i<count($form_data);$i++){
$key_name = "digilocker_docname".$i;
if(!empty($form_data[$key_name])){
$digilocker_doc_name[] = $form_data[$key_name];
unset($form_data[$key_name]);
}
}
$reindexed_array = array_values($form_data);
if(count($reindexed_array)>0){
log_message('ERROR','### 5.1th User Choosen Files form data '.json_encode($form_data));
log_message('ERROR','### 5.2th User Choosen Files reindexed_array '.json_encode($reindexed_array));
log_message('ERROR','### 5.3th User Choosen Files reindexed_array count '.count($reindexed_array));
log_message('ERROR','### 5.4th User Choosen Files digilocker_doc_name count '.count($digilocker_doc_name));
log_message('ERROR','### 5.5th User Choosen Files digilocker_doc_name '.json_encode($digilocker_doc_name));
if(count($form_data)>0){
for($i=0;$i<count($reindexed_array);$i++){
$key_name = "digilocker_docname".$i;
$digilocker_doc_name = $reindexed_array[$key_name];
unset($reindexed_array[$key_name]);
log_message('ERROR','### 5.6th User Choosen Files inx '.$i);
$reponse = digital_locker::downloadFiles($reindexed_array[$i],$token);
log_message('ERROR',"### 7 : Choosen Files reponse :".json_encode($reponse));
$folder_to_check = XLPATH.'/tmp';
$bytes = file_put_contents($folder_to_check, json_decode($reponse, true));
$config = array('upload_path' => $folder_to_check,'overwrite' => TRUE,'allowed_types' => '*','file_name' => $reindexed_array[$i]);
@ -2237,7 +2249,7 @@ class Flyhi_Controller extends REST_Controller {
$dtls = $this->Flyhi_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER);
$pd_id = (count($dtls)>0) ? $dtls[0]['pd_id'] : null;
$fk_lender_id = (count($dtls)>0) ? $dtls[0]['fk_lender_id'] : null;
$tempdocname = $applicant_name."-id_proof-".$i+1;
$tempdocname = $applicant_name."-id_proof-".$digilocker_doc_name[$i];
$bucketname = LENDER_BUCKET_NAME_PREFIX.$fk_lender_id;
$key = 'pd'.$pd_id.'/'.$tempdocname ;
$sourcefile = json_decode($reponse, true);
@ -2249,16 +2261,16 @@ class Flyhi_Controller extends REST_Controller {
$record_data = array('fk_pd_id' => $pd_id,'img_type' => 2,'pd_document_title'=>$tempdocname,'pd_document_name'=>$digilocker_doc_name);
$this->Flyhi_Model->saveRecords($record_data,PDDOCUMENTS);
}
log_message('ERROR',"### 7 : Choosen Files reponse :".json_encode($reponse));
log_message('ERROR',"### 8 : Choosen Files reponse :".json_encode($reponse));
}}
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['msg'] = 'File Uploaded Successfully';
$this->response($data,REST_Controller::HTTP_OK);
}
public function getDigiLockerDocs5_get(){
public function getDigiLockerDocs2_get(){
$this->load->helper('digital_locker');
echo " 1- ".digital_locker::userCh_check1();
// echo " 1- ".digital_locker::userCh_check1();
$view_data['list2'] = array (
'items' =>
array (
@ -2345,6 +2357,12 @@ class Flyhi_Controller extends REST_Controller {
),
),
);
$code = $this->get('code');
$co_applicant = $this->get('state');
$reponse = digital_locker::userCh_check3($code,$co_applicant);
$view_data['token']= "response_data['token']";
$view_data['pd_id']="3258";
$view_data['applicant_name']="Sanjeev Soni";
$this->load->view("digital_locker",$view_data);
// echo $html_content; die();
}

View File

@ -33,15 +33,19 @@ class DIGITAL_LOCKER
$CI->db->WHERE("PDAPPLICANTSDETAILS.pd_co_applicant_id",$applicant);
$CI->db->WHERE("PDAPPLICANTSDETAILS.isactive",1);
$dtls = $CI->db->GET()->result_array();
$pd_id = (count($dtls)>0) ? $dtls[0]['fk_pd_id'] : null;
$applicant_name = (count($dtls)>0) ? $dtls[0]['applicant_name'] : null;
$CI->db->where('pd_co_applicant_id =',$applicant);
$CI->db->update(PDAPPLICANTSDETAILS, array('digi_locker_token' => $response));
$CI->db->where('pd_co_applicant_id',$applicant);
$CI->db->update(PDAPPLICANTSDETAILS, array('digi_locker_token' => $result));
// print_r($CI->db->last_query());
return self::getFileIssuedList($response->access_token,$dtls);
return self::getFileIssuedList($response->access_token,$pd_id,$applicant_name);
}
}
public static function getFileIssuedList($access_token,$dtls)
public static function getFileIssuedList($access_token,$pd_id,$applicant_name)
{
log_message('ERROR',"### 4 : Inside Helper getFileIssuedList Token :".$access_token);
$CI =&get_instance();
@ -53,7 +57,7 @@ class DIGITAL_LOCKER
$result=curl_exec($ch);
log_message('ERROR',"### 4th : getFileIssuedList Filelist Reponse :".json_encode($result));
curl_close( $ch );
return array('dataStatus'=>true,'records'=>$result,'token'=>$access_token,'dtls'=>$dtls);
return array('dataStatus'=>true,'records'=>$result,'token'=>$access_token,'pd_id'=>$pd_id,'applicant_name'=>$applicant_name);
}
public static function downloadFiles($uri,$access_token)
@ -81,9 +85,17 @@ class DIGITAL_LOCKER
global $myVAR;
$myVAR = 7123;
}
public static function userCh_check3(){
global $myVAR;
return $myVAR;
public static function userCh_check3($code,$applicant){
$CI =&get_instance();
$CI->db->SELECT("fk_pd_id,pd_co_applicant_id,applicant_name");
$CI->db->FROM(PDAPPLICANTSDETAILS." as PDAPPLICANTSDETAILS");
$CI->db->WHERE("PDAPPLICANTSDETAILS.pd_co_applicant_id",$applicant);
$CI->db->WHERE("PDAPPLICANTSDETAILS.isactive",1);
$dtls = $CI->db->GET()->result_array();
$pd_id = (count($dtls)>0) ? $dtls[0]['fk_pd_id'] : null;
$response = "bb";
$CI->db->where('pd_co_applicant_id',$applicant);
$CI->db->update(PDAPPLICANTSDETAILS, array('digi_locker_token' => $response));
}
}

View File

@ -3,10 +3,6 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$uparrow = '<span style="color:green;">↑</span>';
$downarrow = '<span style="color:red;">↓</span>';
$dash = '<span style="color:black;"> </span>';
if(count($dtls)>0){
$pd_id = isset($dtls[0]['fk_pd_id']) ? $dtls[0]['fk_pd_id'] : null;
$applicant_name = isset($dtls[0]['applicant_name']) ? $dtls[0]['applicant_name'] : null;
}
?>
<!DOCTYPE html>
@ -101,11 +97,11 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<td class = "tdcenteralign" colspan="4">Issuer</td></tr>';
for($i=0;$i<count($list['items']);$i++){
echo '<tr><td colspan="1" ><div style="text-align:right">'.($i+1).'<input type="checkbox" id="'.$i.'" name="'.$i.'" value="'.$list['items'][$i]['uri'].'"></div></td>'; //checkbox
echo '<tr><td colspan="1" ><div style="text-align:right">'.($i+1).'<input type="checkbox" id="'.$i.'" name="'.$i.'" value="'.$list['items'][$i]['uri'].'">
<input type="hidden" id="digilocker_docname'.$i.'" name="digilocker_docname'.$i.'" value='.$list['items'][$i]['name'].'></div></td>'; //checkbox
echo '<td class = "tdcenteralign" colspan="2">'.$list['items'][$i]['name'].'</td>';
echo '<td class = "tdcenteralign" colspan="3">'.$list['items'][$i]['description'].'</td>';
echo '<td class = "tdcenteralign" colspan="4">'.$list['items'][$i]['issuer'].'</td></tr>';
echo '<input type="hidden" id="digilocker_docname'.$i.'" name="digilocker_docname'.$i.'" value='.$list['items'][$i]['name'].'>';
}
echo '<input type="hidden" id="token" name="token" value='.$token.'>';
echo '<input type="hidden" id="pd_id" name="pd_id" value='.$pd_id.'>';