From 3f17bd53fe8adb4d35d432174594007c5cd1cad4 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Fri, 15 Jul 2022 23:46:39 +0530 Subject: [PATCH] digi locker fixes 2 : ps --- .../controllers/Flyhi_Controller.php | 36 ++++++++++++++----- .../helpers/digital_locker_helper.php | 30 +++++++++++----- api/application/views/digital_locker.php | 8 ++--- 3 files changed, 50 insertions(+), 24 deletions(-) diff --git a/api/application/controllers/Flyhi_Controller.php b/api/application/controllers/Flyhi_Controller.php index c61f1bc0..848ec41d 100644 --- a/api/application/controllers/Flyhi_Controller.php +++ b/api/application/controllers/Flyhi_Controller.php @@ -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;$i0){ + 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 $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(); } diff --git a/api/application/helpers/digital_locker_helper.php b/api/application/helpers/digital_locker_helper.php index 9fcf9078..de879c37 100644 --- a/api/application/helpers/digital_locker_helper.php +++ b/api/application/helpers/digital_locker_helper.php @@ -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)); } } diff --git a/api/application/views/digital_locker.php b/api/application/views/digital_locker.php index fa46e9b0..af598a63 100644 --- a/api/application/views/digital_locker.php +++ b/api/application/views/digital_locker.php @@ -3,10 +3,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $uparrow = ''; $downarrow = ''; $dash = ' '; - 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; - } ?> @@ -101,11 +97,11 @@ defined('BASEPATH') OR exit('No direct script access allowed'); Issuer'; for($i=0;$i
'.($i+1).'
'; //checkbox + echo '
'.($i+1).' +
'; //checkbox echo ''.$list['items'][$i]['name'].''; echo ''.$list['items'][$i]['description'].''; echo ''.$list['items'][$i]['issuer'].''; - echo ''; } echo ''; echo '';