New Sales PD api : ps

This commit is contained in:
VE10-Sanjeev 2023-02-08 13:30:22 +05:30
parent 86097a4b46
commit 705e879e8b
4 changed files with 86 additions and 2 deletions

View File

@ -96,7 +96,7 @@ defined('ROUTE_LOGIN_V') OR define('ROUTE_LOGIN_V', 'generateSatelliteImg
defined('ROUTE_LOGIN_U') OR define('ROUTE_LOGIN_U', 'generateOTP');
defined('ROUTE_LOGIN_T') OR define('ROUTE_LOGIN_T', 'verifyOTP');
defined('ROUTE_LOGIN_S') OR define('ROUTE_LOGIN_S', 'purge_pddata');
defined('ROUTE_LOGIN_J') OR define('ROUTE_LOGIN_J', 'newSalesPd');
defined('ROUTE_LOGIN_I') OR define('ROUTE_LOGIN_I', 'saveDatadumpRequest');
defined('ROUTE_LOGIN_H') OR define('ROUTE_LOGIN_H', 'transferCreditPDToCETApp');
defined('ROUTE_LOGIN_G') OR define('ROUTE_LOGIN_G', 'transferSalesPDToCETApp');

View File

@ -425,3 +425,5 @@ $route['saveShortsVideo'] = 'PD_Controller/saveShortsVideo';
$route['transferSalesPDToCETApp'] = 'Sales_PD_Controller/transferSalesPDToCETApp';
$route['transferCreditPDToCETApp'] = 'SMC_Credit_PD_Controller/transferCreditPDToCETApp';
$route['newSalesPd'] = 'Sales_PD_Controller/cetNewSalesPd';

View File

@ -1603,6 +1603,88 @@ public function filterSalesPDList_post() {
print_r(json_decode($section_data[0]['section_data'],true));
}
/****** ******
* API : cetNewSalesPd
* Param : newSalesPd?type=1&prod="LFMP"&apcntname="surya"&apcntid="248"&uid="moneywise@sales.com"
* TO Trigger New Sales PD on CETApp
****** ******/
public function cetNewSalesPd_get(){
//
$pdtype = $this->get('type');
$productname = $this->get('prod');
$applicantname = $this->get('apcntname');
$applicantid = $this->get('apcntid');
$userid = $this->get('uid');
$createdby = null;
$lenderid = (ENVIRONMENT == 'production' ? 7 : 35);
if ((!empty($pdtype)) && (!empty($productname)) && (!empty($applicantname)) && (!empty($applicantid)) && (!empty($userid))) {
/************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 ($userid) {
$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******************/
$user_fields = array('userid');
$user_where_condition = array('isactive' => 1);
// $userid = preg_replace('/[^A-Za-z0-9\/_|+ .-]/', '', $userid);
if ($userid) {
$user_where_condition['email like'] = '%'.$userid.'%';
}
$user_id = $this->Sales_PD_Model->selectCustomRecords($user_fields, $user_where_condition, USERPROFILE);
// print_r($this->db->last_query());die();
$createdby = $user_id[0]['userid'];
/************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']);
/*************Inserting Here ******************/
$records = array("sales_pd_sno"=> $salepd_serial_no,"rand_string"=>$randomString,"lender_id"=>$lenderid, "product_id"=>$product_id, "sales_pd_type"=>$pdtype, "applicant_id"=>$applicantid, "applicant_name"=>$applicantname, "createdby"=>$createdby, "isactive"=>1);
$id = $this->Sales_PD_Model->saveRecords($records,SALES_PD_DATA);
if (!empty($id)) {
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = "Inserted ID : ".$salepd_serial_no."/".$id;
} 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';
}
$this->response($data,REST_Controller::HTTP_OK);
}
}

View File

@ -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 || $routingName == ROUTE_LOGIN_C || $routingName == ROUTE_LOGIN_D || $routingName == ROUTE_LOGIN_E || $routingName == ROUTE_LOGIN_F || $routingName == ROUTE_LOGIN_S || $routingName == ROUTE_LOGIN_G || $routingName == ROUTE_LOGIN_H || $routingName == ROUTE_LOGIN_I)
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 || $routingName == ROUTE_LOGIN_D || $routingName == ROUTE_LOGIN_E || $routingName == ROUTE_LOGIN_F || $routingName == ROUTE_LOGIN_S || $routingName == ROUTE_LOGIN_G || $routingName == ROUTE_LOGIN_H || $routingName == ROUTE_LOGIN_I || $routingName == ROUTE_LOGIN_J)
{
return true;
}