DIGILOCKER -1 : PS

This commit is contained in:
VE10-Sanjeev 2022-07-09 18:53:44 +05:30
parent 8d69ff60ad
commit c188732cd9
5 changed files with 309 additions and 1 deletions

View File

@ -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*************************************************/

View File

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

View File

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

View File

@ -0,0 +1,66 @@
<?php
class DIGITAL_LOCKER
{
public static function getAccessToken($code)
{
log_message('ERROR','#### Helper Inside Get Access Token');
$CI =&get_instance();
$headers = array('Content-Type: multipart/form-data');
// $headers = array('Content-Type: application/json');
$ch = curl_init();
$fields = array('code' => $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);
}
}
?>

View File

@ -0,0 +1,116 @@
<?php
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>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<link href="https://fonts.googleapis.com/css?family=Merriweather" rel="stylesheet">
<style type="text/css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
@page {
margin: 100px 50px;
font-family:Merriweather;
}
header {
position: fixed;
top: -70px;
left: 0px;
right: 0px;
height: 20px;
text-align: right;
}
footer {
position: fixed;
bottom: 5px;
left: 0px;
right: 0px;
height: 20px;
font-size: 10px;
text-align: left;
}
/* #########Score Card Table Styles######### */
.scorecard_table {
border-collapse: collapse;
width: 100%;
page-break-inside: inline;
}
.scorecard_table td, .scorecard_table th {
border: 1px solid #000;
padding: 8px;
page-break-inside: inline;
}
.scorecard_table tr:nth-child(even){background-color: #f2f2f2;page-break-inside: inline; }
.scorecard_table tr:hover {background-color: #ddd;}
.scorecard_table th {
padding-top: 8px;
padding-bottom: 8px;
text-align: center;
background-color: #0d93a9;
color: white;page-break-inside: inline;
}
/* #########End of Score Card Table Styles######### */
.tdcenteralign{ text-align: center; }
.thlargefont{ font-size: 20px; }
</style>
</head>
<body style="font-family:Merriweather;font-size:12px;margin:15px 30px">
<footer>
<hr>
<img style="width:100px;height:50px;opacity: 0.5;padding-top: 5px;" src='https://pdgenie.com/logo/sineedge_red.png'/> Powered By PD Genie Team
</footer>
<header>
<div>
<img style="width:100px;height:50px;opacity: 0.5;" src='https://pdgenie.com/logo/sineedge_red.png'/>
</div>
<hr>
</header>
<?php
if(count($list))
{
echo '<form id="form1" name="form1" method="post" action="getParticularFile">
<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>';
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 '</tbody></table>
<br>
<div style="text-align:right"><input type="submit" value="Submit"></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 class = "tdcenteralign" colspan="10">There is No Digi-Locker Docs</td></tr>
</tbody></table><br>';
}
?>
</body>
</html>