smc gcp object name changes : ps

This commit is contained in:
VE10-Sanjeev 2023-03-13 13:51:31 +05:30
parent 03b094e514
commit 7ed86279f0
2 changed files with 22 additions and 16 deletions

View File

@ -143,7 +143,6 @@ defined('DIGILOCKER_TOKEN_URI') OR define('DIGILOCKER_TOKEN_URI','https://api.di
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/file/');
defined('GCP_BUCKET_NAME') OR define('GCP_BUCKET_NAME','pd-giene-data');
defined('GCP_CREDIT_BUCKET_NAME') OR define('GCP_CREDIT_BUCKET_NAME','credit-pd-demo');
defined('CET_CREDITPD_INTEGRATION_REINSERTIMG_URL') OR define('CET_CREDITPD_INTEGRATION_REINSERTIMG_URL','https://demo.devopsmcfinance.com/cet_creditpd/api/ReInsertImageData');
}
else if(ENVIRONMENT == 'testing')
@ -172,7 +171,6 @@ else if(ENVIRONMENT == 'testing')
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/file/');
defined('GCP_BUCKET_NAME') OR define('GCP_BUCKET_NAME','pd-giene-data');
defined('GCP_CREDIT_BUCKET_NAME') OR define('GCP_CREDIT_BUCKET_NAME','credit-pd-demo');
defined('CET_CREDITPD_INTEGRATION_REINSERTIMG_URL') OR define('CET_CREDITPD_INTEGRATION_REINSERTIMG_URL','https://demo.devopsmcfinance.com/cet_creditpd/api/ReInsertImageData');
}
else if(ENVIRONMENT == 'production')
@ -200,8 +198,7 @@ else if(ENVIRONMENT == 'production')
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/file/');
defined('GCP_BUCKET_NAME') OR define('GCP_BUCKET_NAME','sales-pd');
defined('GCP_CREDIT_BUCKET_NAME') OR define('GCP_CREDIT_BUCKET_NAME','credit-pd');
defined('GCP_BUCKET_NAME') OR define('GCP_BUCKET_NAME','pd-giene-data');
defined('CET_CREDITPD_INTEGRATION_REINSERTIMG_URL') OR define('CET_CREDITPD_INTEGRATION_REINSERTIMG_URL','https://demo.devopsmcfinance.com/cet_creditpd/api/ReInsertImageData');
}

View File

