CET sales push Emp id and Autologin Invld chk : ps

This commit is contained in:
VE10-Sanjeev 2023-07-11 14:37:01 +05:30
parent 30213a545b
commit aaa9450ccd
3 changed files with 187 additions and 175 deletions

View File

@ -458,7 +458,8 @@ class Sales_PD_Controller extends REST_Controller {
'product'=>$sales_pd_data[0]['abbr'], 'product'=>$sales_pd_data[0]['abbr'],
'caseno'=>$sales_pd_data[0]['sales_pd_sno'], 'caseno'=>$sales_pd_data[0]['sales_pd_sno'],
'sales_pd_type'=>$sales_pd_data[0]['sales_pd_type'], 'sales_pd_type'=>$sales_pd_data[0]['sales_pd_type'],
'completed_date'=>$sales_pd_data[0]['completed_date']); 'completed_date'=>$sales_pd_data[0]['completed_date'],
'employee_id'=>$sales_pd_data[0]['smc_emp_code']);
foreach ($all_section_data as $sec_key => $section) foreach ($all_section_data as $sec_key => $section)
{ {
@ -476,6 +477,7 @@ class Sales_PD_Controller extends REST_Controller {
if(!empty($officer_details)){ if(!empty($officer_details)){
foreach($officer_details as $key=>$value) { foreach($officer_details as $key=>$value) {
$CETAPP_salesPD_data['section8'] = array_merge($section_fields['section8'],$value); $CETAPP_salesPD_data['section8'] = array_merge($section_fields['section8'],$value);
$CETAPP_salesPD_data['section8']['employee_id'] = isset($sales_pd_data[0]['smc_emp_code']) ? $sales_pd_data[0]['smc_emp_code'] : '';
} }
} }
} }
@ -1020,10 +1022,9 @@ class Sales_PD_Controller extends REST_Controller {
$applicant_id = $sales_pd_data[0]['applicant_id']; $applicant_id = $sales_pd_data[0]['applicant_id'];
$smcauthtoken = smcfinance::SmcFinanceAuthUrl(); $smcauthtoken = smcfinance::SmcFinanceAuthUrl();
if($smcauthtoken != null){ if($smcauthtoken != null){
log_message('ERROR','## smc i got token, '.$smcauthtoken);
smcfinance::SmcFinanceApiUrl($applicant_id,$records['sales_pd_id'],$sales_pd_sno,2,$smcauthtoken); smcfinance::SmcFinanceApiUrl($applicant_id,$records['sales_pd_id'],$sales_pd_sno,2,$smcauthtoken);
}else{ }else{
log_message('ERROR','## no token, '.$smcauthtoken); log_message('ERROR','## SMC Finance Auth Token Not Founded, '.$smcauthtoken);
} }
//CAMUNDA::completeSalesPDTask($records['sales_pd_id']); //CAMUNDA::completeSalesPDTask($records['sales_pd_id']);
@ -1836,8 +1837,18 @@ public function filterSalesPDList_post() {
// $reponse_arr = json_decode(,true); // $reponse_arr = json_decode(,true);
// print_r(APPPATH."controller/newSalesPD.json");die(); // print_r(APPPATH."controller/newSalesPD.json");die();
$lenderid = (ENVIRONMENT == 'production' ? 7 : 35); $lenderid = (ENVIRONMENT == 'production' ? 7 : 35);
if($applicantid != null && (!empty($applicantid))){
$where_condition = array("applicant_id"=>$applicantid);
$is_exist_applicant_id = $this->Sales_PD_Model->selectCustomRecords(array('sales_pd_sno'),$where_condition,SALES_PD_DATA);
if(count($is_exist_applicant_id)){
$is_exist_sales_pd_sno = $is_exist_applicant_id[0]['sales_pd_sno'];
log_message('ERROR','## InVaild : Applicant_id Already Exist with '.$is_exist_sales_pd_sno.' PD');
$salepdid = 0;
}else{
log_message('ERROR','## Vaild : Applicant_id = '.$applicantid);
if ((!empty($sales_pd_type)) && (!empty($productname)) && (!empty($applicantname)) && (!empty($applicantid)) && (!empty($usersemailid)) && (!empty($loanamount))) { if ((!empty($sales_pd_type)) && (!empty($productname)) && (!empty($applicantname)) && (!empty($applicantid)) && (!empty($usersemailid)) && (!empty($loanamount))) {
/************lender id,shortname******************/ /************lender id,shortname******************/
$lender_short_name = $this->Sales_PD_Model->selectCustomRecords(array('short_name'),array('entity_id' => $lenderid),ENTITY); $lender_short_name = $this->Sales_PD_Model->selectCustomRecords(array('short_name'),array('entity_id' => $lenderid),ENTITY);
@ -1980,6 +1991,7 @@ public function filterSalesPDList_post() {
log_message('ERROR','## 5) Confirmation : '.$msg); log_message('ERROR','## 5) Confirmation : '.$msg);
} }
} }
$data['dataStatus'] = true; $data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK; $data['status'] = REST_Controller::HTTP_OK;
$data['msg'] = "Sales PD : ".$salepd_serial_no; $data['msg'] = "Sales PD : ".$salepd_serial_no;
@ -1988,21 +2000,24 @@ public function filterSalesPDList_post() {
$data['status'] = REST_Controller::HTTP_NOT_FOUND; $data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Data Not Found,Try again'; $data['msg'] = 'Data Not Found,Try again';
} }
}else{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Param (or) Value Not Missing,Please Check again';
}
log_message('ERROR','## 6) Finally, '.$data['msg']); log_message('ERROR','## 6) Finally, '.$data['msg']);
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Kolkata");
$current_date = date("d/m/Y H:i:s"); $current_date = date("d/m/Y H:i:s");
$smcauthtoken = smcfinance::SmcFinanceAuthUrl(); $smcauthtoken = smcfinance::SmcFinanceAuthUrl();
if($smcauthtoken != null){ if($smcauthtoken != null){
log_message('ERROR','## 7) i got token, '.$smcauthtoken); log_message('ERROR','## 7) I Got SMC Finance Auth Token');
smcfinance::SmcFinanceApiUrl($applicantid,$salepdid,$salepd_serial_no,1,$smcauthtoken); smcfinance::SmcFinanceApiUrl($applicantid,$salepdid,$salepd_serial_no,1,$smcauthtoken);
}else{ }else{
log_message('ERROR','## 7) no token, '.$smcauthtoken); log_message('ERROR','## 7) SMC Finance Auth Token Not Founded, '.$smcauthtoken);
} }
}else{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Param (or) Value Not Missing,Please Check again';
}
}
}
if(ENVIRONMENT == 'production'){ if(ENVIRONMENT == 'production'){
$auth_user_id = "MwiseSales@yahoo.com"; $auth_user_id = "MwiseSales@yahoo.com";

View File

@ -55,7 +55,7 @@ class CET_SALESPD
try{ try{
$ch = curl_init(); $ch = curl_init();
$output_data = json_encode( $fields ); $output_data = json_encode( $fields );
// print_r($output_data);die(); //print_r($output_data);die();
log_message('ERROR',"PullSalesPDData api Request Format : ".$output_data); log_message('ERROR',"PullSalesPDData api Request Format : ".$output_data);
curl_setopt( $ch,CURLOPT_URL, CET_SALESPD_INTEGRATION_URL); curl_setopt( $ch,CURLOPT_URL, CET_SALESPD_INTEGRATION_URL);
curl_setopt( $ch,CURLOPT_POST, true ); curl_setopt( $ch,CURLOPT_POST, true );

View File

@ -10,13 +10,13 @@ class SMCFINANCE
public static function SmcFinanceAuthUrl() public static function SmcFinanceAuthUrl()
{ {
log_message('ERROR','#### Smc Finance Auth Url Helper FNS'); log_message('ERROR','## SMC Finance Auth Url FNS');
// echo "Token Generation/Refresh Fns"; // echo "Token Generation/Refresh Fns";
$headers = array('Content-Type: application/json'); $headers = array('Content-Type: application/json');
try{ try{
$ch = curl_init(); $ch = curl_init();
$body = '{ "userCode": "APIEdge","userPass": "sineUAT", "application": [ "Sales App-API" ] }'; $body = '{ "userCode": "APIEdge","userPass": "sineUAT", "application": [ "Sales App-API" ] }';
log_message('ERROR',"## SMC Finance Auth Url Request ".$body);
curl_setopt($ch, CURLOPT_URL, SMC_FINANCE_AUTH_URL); curl_setopt($ch, CURLOPT_URL, SMC_FINANCE_AUTH_URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HEADER, 0);
@ -37,12 +37,12 @@ class SMCFINANCE
// $response_decoded = json_decode($result); // $response_decoded = json_decode($result);
// $response = $response_decoded; // $response = $response_decoded;
curl_close( $ch ); curl_close( $ch );
log_message('ERROR', "Smc Finance Auth Url token : " . $token); log_message('ERROR', "## SMC Finance Auth Url Token : " . $token);
} }
catch (Exception $e) { catch (Exception $e) {
$token = null; $token = null;
// $response->error = array($e->getMessage()); // $response->error = array($e->getMessage());
log_message('ERROR', "Smc Finance Auth Url ERR : " . $e->getMessage()); log_message('ERROR', "## Smc Finance Auth Url ERR : " . $e->getMessage());
} }
return $token; return $token;
} }
@ -56,11 +56,12 @@ class SMCFINANCE
{ {
$CI =& get_instance(); $CI =& get_instance();
// $headersData = getallheaders(); // $headersData = getallheaders();
log_message('ERROR','#### Smc Finance Refresh Token in Helper FNS '); log_message('ERROR','#### SMC Finance Refresh Token FNS ');
$headers = array('Content-Type: application/json'); $headers = array('Content-Type: application/json');
try{ try{
$ch = curl_init(); $ch = curl_init();
$body = '{ "refreshToken":$token'.$token.' }'; $body = '{ "refreshToken":$token'.$token.' }';
log_message('ERROR',"SMC Finance Refresh Token Request ".$body);
curl_setopt($ch, CURLOPT_URL, SMC_FINANCE_REFRESH_TOKEN); curl_setopt($ch, CURLOPT_URL, SMC_FINANCE_REFRESH_TOKEN);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HEADER, 0);
@ -73,11 +74,11 @@ class SMCFINANCE
$response_decoded = json_decode($result); $response_decoded = json_decode($result);
$response = $response_decoded; $response = $response_decoded;
curl_close( $ch ); curl_close( $ch );
log_message('ERROR','#### Smc Finance Refresh Token reponse '.$response); log_message('ERROR','#### SMC Finance Refresh Token Reponse '.$response);
} }
catch (Exception $e) { catch (Exception $e) {
$response->error = array($e->getMessage()); $response->error = array($e->getMessage());
log_message('ERROR','#### Smc Finance Refresh Token reponse Err '. $e->getMessage()); log_message('ERROR','#### SMC Finance Refresh Token Err '. $e->getMessage());
} }
return $response; return $response;
} }
@ -94,11 +95,7 @@ class SMCFINANCE
try{ try{
$ch = curl_init(); $ch = curl_init();
$body = '{"pdId":"'.$sales_pd_sno.'","pdStatus":'.$sales_pd_status.',"salesLeadId":'.$applicant_id.'}'; $body = '{"pdId":"'.$sales_pd_sno.'","pdStatus":'.$sales_pd_status.',"salesLeadId":'.$applicant_id.'}';
// $object->pdId = $sales_pd_sno; log_message('ERROR',"SMC Finance Api Request ".$body);
// $object->pdStatus = $sales_pd_status;
// $object->salesLeadId = $applicant_id;
log_message('ERROR',"SMC Finance Api body ".$body);
//$data1 = array("pdId" => $sales_pd_sno,"pdStatus"=>$sales_pd_status,"salesLeadId"=>$sales_pd_id);
// $put_url = SMC_FINANCE_API_URL.$sales_pd_id.'/update-pd'; // $put_url = SMC_FINANCE_API_URL.$sales_pd_id.'/update-pd';
curl_setopt($ch, CURLOPT_URL, SMC_FINANCE_UPDATE_URL); curl_setopt($ch, CURLOPT_URL, SMC_FINANCE_UPDATE_URL);
@ -112,13 +109,13 @@ class SMCFINANCE
$result = curl_exec($ch ); $result = curl_exec($ch );
$response_decoded = json_decode($result); $response_decoded = json_decode($result);
log_message('ERROR', "SMC Finance Api Fns Response : " . $result); log_message('ERROR', "SMC Finance Api Response : ".$result);
curl_close( $ch ); curl_close( $ch );
} }
catch (Exception $e) { catch (Exception $e) {
// $response->error = array($e->getMessage()); // $response->error = array($e->getMessage());
$result = array($e->getMessage()); $result = array($e->getMessage());
log_message('ERROR', "SMC Finance Api Fns ERR : " . $e->getMessage()); log_message('ERROR', "SMC Finance Api ERR : " . $e->getMessage());
} }
return $result; return $result;