From 3d0e422c668153d60ad11852826fc2ea7cdd726e Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Tue, 12 Jul 2022 17:38:00 +0530 Subject: [PATCH] Code Committed : ps --- api/application/config/constants.php | 1 + api/application/config/routes.php | 3 +- .../controllers/Flyhi_Controller.php | 53 ++++++++++++++----- .../helpers/authorization_helper.php | 2 +- .../helpers/digital_locker_helper.php | 46 ++++++++++------ api/application/views/digital_locker.php | 33 +++++++----- 6 files changed, 94 insertions(+), 44 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index ca983c11..dfa2a98e 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -95,6 +95,7 @@ defined('ROUTE_LOGIN_W') OR define('ROUTE_LOGIN_W', 'saveSalesPDImage'); defined('ROUTE_LOGIN_V') OR define('ROUTE_LOGIN_V', 'generateSatelliteImg'); // no errors defined('ROUTE_LOGIN_U') OR define('ROUTE_LOGIN_U', 'generateOTP'); defined('ROUTE_LOGIN_T') OR define('ROUTE_LOGIN_T', 'verifyOTP'); +defined('ROUTE_LOGIN_F') OR define('ROUTE_LOGIN_F', 'downloadDigiLockerDocs'); defined('ROUTE_LOGIN_E') OR define('ROUTE_LOGIN_E', 'getDigiLockerDocs'); defined('ROUTE_LOGIN_D') OR define('ROUTE_LOGIN_D', 'saveFlyhiPDImage'); // no errors defined('ROUTE_LOGIN_C') OR define('ROUTE_LOGIN_C', 'getCreditPDReportforCETApp'); diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 2a19555c..52216863 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -391,4 +391,5 @@ $route['getFlyhiPDImgDataCusLink']='Flyhi_Controller/getFlyhiPDImgDataCusLink'; $route['saveFlyhiPDsection'] = 'Flyhi_Controller/saveFlyhiPDsection'; $route['filterFlyPDList']='Flyhi_Controller/filterFlyPDList'; $route['getDigiLockerDocs']='Flyhi_Controller/getDigiLockerDocs'; -$route['getParticularFile']='Flyhi_Controller/getParticularFile'; +// $route['getDigiLockerDocs2']='Flyhi_Controller/getDigiLockerDos'; +$route['downloadDigiLockerDocs']='Flyhi_Controller/downloadDigiLockerDocs'; diff --git a/api/application/controllers/Flyhi_Controller.php b/api/application/controllers/Flyhi_Controller.php index 8fa6a097..eddcd5ce 100644 --- a/api/application/controllers/Flyhi_Controller.php +++ b/api/application/controllers/Flyhi_Controller.php @@ -2186,12 +2186,12 @@ class Flyhi_Controller extends REST_Controller { } } - public function getDigiLockerDocsu_get(){ + public function getDigiLockerDocs_get(){ $this->load->helper('digital_locker'); - // $code = "0049e4a9fa3826e8b64a0882c32038bd84daa0ab"; + // $code = "66e28b748d5f73186206a03f27f6aee73191a087"; $code = $this->get('code'); $state = $this->get('state'); - log_message('ERROR',"###Step 1 : Inside Controller GetDigilockerDocs code :".$code); + log_message('ERROR',"### 1 : Inside Controller GetDigilockerDocs code :".$code); $response_data = digital_locker::getAccessToken($code); if(isset($response_data['dataStatus']) && $response_data['dataStatus'] == false){ @@ -2199,20 +2199,41 @@ class Flyhi_Controller extends REST_Controller { $this->response($response_data,REST_Controller::HTTP_OK); }else{ $view_data['list'] = json_decode($response_data['records'], true); - $this->load->view("digital_locker",$view_data,true); - // echo $html_content;die(); + $view_data['token']= $response_data['token']; + 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); + // echo $html_content; die(); // $response_data['status'] = REST_Controller::HTTP_OK; } // $this->response($response_data,REST_Controller::HTTP_OK); } - public function getParticularFile_post(){ - log_message('ERROR','####Get Digi Locker Files'); - log_message('ERROR',"### Files :".json_encode($this->post())); - print_r($this->post()); - die(); + public function downloadDigiLockerDocs_post(){ + $this->load->helper('digital_locker'); + log_message('ERROR','### 5 User Choosen Files'.json_encode($this->post())); + $form_data = $this->post(); + $token = $form_data['token']; + log_message('ERROR','### 5th User Choosen Files token key'.$form_data['token']); + unset($form_data['token']); + $reindexed_array = array_values($form_data); + if(count($reindexed_array)>0){ + for($i=0;$i $folder_to_check,'overwrite' => TRUE,'allowed_types' => '*','file_name' => $reindexed_array[$i]); + $this->load->library('upload', $config); + log_message('ERROR',"### 7 : 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 getDigiLockerDocs_get(){ + public function getDigiLockerDocs5_get(){ + $this->load->helper('digital_locker'); + echo " 1- ".digital_locker::userCh_check1(); $view_data['list2'] = array ( 'items' => array ( @@ -2235,7 +2256,7 @@ class Flyhi_Controller extends REST_Controller { 'issuerid' => 'in.gov.pan', 'issuer' => 'Income Tax Department', ), - ), + ),'token'=>"response_data[token]" ); $view_data['list'] = array ( 'items' => @@ -2299,7 +2320,11 @@ class Flyhi_Controller extends REST_Controller { ), ), ); -$this->load->view("digital_locker",$view_data,true); - // echo $html_content; die(); +$this->load->view("digital_locker",$view_data); +// echo $html_content; die(); + } + public function getDigiLockerDos_get(){ + $this->load->helper('digital_locker'); + echo " 3- ".digital_locker::userCh_check3(); } }// Class Ends diff --git a/api/application/helpers/authorization_helper.php b/api/application/helpers/authorization_helper.php index 244485bd..39a91ee8 100644 --- a/api/application/helpers/authorization_helper.php +++ b/api/application/helpers/authorization_helper.php @@ -72,7 +72,7 @@ class AUTHORIZATION } - if( $routingName == ROUTE_LOGIN_X || $routingName == ROUTE_LOGIN_Y || $routingName == ROUTE_LOGIN_Z || $routingName == ROUTE_LOGIN_W || $routingName == ROUTE_LOGIN_V || $routingName == ROUTE_LOGIN_A || $routingName == TURN_SERVER_API || $routingName == VIDEO_CHAT_ACCESS_KEY_API || $routingName ==SAVEROOMINFO_API || $routingName ==SAVESMCCREDITPDIMAGE_API || $routingName ==GETSMCPDIMGSECTIONDATA_API || $routingName == ROUTE_LOGIN_T || $routingName == ROUTE_LOGIN_U || $routingName == ROUTE_LOGIN_B || $routingName == ROUTE_LOGIN_C || $routingName == ROUTE_LOGIN_D || $routingName == ROUTE_LOGIN_E) + if( $routingName == ROUTE_LOGIN_X || $routingName == ROUTE_LOGIN_Y || $routingName == ROUTE_LOGIN_Z || $routingName == ROUTE_LOGIN_W || $routingName == ROUTE_LOGIN_V || $routingName == ROUTE_LOGIN_A || $routingName == TURN_SERVER_API || $routingName == VIDEO_CHAT_ACCESS_KEY_API || $routingName ==SAVEROOMINFO_API || $routingName ==SAVESMCCREDITPDIMAGE_API || $routingName ==GETSMCPDIMGSECTIONDATA_API || $routingName == ROUTE_LOGIN_T || $routingName == ROUTE_LOGIN_U || $routingName == ROUTE_LOGIN_B || $routingName == ROUTE_LOGIN_C || $routingName == ROUTE_LOGIN_D || $routingName == ROUTE_LOGIN_E || $routingName == ROUTE_LOGIN_F) { return true; } diff --git a/api/application/helpers/digital_locker_helper.php b/api/application/helpers/digital_locker_helper.php index 84551647..aaa9480d 100644 --- a/api/application/helpers/digital_locker_helper.php +++ b/api/application/helpers/digital_locker_helper.php @@ -3,9 +3,12 @@ class DIGITAL_LOCKER { + static $TOKEN_AS_GLOBAl = null; + static public $myVAR = null; + public static function getAccessToken($code) { - log_message('ERROR','#### Helper Inside Get Access Token'); + log_message('ERROR',"### 2 : Inside Helper getAccessToken code :".$code); $CI =&get_instance(); $headers = array('Content-Type: multipart/form-data'); // $headers = array('Content-Type: application/json'); @@ -19,18 +22,19 @@ class DIGITAL_LOCKER $result=curl_exec($ch); $response = json_decode($result); curl_close( $ch ); - + log_message('ERROR',"### 2th : getAccessToken Reponse :".json_encode($response)); if(isset($response->error_description)){ + log_message('ERROR',"### 3 : getAccessToken Access Error :".$response->error_description); return array('dataStatus'=>false,'msg'=>$response->error_description); }else{ - log_message('ERROR',"### DIGILOCKER TOKEN URI response :".json_encode($response).$response->access_token); + log_message('ERROR',"### 3 : getAccessToken URI :".$response->access_token); return self::getFileIssuedList($response->access_token); } } public static function getFileIssuedList($access_token) { - log_message('ERROR','#### My Access Token'.$access_token); + log_message('ERROR',"### 4 : Inside Helper getFileIssuedList Token :".$access_token); $CI =&get_instance(); $headers = array('Authorization: Bearer '.$access_token); $ch = curl_init(); @@ -38,28 +42,40 @@ class DIGITAL_LOCKER curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers ); curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true ); $result=curl_exec($ch); - // $response = json_decode($result); - $response = $result; - log_message('ERROR',"### DIGILOCKER FILELIST URI :".json_encode($response)); + log_message('ERROR',"### 4th : getFileIssuedList Filelist Reponse :".json_encode($result)); curl_close( $ch ); - return array('dataStatus'=>true,'records'=>$response); + return array('dataStatus'=>true,'records'=>$result,'token'=>$access_token); } - public static function getParticularFile($file_uri,$access_token) + public static function downloadFiles($uri,$access_token) { - log_message('ERROR','#### My Access Token'.$access_token); + log_message('ERROR',"### 6 : Inside Helper DIGILOCKERGETFILEURI Token :".$access_token." & URI :".$uri); $CI =&get_instance(); $headers = array('Authorization: Bearer '.$access_token); $ch = curl_init(); - curl_setopt( $ch,CURLOPT_URL, DIGILOCKER_GETFILE_URI.$file_uri); + curl_setopt( $ch,CURLOPT_URL, DIGILOCKER_GETFILE_URI.$uri); curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers ); curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true ); $result=curl_exec($ch); - $response = json_decode($result); - log_message('ERROR',"### DIGILOCKER FILELIST URI :".json_encode($response)); + log_message('ERROR',"### 6th : DIGILOCKERGETFILEURI Reponse :".json_encode($result)); curl_close( $ch ); - return $response; - // return array('dataStatus'=>true,'records'=>$response); + return $result; + } + + + public static function userCh_check1(){ + global $myVAR; + self::userCh_check2(); + return $var; + } + public static function userCh_check2(){ + global $myVAR; + $myVAR = 7123; + } + public static function userCh_check3(){ + global $myVAR; + return $myVAR; + } } diff --git a/api/application/views/digital_locker.php b/api/application/views/digital_locker.php index 157b6957..0ef6c67b 100644 --- a/api/application/views/digital_locker.php +++ b/api/application/views/digital_locker.php @@ -3,8 +3,9 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $uparrow = ''; $downarrow = ''; $dash = ' '; - // echo "kkkk".gettype($list); -?> + +?> + @@ -87,27 +88,33 @@ defined('BASEPATH') OR exit('No direct script access allowed'); + echo '
- - - '; + + + + '; + for($i=0;$i'; //checkbox - echo ''; - echo ''; + echo ''; //checkbox + echo ''; + echo ''; + echo ''; } + echo ''; + echo '
DIGI LOCKER Docs List
Serial Number / Checkbox NameDescription
Serial Number / Checkbox NameDescriptionIssuer
'.($i+1).'
'.$list['items'][$i]['name'].''.$list['items'][$i]['description'].'
'.($i+1).'
'.$list['items'][$i]['name'].''.$list['items'][$i]['description'].''.$list['items'][$i]['issuer'].'

-
'; +
'; } else{ echo ' - - - s + + + +
Digi-Locker Docs List
Serial Number / Checkbox NameDescription
Serial Number / Checkbox NameDescriptionIssuer
There is No Digi-Locker Docs

'; }