CET sales push Emp id and Autologin Invld chk : ps
This commit is contained in:
parent
30213a545b
commit
aaa9450ccd
@ -458,7 +458,8 @@ class Sales_PD_Controller extends REST_Controller {
|
||||
'product'=>$sales_pd_data[0]['abbr'],
|
||||
'caseno'=>$sales_pd_data[0]['sales_pd_sno'],
|
||||
'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)
|
||||
{
|
||||
@ -476,6 +477,7 @@ class Sales_PD_Controller extends REST_Controller {
|
||||
if(!empty($officer_details)){
|
||||
foreach($officer_details as $key=>$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'];
|
||||
$smcauthtoken = smcfinance::SmcFinanceAuthUrl();
|
||||
if($smcauthtoken != null){
|
||||
log_message('ERROR','## smc i got token, '.$smcauthtoken);
|
||||
smcfinance::SmcFinanceApiUrl($applicant_id,$records['sales_pd_id'],$sales_pd_sno,2,$smcauthtoken);
|
||||
}else{
|
||||
log_message('ERROR','## no token, '.$smcauthtoken);
|
||||
log_message('ERROR','## SMC Finance Auth Token Not Founded, '.$smcauthtoken);
|
||||
}
|
||||
|
||||
//CAMUNDA::completeSalesPDTask($records['sales_pd_id']);
|
||||
@ -1836,173 +1837,187 @@ public function filterSalesPDList_post() {
|
||||
// $reponse_arr = json_decode(,true);
|
||||
// print_r(APPPATH."controller/newSalesPD.json");die();
|
||||
$lenderid = (ENVIRONMENT == 'production' ? 7 : 35);
|
||||
if ((!empty($sales_pd_type)) && (!empty($productname)) && (!empty($applicantname)) && (!empty($applicantid)) && (!empty($usersemailid)) && (!empty($loanamount))) {
|
||||
|
||||
/************lender id,shortname******************/
|
||||
$lender_short_name = $this->Sales_PD_Model->selectCustomRecords(array('short_name'),array('entity_id' => $lenderid),ENTITY);
|
||||
|
||||
/************product id,name,abbr******************/
|
||||
if($productname){
|
||||
$product_short_name = preg_replace('/[^A-Za-z0-9\-]/', '', strtoupper($productname));
|
||||
$product_where_condition = array('isactive' => 1);
|
||||
if ($usersemailid) {
|
||||
$product_where_condition['abbr like'] = '%'.$product_short_name.'%';
|
||||
}
|
||||
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))) {
|
||||
|
||||
|
||||
/************lender id,shortname******************/
|
||||
$lender_short_name = $this->Sales_PD_Model->selectCustomRecords(array('short_name'),array('entity_id' => $lenderid),ENTITY);
|
||||
|
||||
/************product id,name,abbr******************/
|
||||
if($productname){
|
||||
$product_short_name = preg_replace('/[^A-Za-z0-9\-]/', '', strtoupper($productname));
|
||||
$product_where_condition = array('isactive' => 1);
|
||||
if ($usersemailid) {
|
||||
$product_where_condition['abbr like'] = '%'.$product_short_name.'%';
|
||||
}
|
||||
|
||||
$product_id = $this->Sales_PD_Model->selectCustomRecords(array('product_id'),$product_where_condition,PRODUCTS);
|
||||
$product_id = $product_id[0]['product_id'];
|
||||
}
|
||||
|
||||
/************user id******************/
|
||||
$columns = array('USERPROFILE.userid','ROLES.role_id','USERPROFILEROLES.user_role','ROLES.role_name');
|
||||
$table = USERPROFILE.' as USERPROFILE';
|
||||
$joins = array(array('table' => USERPROFILEROLES. ' as USERPROFILEROLES',
|
||||
'condition' =>'USERPROFILEROLES.fk_userid = USERPROFILE.userid and USERPROFILEROLES.isactive =1',
|
||||
'jointype' => 'INNER'),
|
||||
array('table' => ROLES.' as ROLES',
|
||||
'condition' =>'ROLES.role_id = USERPROFILEROLES.user_role',
|
||||
'jointype' => 'INNER'));
|
||||
$order_by = 'USERPROFILE.userid';
|
||||
if ($usersemailid) {
|
||||
$user_where_condition['email like'] = '%'.$usersemailid.'%';
|
||||
}
|
||||
$user_details = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$user_where_condition,$order_by,'DESC','',$or_where);
|
||||
$user_id = $user_details[0]['userid'];
|
||||
$role_id = $user_details[0]['role_id'];
|
||||
$createdby = $user_id;
|
||||
$product_id = $this->Sales_PD_Model->selectCustomRecords(array('product_id'),$product_where_condition,PRODUCTS);
|
||||
$product_id = $product_id[0]['product_id'];
|
||||
}
|
||||
|
||||
/************user id******************/
|
||||
$columns = array('USERPROFILE.userid','ROLES.role_id','USERPROFILEROLES.user_role','ROLES.role_name');
|
||||
$table = USERPROFILE.' as USERPROFILE';
|
||||
$joins = array(array('table' => USERPROFILEROLES. ' as USERPROFILEROLES',
|
||||
'condition' =>'USERPROFILEROLES.fk_userid = USERPROFILE.userid and USERPROFILEROLES.isactive =1',
|
||||
'jointype' => 'INNER'),
|
||||
array('table' => ROLES.' as ROLES',
|
||||
'condition' =>'ROLES.role_id = USERPROFILEROLES.user_role',
|
||||
'jointype' => 'INNER'));
|
||||
$order_by = 'USERPROFILE.userid';
|
||||
if ($usersemailid) {
|
||||
$user_where_condition['email like'] = '%'.$usersemailid.'%';
|
||||
}
|
||||
$user_details = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$user_where_condition,$order_by,'DESC','',$or_where);
|
||||
$user_id = $user_details[0]['userid'];
|
||||
$role_id = $user_details[0]['role_id'];
|
||||
$createdby = $user_id;
|
||||
|
||||
/************random URL******************/
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < 16; $i++)
|
||||
{
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
|
||||
/************Random URL******************/
|
||||
$count = $this->Sales_PD_Model->selectCustomRecords(array('count(*) as count'),array('lender_id' => $lenderid,'product_id' => $product_id,'isactive' => 1),SALES_PD_DATA);
|
||||
|
||||
$salepd_serial_no = count($lender_short_name)? $lender_short_name[0]['short_name']:'UNKNOWN';
|
||||
$salepd_serial_no .= $product_id? '-'.$product_short_name:'-UNKNOWN';
|
||||
$salepd_serial_no .= '-'.(++$count[0]['count']);
|
||||
log_message('ERROR','## 1) random string : '.$randomString.' serial No : '.$salepd_serial_no);
|
||||
/*************Inserting Here ******************/
|
||||
$records = array("sales_pd_sno"=> $salepd_serial_no,"rand_string"=>$randomString,"lender_id"=>$lenderid, "product_id"=>$product_id, "sales_pd_type"=>$sales_pd_type, "applicant_id"=>$applicantid, "applicant_name"=>$applicantname, "createdby"=>$createdby, "isactive"=>1);
|
||||
$id = $this->Sales_PD_Model->saveRecords($records,SALES_PD_DATA);
|
||||
$salepdid = $id;
|
||||
// $id = 775; // 772,773,777,778
|
||||
log_message('ERROR','## 2) available sales pdid : '.$id);
|
||||
if (!empty($id)) {
|
||||
$msg = "Inserted, Sales PD : ".$salepd_serial_no."/".$id;
|
||||
$template = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('lender_id' => $lenderid,'product_id' => $product_id,'pd_type' => 1,'sales_pd_type' => $sales_pd_type,'isactive' => 1),SALESPDTEMPLATE);
|
||||
log_message('ERROR',"## 3) sales_pd_template_id : ".$template[0]["sales_pd_template_id"]." name : ".$template[0]["name"]." lender_id : ".$template[0]["lender_id"]." product_id : ".$template[0]["product_id"]." pd_type : ".$template[0]["pd_type"]." sales_pd_type : ".$template[0]["sales_pd_type"]);
|
||||
log_message('ERROR','## 4) '.$msg);
|
||||
$template = json_decode($template[0]['template'],true);
|
||||
$section_data=array();
|
||||
foreach ($template['sections'] as $key => $value){
|
||||
$section_id = $template['sections'][$key]['section_id'];
|
||||
$section_name = $template['sections'][$key]['section_name'];
|
||||
switch($section_id)
|
||||
/************random URL******************/
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < 16; $i++)
|
||||
{
|
||||
case 1:
|
||||
if($value['questions'])
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
|
||||
/************Random URL******************/
|
||||
$count = $this->Sales_PD_Model->selectCustomRecords(array('count(*) as count'),array('lender_id' => $lenderid,'product_id' => $product_id,'isactive' => 1),SALES_PD_DATA);
|
||||
|
||||
$salepd_serial_no = count($lender_short_name)? $lender_short_name[0]['short_name']:'UNKNOWN';
|
||||
$salepd_serial_no .= $product_id? '-'.$product_short_name:'-UNKNOWN';
|
||||
$salepd_serial_no .= '-'.(++$count[0]['count']);
|
||||
log_message('ERROR','## 1) random string : '.$randomString.' serial No : '.$salepd_serial_no);
|
||||
/*************Inserting Here ******************/
|
||||
$records = array("sales_pd_sno"=> $salepd_serial_no,"rand_string"=>$randomString,"lender_id"=>$lenderid, "product_id"=>$product_id, "sales_pd_type"=>$sales_pd_type, "applicant_id"=>$applicantid, "applicant_name"=>$applicantname, "createdby"=>$createdby, "isactive"=>1);
|
||||
$id = $this->Sales_PD_Model->saveRecords($records,SALES_PD_DATA);
|
||||
$salepdid = $id;
|
||||
// $id = 775; // 772,773,777,778
|
||||
log_message('ERROR','## 2) available sales pdid : '.$id);
|
||||
if (!empty($id)) {
|
||||
$msg = "Inserted, Sales PD : ".$salepd_serial_no."/".$id;
|
||||
$template = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('lender_id' => $lenderid,'product_id' => $product_id,'pd_type' => 1,'sales_pd_type' => $sales_pd_type,'isactive' => 1),SALESPDTEMPLATE);
|
||||
log_message('ERROR',"## 3) sales_pd_template_id : ".$template[0]["sales_pd_template_id"]." name : ".$template[0]["name"]." lender_id : ".$template[0]["lender_id"]." product_id : ".$template[0]["product_id"]." pd_type : ".$template[0]["pd_type"]." sales_pd_type : ".$template[0]["sales_pd_type"]);
|
||||
log_message('ERROR','## 4) '.$msg);
|
||||
$template = json_decode($template[0]['template'],true);
|
||||
$section_data=array();
|
||||
foreach ($template['sections'] as $key => $value){
|
||||
$section_id = $template['sections'][$key]['section_id'];
|
||||
$section_name = $template['sections'][$key]['section_name'];
|
||||
switch($section_id)
|
||||
{
|
||||
foreach($value['questions'] as $form_key => $form_value)
|
||||
{
|
||||
$fieldtype = isset($form_value['type']) ? $form_value['type'] : "";
|
||||
// echo $fieldtype;
|
||||
if($form_value['question_key'] == 'application_id'){
|
||||
$value['questions'][$form_key]['answer_value'] = $applicantid;
|
||||
}else if($form_value['question_key'] == 'main_loan_applicant'){
|
||||
$value['questions'][$form_key]['answer_value'] = $applicantname;
|
||||
}
|
||||
// else if($form_value['question_key'] == 'company_name'){
|
||||
// $value['questions'][$form_key]['answer_value'] = "PVT LIMIT";
|
||||
// }
|
||||
// else if($form_value['question_key'] == 'person_met_during_visit'){
|
||||
// $value['questions'][$form_key]['answer_value'] = "shree 4";
|
||||
// }
|
||||
// else if($form_value['question_key'] == 'address_visited'){
|
||||
// $value['questions'][$form_key]['answer_value'] = "Perambalur - 7";
|
||||
// }
|
||||
else if($form_value['question_key'] === 'state'){
|
||||
$value['questions'][$form_key]['answer_value'] = 0;
|
||||
$value['questions'][$form_key]['answers'] = $this->Sales_PD_Model->selectCustomRecords(array('state_id as answer_id','name as answer'),array('isactive' => 1),STATE);
|
||||
}
|
||||
else if($form_value['question_key'] === 'person_met_designation'){
|
||||
$value['questions'][$form_key]['answer_value'] = 0;
|
||||
$value['questions'][$form_key]['answers'] = $this->Sales_PD_Model->selectCustomRecords(array('company_relationship_id as answer_id','name as answer'),array('isactive' => 1),COMPANYRELATIONSHIPS);
|
||||
}
|
||||
|
||||
else if(!empty($form_value['question_key'])){
|
||||
$value['questions'][$form_key]['answer_value'] = ($fieldtype == 8 || $fieldtype == 4 || $fieldtype == 3 || $fieldtype == 2) ? 0 : null;
|
||||
}
|
||||
|
||||
}
|
||||
$general = array("section_id"=>$section_id,"section_name"=>$section_name,"onsubmit"=>null,"questions"=>$value['questions'],"order_id"=>1,"is_complete"=>1,"fk_createdby"=>$createdby,"sales_pd_id"=>$id);
|
||||
array_push($section_data, $general);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if($value['questions'] && $loanamount)
|
||||
{
|
||||
foreach($value['questions'] as $form_key => $form_value)
|
||||
case 1:
|
||||
if($value['questions'])
|
||||
{
|
||||
$fieldtype = isset($form_value['type']) ? $form_value['type'] : "";
|
||||
if($form_value['question_key'] == 'loan_amount_applied'){
|
||||
$value['questions'][$form_key]['answer_value'] = $loanamount;
|
||||
foreach($value['questions'] as $form_key => $form_value)
|
||||
{
|
||||
$fieldtype = isset($form_value['type']) ? $form_value['type'] : "";
|
||||
// echo $fieldtype;
|
||||
if($form_value['question_key'] == 'application_id'){
|
||||
$value['questions'][$form_key]['answer_value'] = $applicantid;
|
||||
}else if($form_value['question_key'] == 'main_loan_applicant'){
|
||||
$value['questions'][$form_key]['answer_value'] = $applicantname;
|
||||
}
|
||||
// else if($form_value['question_key'] == 'company_name'){
|
||||
// $value['questions'][$form_key]['answer_value'] = "PVT LIMIT";
|
||||
// }
|
||||
// else if($form_value['question_key'] == 'person_met_during_visit'){
|
||||
// $value['questions'][$form_key]['answer_value'] = "shree 4";
|
||||
// }
|
||||
// else if($form_value['question_key'] == 'address_visited'){
|
||||
// $value['questions'][$form_key]['answer_value'] = "Perambalur - 7";
|
||||
// }
|
||||
else if($form_value['question_key'] === 'state'){
|
||||
$value['questions'][$form_key]['answer_value'] = 0;
|
||||
$value['questions'][$form_key]['answers'] = $this->Sales_PD_Model->selectCustomRecords(array('state_id as answer_id','name as answer'),array('isactive' => 1),STATE);
|
||||
}
|
||||
else if($form_value['question_key'] === 'person_met_designation'){
|
||||
$value['questions'][$form_key]['answer_value'] = 0;
|
||||
$value['questions'][$form_key]['answers'] = $this->Sales_PD_Model->selectCustomRecords(array('company_relationship_id as answer_id','name as answer'),array('isactive' => 1),COMPANYRELATIONSHIPS);
|
||||
}
|
||||
|
||||
else if(!empty($form_value['question_key'])){
|
||||
$value['questions'][$form_key]['answer_value'] = ($fieldtype == 8 || $fieldtype == 4 || $fieldtype == 3 || $fieldtype == 2) ? 0 : null;
|
||||
}
|
||||
|
||||
}
|
||||
else if(!empty($form_value['question_key'])){
|
||||
$value['questions'][$form_key]['answer_value'] = ($fieldtype == 8 || $fieldtype == 4 || $fieldtype == 3 || $fieldtype == 2) ? 0 : null;
|
||||
}
|
||||
|
||||
$general = array("section_id"=>$section_id,"section_name"=>$section_name,"onsubmit"=>null,"questions"=>$value['questions'],"order_id"=>1,"is_complete"=>1,"fk_createdby"=>$createdby,"sales_pd_id"=>$id);
|
||||
array_push($section_data, $general);
|
||||
}
|
||||
$fund = array("section_id"=>$section_id,"section_name"=>$section_name,"onsubmit"=>null,"questions"=>$value['questions'],"order_id"=>1,"is_complete"=>1,"fk_createdby"=>$createdby,"sales_pd_id"=>$id);
|
||||
array_push($section_data, $fund);
|
||||
}
|
||||
break;
|
||||
default: "No Sections";
|
||||
}
|
||||
}
|
||||
if(!empty($section_data)){
|
||||
foreach ($section_data as $key => $data_value){
|
||||
$check=$this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' =>$id,'section_id' => $data_value['section_id'],'isactive' => 1 ),SALESPD_SECTION_DATA);
|
||||
if(count($check)>0){
|
||||
$this->Sales_PD_Model->updateRecords(array('isactive' => 0),SALESPD_SECTION_DATA,array('sales_pd_id' =>$id,'section_id' => $data_value['section_id'] ));
|
||||
break;
|
||||
case 2:
|
||||
if($value['questions'] && $loanamount)
|
||||
{
|
||||
foreach($value['questions'] as $form_key => $form_value)
|
||||
{
|
||||
$fieldtype = isset($form_value['type']) ? $form_value['type'] : "";
|
||||
if($form_value['question_key'] == 'loan_amount_applied'){
|
||||
$value['questions'][$form_key]['answer_value'] = $loanamount;
|
||||
}
|
||||
else if(!empty($form_value['question_key'])){
|
||||
$value['questions'][$form_key]['answer_value'] = ($fieldtype == 8 || $fieldtype == 4 || $fieldtype == 3 || $fieldtype == 2) ? 0 : null;
|
||||
}
|
||||
|
||||
}
|
||||
$fund = array("section_id"=>$section_id,"section_name"=>$section_name,"onsubmit"=>null,"questions"=>$value['questions'],"order_id"=>1,"is_complete"=>1,"fk_createdby"=>$createdby,"sales_pd_id"=>$id);
|
||||
array_push($section_data, $fund);
|
||||
}
|
||||
break;
|
||||
default: "No Sections";
|
||||
}
|
||||
}
|
||||
//insert new record
|
||||
$section_data_arr = json_encode($data_value);
|
||||
$fields = array('sales_pd_id' => $id, 'section_id' => $data_value['section_id'], 'status' =>1,'section_data' => $section_data_arr,'createdby' => $createdby);
|
||||
$reponse = $this->Sales_PD_Model->saveRecords($fields,SALESPD_SECTION_DATA);
|
||||
// $reponse = 1;
|
||||
$msg = $msg." ( ".$data_value['section_name']." ID : ".$reponse. " )";
|
||||
log_message('ERROR','## 5) Confirmation : '.$msg);
|
||||
}
|
||||
if(!empty($section_data)){
|
||||
foreach ($section_data as $key => $data_value){
|
||||
$check=$this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' =>$id,'section_id' => $data_value['section_id'],'isactive' => 1 ),SALESPD_SECTION_DATA);
|
||||
if(count($check)>0){
|
||||
$this->Sales_PD_Model->updateRecords(array('isactive' => 0),SALESPD_SECTION_DATA,array('sales_pd_id' =>$id,'section_id' => $data_value['section_id'] ));
|
||||
}
|
||||
//insert new record
|
||||
$section_data_arr = json_encode($data_value);
|
||||
$fields = array('sales_pd_id' => $id, 'section_id' => $data_value['section_id'], 'status' =>1,'section_data' => $section_data_arr,'createdby' => $createdby);
|
||||
$reponse = $this->Sales_PD_Model->saveRecords($fields,SALESPD_SECTION_DATA);
|
||||
// $reponse = 1;
|
||||
$msg = $msg." ( ".$data_value['section_name']." ID : ".$reponse. " )";
|
||||
log_message('ERROR','## 5) Confirmation : '.$msg);
|
||||
}
|
||||
}
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['msg'] = "Sales PD : ".$salepd_serial_no;
|
||||
} else {
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
|
||||
$data['msg'] = 'Data Not Found,Try again';
|
||||
}
|
||||
log_message('ERROR','## 6) Finally, '.$data['msg']);
|
||||
date_default_timezone_set("Asia/Kolkata");
|
||||
$current_date = date("d/m/Y H:i:s");
|
||||
$smcauthtoken = smcfinance::SmcFinanceAuthUrl();
|
||||
if($smcauthtoken != null){
|
||||
log_message('ERROR','## 7) I Got SMC Finance Auth Token');
|
||||
smcfinance::SmcFinanceApiUrl($applicantid,$salepdid,$salepd_serial_no,1,$smcauthtoken);
|
||||
}else{
|
||||
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';
|
||||
}
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['msg'] = "Sales PD : ".$salepd_serial_no;
|
||||
} else {
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
|
||||
$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']);
|
||||
date_default_timezone_set("Asia/Kolkata");
|
||||
$current_date = date("d/m/Y H:i:s");
|
||||
$smcauthtoken = smcfinance::SmcFinanceAuthUrl();
|
||||
if($smcauthtoken != null){
|
||||
log_message('ERROR','## 7) i got token, '.$smcauthtoken);
|
||||
smcfinance::SmcFinanceApiUrl($applicantid,$salepdid,$salepd_serial_no,1,$smcauthtoken);
|
||||
}else{
|
||||
log_message('ERROR','## 7) no token, '.$smcauthtoken);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ENVIRONMENT == 'production'){
|
||||
$auth_user_id = "MwiseSales@yahoo.com";
|
||||
|
||||
@ -55,7 +55,7 @@ class CET_SALESPD
|
||||
try{
|
||||
$ch = curl_init();
|
||||
$output_data = json_encode( $fields );
|
||||
// print_r($output_data);die();
|
||||
//print_r($output_data);die();
|
||||
log_message('ERROR',"PullSalesPDData api Request Format : ".$output_data);
|
||||
curl_setopt( $ch,CURLOPT_URL, CET_SALESPD_INTEGRATION_URL);
|
||||
curl_setopt( $ch,CURLOPT_POST, true );
|
||||
|
||||
@ -10,13 +10,13 @@ class SMCFINANCE
|
||||
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";
|
||||
$headers = array('Content-Type: application/json');
|
||||
try{
|
||||
$ch = curl_init();
|
||||
$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_HTTPHEADER, $headers);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
@ -37,12 +37,12 @@ class SMCFINANCE
|
||||
// $response_decoded = json_decode($result);
|
||||
// $response = $response_decoded;
|
||||
curl_close( $ch );
|
||||
log_message('ERROR', "Smc Finance Auth Url token : " . $token);
|
||||
log_message('ERROR', "## SMC Finance Auth Url Token : " . $token);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$token = null;
|
||||
// $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;
|
||||
}
|
||||
@ -56,11 +56,12 @@ class SMCFINANCE
|
||||
{
|
||||
$CI =& get_instance();
|
||||
// $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');
|
||||
try{
|
||||
$ch = curl_init();
|
||||
$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_HTTPHEADER, $headers);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
@ -73,11 +74,11 @@ class SMCFINANCE
|
||||
$response_decoded = json_decode($result);
|
||||
$response = $response_decoded;
|
||||
curl_close( $ch );
|
||||
log_message('ERROR','#### Smc Finance Refresh Token reponse '.$response);
|
||||
log_message('ERROR','#### SMC Finance Refresh Token Reponse '.$response);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$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;
|
||||
}
|
||||
@ -94,11 +95,7 @@ class SMCFINANCE
|
||||
try{
|
||||
$ch = curl_init();
|
||||
$body = '{"pdId":"'.$sales_pd_sno.'","pdStatus":'.$sales_pd_status.',"salesLeadId":'.$applicant_id.'}';
|
||||
// $object->pdId = $sales_pd_sno;
|
||||
// $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);
|
||||
log_message('ERROR',"SMC Finance Api Request ".$body);
|
||||
// $put_url = SMC_FINANCE_API_URL.$sales_pd_id.'/update-pd';
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, SMC_FINANCE_UPDATE_URL);
|
||||
@ -112,13 +109,13 @@ class SMCFINANCE
|
||||
|
||||
$result = curl_exec($ch );
|
||||
$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 );
|
||||
}
|
||||
catch (Exception $e) {
|
||||
// $response->error = 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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user