@ -230,8 +230,9 @@ class SMC_Credit_PD_Controller extends REST_Controller {
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{
/*** GCP Report Upload here */
$gcpBucketName = GCP_CREDIT_BUCKET_NAME;
$gcpObjectName = "credit_pd/pd".$smc_credit_pd."/".$smc_credit_pd.".pdf";
$gcpBucketName = GCP_BUCKET_NAME;
$prefixToObject = ENVIRONMENT == 'production' ? "credit-pd":"credit-pd-demo";
$gcpObjectName = $prefixToObject."/pd".$smc_credit_pd."/".$smc_credit_pd.".pdf";
$source=$output_file;
$gcpResult = $this->googlecloud->uploadFileToGCPBucket($gcpBucketName,$gcpObjectName,$source);
$report_gcp_url = '';
@ -255,8 +256,9 @@ class SMC_Credit_PD_Controller extends REST_Controller {
{
// $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
/*** GCP Report Upload here */
$gcpBucketName = GCP_CREDIT_BUCKET_NAME;
$gcpObjectName = "credit_pd/pd".$smc_credit_pd."/".$smc_credit_pd.".pdf";
$gcpBucketName = GCP_BUCKET_NAME;
$prefixToObject = ENVIRONMENT == 'production' ? "credit-pd":"credit-pd-demo";
$gcpObjectName = $prefixToObject."/pd".$smc_credit_pd."/".$smc_credit_pd.".pdf";
$report_gcp_url = $this->googlecloud->getSingleObjectInaBucketAsSignedURI($gcpBucketName,$gcpObjectName);
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
@ -278,8 +280,9 @@ class SMC_Credit_PD_Controller extends REST_Controller {
{
if($api)
{
$gcpBucketName = GCP_CREDIT_BUCKET_NAME;
$gcpObjectName = "credit_pd/pd".$smc_credit_pd."/".$smc_credit_pd.".pdf";
$gcpBucketName = GCP_BUCKET_NAME;
$prefixToObject = ENVIRONMENT == 'production' ? "credit-pd":"credit-pd-demo";
$gcpObjectName = $prefixToObject."/pd".$smc_credit_pd."/".$smc_credit_pd.".pdf";
$report_gcp_url = $this->googlecloud->getSingleObjectInaBucketAsSignedURI($gcpBucketName,$gcpObjectName);
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
$data['dataStatus'] = true;
@ -821,8 +824,9 @@ class SMC_Credit_PD_Controller extends REST_Controller {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
$rand_name = $records['img_name'] == 'satellite' ? $records['img_name'].".png" : $records['img_name']."_".$randomString.".png";
$gcpBucketName = GCP_CREDIT_BUCKET_NAME;
$objectName = "credit_pd/pd".$records['fk_smc_credit_pd_id']."/images/".$rand_name;
$gcpBucketName = GCP_BUCKET_NAME;
$prefixToObject = ENVIRONMENT == 'production' ? "credit-pd":"credit-pd-demo";
$objectName = $prefixToObject."/pd".$records['fk_smc_credit_pd_id']."/images/".$rand_name;
$gcpResult = $this->googlecloud->uploadFileToGCPBucket($gcpBucketName,$objectName,$source);
$report_gcp_url = '';
if($gcpResult == true){
@ -1859,6 +1863,8 @@ public function filterSalesPDList_post() {
$this->load->helper('cet_creditpd');
$this->load->helper('smcpdscore');
$this->load->helper('report_attachments');
$this->load->library('Googlecloud');
$view_data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($records['pd_id']);
@ -2001,8 +2007,10 @@ public function filterSalesPDList_post() {
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{
$gcpBucketName = GCP_CREDIT_BUCKET_NAME;
$gcpObjectName = "credit_pd/pd".$smc_credit_pd."/".$smc_credit_pd.".pdf";
$smc_credit_pd = $records['pd_id'];
$gcpBucketName = GCP_BUCKET_NAME;
$prefixToObject = ENVIRONMENT == 'production' ? "credit-pd":"credit-pd-demo";
$gcpObjectName = $prefixToObject."/pd".$smc_credit_pd."/".$smc_credit_pd.".pdf";
$source=$output_file;
$gcpResult = $this->googlecloud->uploadFileToGCPBucket($gcpBucketName,$gcpObjectName,$source);
$report_gcp_url = '';
@ -2349,8 +2357,9 @@ public function filterSalesPDList_post() {
$rand_name = $value['rand_name'];
$source=$value['img_name'] == 'satellite' ? 'data:image/png;base64,'.$value['img'] : $value['img'];
//Google Library - GCP
$gcpBucketName = GCP_CREDIT_BUCKET_NAME;
$objectName = "credit_pd/pd".$credit_pd_id."/images/".$rand_name;
$gcpBucketName = GCP_BUCKET_NAME;
$prefixToObject = ENVIRONMENT == 'production' ? "credit-pd":"credit-pd-demo";
$objectName = $prefixToObject."/pd".$credit_pd_id."/images/".$rand_name;
$gcp_result = $this->googlecloud->uploadFileToGCPBucket($gcpBucketName,$objectName,$source);
if($gcp_result == true) log_message('ERROR', '### Credit-PD ('.$credit_pd_id.') '.$value['img_name'].' Image Stored In GCP');
else log_message('ERROR', '### Credit-PD ('.$credit_pd_id.') '.$records['img_name'].' Image Not Stored In GCP');