Code Committed : ps

This commit is contained in:
VE10-Sanjeev 2022-07-12 17:38:00 +05:30
parent a3b64b1aab
commit 3d0e422c66
6 changed files with 94 additions and 44 deletions

View File

@ -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');

View File

@ -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';

View File

@ -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<count($reindexed_array);$i++){
$reponse = digital_locker::downloadFiles($reindexed_array[$i],$token);
$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]);
$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

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -3,8 +3,9 @@ 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>';
// echo "kkkk".gettype($list);
?><!DOCTYPE html>
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
@ -87,27 +88,33 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<?php
if(count($list))
{
echo '<form id="form1" name="form1" method="post" action="getParticularFile">
echo '<form id="form1" name="form1" method="post" action="downloadDigiLockerDocs">
<table class="scorecard_table"><tbody>
<tr><th class="thlargefont" colspan="10">DIGI LOCKER Docs List</th></tr>
<tr><td colspan="2" > Serial Number / Checkbox </td>
<td class = "tdcenteralign" colspan="4">Name</td>
<td class = "tdcenteralign" colspan="4">Description</td></tr>';
<tr><td colspan="1" > Serial Number / Checkbox </td>
<td class = "tdcenteralign" colspan="2">Name</td>
<td class = "tdcenteralign" colspan="3">Description</td>
<td class = "tdcenteralign" colspan="4">Issuer</td></tr>';
for($i=0;$i<count($list['items']);$i++){
echo '<tr><td colspan="2" ><div style="text-align:right">'.($i+1).'<input type="checkbox" id="'.($i+1).'" name="'.($i+1).'" value="'.$list['items'][$i]['uri'].'"></div></td>'; //checkbox
echo '<td class = "tdcenteralign" colspan="4">'.$list['items'][$i]['name'].'</td>';
echo '<td class = "tdcenteralign" colspan="4">'.$list['items'][$i]['description'].'</td></tr>';
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 '<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="token" name="token" value='.$token.'>';
echo '</tbody></table>
<br>
<div style="text-align:right"><input type="submit" value="Submit"></div></form>';
<div style="text-align:right"><input type="submit" value="Download"></div></form>';
}
else{
echo '<table class="scorecard_table"><tbody>
<tr><th class="thlargefont" colspan="10">Digi-Locker Docs List</th></tr>
<tr><td colspan="2" > Serial Number / Checkbox </td>
<td class = "tdcenteralign" colspan="4">Name</td>
s <td class = "tdcenteralign" colspan="4">Description</td></tr>
<tr><td colspan="1" > Serial Number / Checkbox </td>
<td class = "tdcenteralign" colspan="2">Name</td>
<td class = "tdcenteralign" colspan="3">Description</td>
<td class = "tdcenteralign" colspan="4">Issuer</td></tr>
<tr><td class = "tdcenteralign" colspan="10">There is No Digi-Locker Docs</td></tr>
</tbody></table><br>';
}