diff --git a/api/application/config/constants.php b/api/application/config/constants.php index f1cf3277..404ba619 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -129,6 +129,10 @@ defined('CET_SALESPD_INTEGRATION_URL') OR define('CET_SALESPD_INTEGRATION_URL',' defined('CET_SALESPD_INTEGRATION_IMG_URL') OR define('CET_SALESPD_INTEGRATION_IMG_URL','https://demo.devopsmcfinance.com/cet_salespd/api/PullSalesPdPhotographsData'); defined('CET_CREDIT_PD_INTEGRATION_URL') OR define('CET_CREDIT_PD_INTEGRATION_URL','https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdData'); defined('CET_CREDIT_PD_INTEGRATION_IMG_URL') OR define('CET_CREDIT_PD_INTEGRATION_IMG_URL','https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdPhotographsData'); +defined('DIGILOCKER_TOKEN_URI') OR define('DIGILOCKER_TOKEN_URI','https://api.digitallocker.gov.in/public/oauth2/1/token'); +defined('DIGILOCKER_FILESLIST_URI') OR define('DIGILOCKER_FILESLIST_URI','https://api.digitallocker.gov.in/public/oauth2/2/files/issued'); +defined('DIGILOCKER_GETFILE_URI') OR define('DIGILOCKER_GETFILE_URI','https://api.digitallocker.gov.in/public/oauth2/1/files/'); + } else if(ENVIRONMENT == 'testing') { @@ -151,6 +155,9 @@ else if(ENVIRONMENT == 'testing') defined('CET_SALESPD_INTEGRATION_IMG_URL') OR define('CET_SALESPD_INTEGRATION_IMG_URL','https://demo.devopsmcfinance.com/cet_salespd/api/PullSalesPdPhotographsData'); defined('CET_CREDIT_PD_INTEGRATION_URL') OR define('CET_CREDIT_PD_INTEGRATION_URL','https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdData'); defined('CET_CREDIT_PD_INTEGRATION_IMG_URL') OR define('CET_CREDIT_PD_INTEGRATION_IMG_URL','https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdPhotographsData'); + defined('DIGILOCKER_TOKEN_URI') OR define('DIGILOCKER_TOKEN_URI','https://api.digitallocker.gov.in/public/oauth2/1/token'); + defined('DIGILOCKER_FILESLIST_URI') OR define('DIGILOCKER_FILESLIST_URI','https://api.digitallocker.gov.in/public/oauth2/2/files/issued'); + defined('DIGILOCKER_GETFILE_URI') OR define('DIGILOCKER_GETFILE_URI','https://api.digitallocker.gov.in/public/oauth2/1/files/'); } else if(ENVIRONMENT == 'production') { @@ -173,6 +180,9 @@ else if(ENVIRONMENT == 'production') defined('CET_SALESPD_INTEGRATION_IMG_URL') OR define('CET_SALESPD_INTEGRATION_IMG_URL','https://demo.devopsmcfinance.com/cet_salespd/api/PullSalesPdPhotographsData'); defined('CET_CREDIT_PD_INTEGRATION_URL') OR define('CET_CREDIT_PD_INTEGRATION_URL','https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdData'); defined('CET_CREDIT_PD_INTEGRATION_IMG_URL') OR define('CET_CREDIT_PD_INTEGRATION_IMG_URL','https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdPhotographsData'); + defined('DIGILOCKER_TOKEN_URI') OR define('DIGILOCKER_TOKEN_URI','https://api.digitallocker.gov.in/public/oauth2/1/token'); + defined('DIGILOCKER_FILESLIST_URI') OR define('DIGILOCKER_FILESLIST_URI','https://api.digitallocker.gov.in/public/oauth2/2/files/issued'); + defined('DIGILOCKER_GETFILE_URI') OR define('DIGILOCKER_GETFILE_URI','https://api.digitallocker.gov.in/public/oauth2/1/files/'); } /*********************END of AWS resources Constants*************************************************/ diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 04c69189..2a19555c 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -390,3 +390,5 @@ $route['saveFlyhiPDImage'] = 'Flyhi_Controller/saveFlyhiPDImage'; $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'; diff --git a/api/application/controllers/Flyhi_Controller.php b/api/application/controllers/Flyhi_Controller.php index 71c74368..9c3e2426 100644 --- a/api/application/controllers/Flyhi_Controller.php +++ b/api/application/controllers/Flyhi_Controller.php @@ -2186,5 +2186,119 @@ class Flyhi_Controller extends REST_Controller { } } - + public function getDigiLockerDocs_get(){ + $this->load->helper('digital_locker'); + $code = "0049e4a9fa3826e8b64a0882c32038bd84daa0ab"; + // $code = $this->get('code'); + $state = $this->get('state'); + log_message('ERROR',"###Step 1 : Inside Controller GetDigilockerDocs code :".$code); + $response_data = digital_locker::getAccessToken($code); + + if(isset($response_data['dataStatus']) && $response_data['dataStatus'] == false){ + $response_data['status'] = REST_Controller::HTTP_NOT_FOUND; + }else{ + $view_data['list'] = json_decode($response_data['records'], true); + $html_content = $this->load->view("digital_locker",$view_data,true); + 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 getDigiLockerDocstest_get(){ + $view_data['list2'] = array ( + 'items' => + array ( + 0 => + array ( + 'name' => 'PAN Verification Record', + 'type' => 'file', + 'size' => '', + 'date' => '21-06-2022', + 'parent' => '', + 'mime' => + array ( + 0 => 'application/json', + 1 => 'application/xml', + 2 => 'application/pdf', + ), + 'uri' => 'in.gov.pan-PANCR-GDLPS2188M', + 'doctype' => 'PANCR', + 'description' => 'PAN Verification Record', + 'issuerid' => 'in.gov.pan', + 'issuer' => 'Income Tax Department', + ), + ), + ); + $view_data['list'] = array ( + 'items' => + array ( + 0 => + array ( + 'name' => 'PAN Verification Record', + 'type' => 'file', + 'size' => '', + 'date' => '21-06-2022', + 'parent' => '', + 'mime' => + array ( + 0 => 'application/json', + 1 => 'application/xml', + 2 => 'application/pdf', + ), + 'uri' => 'in.gov.pan-PANCR-GDLPS2188M', + 'doctype' => 'PANCR', + 'description' => 'PAN Verification Record', + 'issuerid' => 'in.gov.pan', + 'issuer' => 'Income Tax Department', + ), + 1 => + array ( + 'name' => '10th marksheet', + 'type' => 'file', + 'size' => '', + 'date' => '21-06-2022', + 'parent' => '', + 'mime' => + array ( + 0 => 'application/json', + 1 => 'application/xml', + 2 => 'application/pdf', + ), + 'uri' => 'in.gov.pan-PANCR-GDLPS2188M', + 'doctype' => 'PANCR', + 'description' => 'PAN Verification Record', + 'issuerid' => 'in.gov.pan', + 'issuer' => 'Income Tax Department', + ), + 2 => + array ( + 'name' => '12th marksheet', + 'type' => 'file', + 'size' => '', + 'date' => '21-06-2022', + 'parent' => '', + 'mime' => + array ( + 0 => 'application/json', + 1 => 'application/xml', + 2 => 'application/pdf', + ), + 'uri' => 'in.gov.pan-PANCR-GDLPS2188M', + 'doctype' => 'PANCR', + 'description' => 'PAN Verification Record', + 'issuerid' => 'in.gov.pan', + 'issuer' => 'Income Tax Department', + ), + ), + ); + $html_content = $this->load->view("digital_locker",$view_data,true); + echo $html_content; die(); + } }// Class Ends diff --git a/api/application/helpers/digital_locker_helper.php b/api/application/helpers/digital_locker_helper.php new file mode 100644 index 00000000..84551647 --- /dev/null +++ b/api/application/helpers/digital_locker_helper.php @@ -0,0 +1,66 @@ + $code,'grant_type' =>'authorization_code','client_secret' =>'bbda9efeb26bff460434','client_id' =>'FE9E5D06','redirect_uri' => 'https://apitest.pdgenie.com/'); + curl_setopt( $ch,CURLOPT_URL, DIGILOCKER_TOKEN_URI); + curl_setopt( $ch,CURLOPT_POST, true ); + curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers ); + curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true ); + curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); + $result=curl_exec($ch); + $response = json_decode($result); + curl_close( $ch ); + + if(isset($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); + return self::getFileIssuedList($response->access_token); + } + } + + public static function getFileIssuedList($access_token) + { + log_message('ERROR','#### My Access Token'.$access_token); + $CI =&get_instance(); + $headers = array('Authorization: Bearer '.$access_token); + $ch = curl_init(); + curl_setopt( $ch,CURLOPT_URL, DIGILOCKER_FILESLIST_URI); + 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)); + curl_close( $ch ); + return array('dataStatus'=>true,'records'=>$response); + } + + public static function getParticularFile($file_uri,$access_token) + { + log_message('ERROR','#### My Access Token'.$access_token); + $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_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)); + curl_close( $ch ); + return $response; + // return array('dataStatus'=>true,'records'=>$response); + } +} + +?> \ No newline at end of file diff --git a/api/application/views/digital_locker.php b/api/application/views/digital_locker.php new file mode 100644 index 00000000..157b6957 --- /dev/null +++ b/api/application/views/digital_locker.php @@ -0,0 +1,116 @@ +↑'; + $downarrow = ''; + $dash = ' '; + // echo "kkkk".gettype($list); +?> + + + + + + + + + + + +
+
+ +
+
+
+ + + + + + '; + for($i=0;$i'; //checkbox + echo ''; + echo ''; + } + echo '
DIGI LOCKER Docs List
Serial Number / Checkbox NameDescription
'.($i+1).'
'.$list['items'][$i]['name'].''.$list['items'][$i]['description'].'
+
+
'; + } + else{ + echo ' + + + + s + +
Digi-Locker Docs List
Serial Number / Checkbox NameDescription
There is No Digi-Locker Docs

'; + } + ?> + + \ No newline at end of file