diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 8d1d5487..c965fff3 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_C') OR define('ROUTE_LOGIN_C', 'getCreditPDReportforCETApp'); defined('ROUTE_LOGIN_B') OR define('ROUTE_LOGIN_B', 'getSalesPDReportforCETApp'); defined('ROUTE_LOGIN_A') OR define('ROUTE_LOGIN_A', 'getAuditedImages'); // no errors defined('TURN_SERVER_API') OR define('TURN_SERVER_API', 'getServerInfo'); // no errors @@ -124,7 +125,8 @@ defined('OPTIMIZED_IMAGE_BUCKET_NAME') OR define('OPTIMIZED_IMAGE_BUCKET_NAME',' defined('IMAGE_OPTIMIZE_LAMBDA_URL') OR define('IMAGE_OPTIMIZE_LAMBDA_URL','https://wlaax92nne.execute-api.ap-south-1.amazonaws.com/demo'); defined('VIDEO_SHORT_URL') OR define('VIDEO_SHORT_URL','https://lkt.pdgenie.com/'); defined('CET_SALESPD_INTEGRATION_URL') OR define('CET_SALESPD_INTEGRATION_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_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_IMG_INTEGRATION_URL') OR define('CET_CREDIT_PD_IMG_INTEGRATION_URL','https://demo.devopsmcfinance.com/cet_salespd/api/PullCreditPdPhotographsData'); } else if(ENVIRONMENT == 'testing') { @@ -144,7 +146,8 @@ else if(ENVIRONMENT == 'testing') defined('IMAGE_OPTIMIZE_LAMBDA_URL') OR define('IMAGE_OPTIMIZE_LAMBDA_URL','https://wlaax92nne.execute-api.ap-south-1.amazonaws.com/demo'); defined('VIDEO_SHORT_URL') OR define('VIDEO_SHORT_URL','https://lkt.pdgenie.com/'); defined('CET_SALESPD_INTEGRATION_URL') OR define('CET_SALESPD_INTEGRATION_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_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_IMG_INTEGRATION_URL') OR define('CET_CREDIT_PD_IMG_INTEGRATION_URL','https://demo.devopsmcfinance.com/cet_salespd/api/PullCreditPdPhotographsData'); } else if(ENVIRONMENT == 'production') { diff --git a/api/application/config/routes.php b/api/application/config/routes.php index eeeee154..3b03b974 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -365,4 +365,5 @@ $route['getRequestForDataDump'] = 'Request_DataDump_Controller/getRequestForData $route['GC_addEvent'] = 'GC_Event_Controller/addEvent'; $route['GC_eventList'] = 'GC_Event_Controller/eventList'; -$route['getSalesPDReportforCETApp'] = 'Sales_PD_Controller/getSalesPDReportforCETApp'; \ No newline at end of file +$route['getSalesPDReportforCETApp'] = 'Sales_PD_Controller/getSalesPDReportforCETApp'; +$route['getCreditPDReportforCETApp'] = 'SMC_Credit_PD_Controller/getCreditPDReportforCETApp'; \ No newline at end of file diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 5b444ce5..c42899b7 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -24,8 +24,7 @@ class SMC_Credit_PD_Controller extends REST_Controller { $this->load->library('pdfgenerator'); $this->load->helper('satellite_image'); $this->load->library('phpmailer_library'); - - + $this->load->helper('cet_creditpd'); } public function loadSalesPDTemplate_post() @@ -168,7 +167,6 @@ class SMC_Credit_PD_Controller extends REST_Controller { $where_condition_array = array('SMC_CREDIT_PD.smc_credit_pd' => $smc_credit_pd); $SMC_CREDIT_PD = $this->SMC_Credit_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array); - if($SMC_CREDIT_PD) { ini_set('max_execution_time', 0); @@ -1522,13 +1520,17 @@ public function filterSalesPDList_post() { { $records = $this->post('records'); $this->load->helper('smc_creditpd'); + $this->load->helper('cet_creditpd'); $this->load->helper('smcpdscore'); - + + $view_data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($records['pd_id']); $view_data['applicant_details'] = $this->PD_Model->getApplicantsDetails($records['pd_id']); //$pd_section_data = $this->SMC_Credit_PD_Model->selectCustomRecords(array('*'),array('isactive' => 1,'fk_pd_id' => $records['pd_id']),SMC_CREDIT_PD_SECTION_DATA,array(),'','fk_form_id','ASC'); $pd_section_data = $this->SMC_Credit_PD_Model->getSMCTemplateForPD($records['pd_id'],$view_data['pd_master_details'][0]['fk_product_id'],null,null,'REPORT'); - // print_r ($view_data['pd_master_details']);die(); + $common_fields = array('pdid'=>$view_data['pd_master_details'][0]['pd_id'], + 'product'=>$view_data['pd_master_details'][0]['product_abbr'], + 'caseno'=>$view_data['pd_master_details'][0]['pd_sno']); // print_r($pd_section_data);die(); $forms_data_to_be_get_direct_from_excel_sheet = array(3,9,10,15); @@ -1546,7 +1548,8 @@ public function filterSalesPDList_post() { // if($value['fk_form_id'] == 2){print_r($value['json']);die();} $view_data['pd_section_data'][$value['fk_form_id']] = $value['json']; - // $CETAPP_creditPD_data[$value['form_name']] = $value['json']; + $CETAPP_creditPD_data[$value['form_name']] = $value['json']; + // $CETAPP_creditPD_data[$value['fk_form_id']] = $value['json']; } else { @@ -1556,7 +1559,8 @@ public function filterSalesPDList_post() { $data_from_excel = $this->loadDataFromExcelBusiProcess($view_data['pd_master_details'],$value['fk_form_id']); //print_r($data_from_excel);die(); $view_data['pd_section_data'][$value['fk_form_id']] = $data_from_excel; - // $CETAPP_creditPD_data[$value['form_name']] = $data_from_excel; + $CETAPP_creditPD_data[$value['form_name']] = $data_from_excel; + // $CETAPP_creditPD_data[$value['fk_form_id']]= $data_from_excel; } } @@ -1637,10 +1641,11 @@ public function filterSalesPDList_post() { } } $view_data['pd_section_data'][5]['key_stakeholders'] = $temp_arr; - // $CETAPP_creditPD_data['Key Stakeholders in Business']['key_stakeholders'] = $temp_arr; + $CETAPP_creditPD_data['Key Stakeholders in Business']['key_stakeholders'] = $temp_arr; + // $CETAPP_creditPD_data[5]['key_stakeholders'] = $temp_arr; }// ### LFMP key_stakeholders ends // log_message('ERROR',"SUSEEN".json_encode($CETAPP_creditPD_data));die(); - + cet_creditpd::pushwithcetcreditpdapi($common_fields,$CETAPP_creditPD_data);die(); if($view_data['pd_master_details'][0]['product_abbr'] == "NBFC/MFI"){ $html_content = $this->load->view('smc_creditpd_reports/NBFC',$view_data,true); }else{ @@ -1860,6 +1865,25 @@ public function filterSalesPDList_post() { $this->response($data,REST_Controller::HTTP_OK); } + function getCreditPDReportforCETApp_get(){ + // 3090 + log_message('ERROR','## CreditPDReportforCETApp Fns Entered'); + $get = $this->get('credit_pd_id'); + if(!empty($get)){ + // $data['report'] = $this->prepareSalesPDReport($get); + // $statusMsg = 'Report Generated'; + $this->prepareSalesPDReport($get); + log_message('ERROR',"Credit Report Generated for CET App"); + }else{ + log_message('ERROR','Credit Report Not Available for CET App'); + $statusMsg = 'Report Not Available.'; + } + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['msg'] = $statusMsg; + $this->response($data,REST_Controller::HTTP_OK); + } + } \ No newline at end of file diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 4a9c83ed..970cfd31 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -9,7 +9,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); - require_once APPPATH . '/libraries/REST_Controller.php'; +require_once APPPATH . '/libraries/REST_Controller.php'; include_once APPPATH.'/vendor/autoload.php'; @@ -26,7 +26,7 @@ class Sales_PD_Controller extends REST_Controller { $this->load->helper('satellite_image'); $this->load->helper('camunda'); $this->load->library('phpmailer_library'); - $this->load->helper('salespd_cetapp'); + $this->load->helper('cet_salespd'); } @@ -224,7 +224,7 @@ class Sales_PD_Controller extends REST_Controller { $img_split = explode( ',', $view_data['section9'][$i]['img']); $img_fields['img'] = $img_split[1]; // $img_fields[0]['img'] = $view_data['section9'][$i]['img']; - salespd_cetapp::pushwithcetphotographapi($img_fields,$i); + cet_salespd::pushwithcetphotographapi($img_fields,$i); } // "section9":{"selfie_with_person_met":"SAVED","approach_to_pd_location":["SAVED",""],"name_board_seen":["SAVED",""],"stock_image":["SAVED","SAVED","SAVED","SAVED",""],"workplace_interior_image":["SAVED","SAVED",""]}} // $arr1 =array();$arr2 =array(); @@ -240,13 +240,13 @@ class Sales_PD_Controller extends REST_Controller { // } //} } - salespd_cetapp::pushwithcetsalespdapi($common_fields,$section_fields,1); + cet_salespd::pushwithcetsalespdapi($common_fields,$section_fields,1); $view_data['satellite_image'] = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id,'img_name' => 'satellite','isactive' => 1),SALEPD_DOCS); if(!empty($view_data['satellite_image'])){ $stt_fields = $common_fields; $stt_fields['img_name'] = $view_data['satellite_image'][0]['img_name']; $stt_fields['img'] = $view_data['satellite_image'][0]['img']; - salespd_cetapp::pushwithcetphotographapi($stt_fields); + cet_salespd::pushwithcetphotographapi($stt_fields); } $view_data['product_id'] = $sales_pd_data[0]['product_id']; $view_data['geo_location'] = $sales_pd_data[0]['geo_location']; @@ -1380,9 +1380,9 @@ public function filterSalesPDList_post() { $get = $this->get('sales_pd_id'); if(!empty($get)){ $this->prepareSalesPDReport($get); - log_message('ERROR',"Report Generated for CET App"); + log_message('ERROR',"Sales Report Generated for CET App"); }else{ - log_message('ERROR','Report Not Available for CET App'); + log_message('ERROR','Sales Report Not Available for CET App'); $statusMsg = 'Report Not Available.'; } $data['dataStatus'] = true; diff --git a/api/application/helpers/authorization_helper.php b/api/application/helpers/authorization_helper.php index 63988167..be6c69fb 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) + 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) { return true; } diff --git a/api/application/helpers/cet_creditpd_helper.php b/api/application/helpers/cet_creditpd_helper.php new file mode 100644 index 00000000..bb85a2c2 --- /dev/null +++ b/api/application/helpers/cet_creditpd_helper.php @@ -0,0 +1,67 @@ +external_path.'/tmp/temp'. $index .date('Y-m-d_h-i-s') .'.png'; + $curlFile = curl_file_create($file); + $success = file_put_contents($file, $data); + $headers = array('Content-Type: multipart/form-data'); + // $headers = array('Content-Type: application/json'); + $ch = curl_init(); + $log_msg = " PullcreditPdPhotographsData api (".$fields['img_name'].")"; + $fields['img'] = $curlFile; + curl_setopt( $ch,CURLOPT_URL, CET_CREDIT_PD_IMG_INTEGRATION_URL); + curl_setopt( $ch,CURLOPT_POST, true ); + curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers ); + curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true ); + // curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, true ); + curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); + $result=curl_exec($ch); + $response = json_decode($result); + log_message('ERROR',"###CET APP PDID (".$pdid.") ".$log_msg."response :".json_encode($response)); + curl_close( $ch ); + unlink($file); + // unlink($file_name_with_full_path); + + } +} + +?> \ No newline at end of file diff --git a/api/application/helpers/salespd_cetapp_helper.php b/api/application/helpers/cet_salespd_helper.php similarity index 99% rename from api/application/helpers/salespd_cetapp_helper.php rename to api/application/helpers/cet_salespd_helper.php index 51b274e8..2c7367d7 100644 --- a/api/application/helpers/salespd_cetapp_helper.php +++ b/api/application/helpers/cet_salespd_helper.php @@ -1,6 +1,6 @@