CUS LINK API

This commit is contained in:
Velz2020 2020-04-10 16:04:00 +05:30
parent a99062be83
commit 148b121818
3 changed files with 55 additions and 10 deletions

View File

@ -224,6 +224,7 @@ $route['getLenderContactPersons'] = 'PD_Controller/getLenderContactPersons';
$route['getLenderContactPersons'] = 'PD_Controller/getLenderContactPersons';
$route['saveApplicantFromGeneralForm'] = 'PD_Controller/saveApplicantFromGeneralForm';
$route['putSalCheck'] = 'PD_Controller/putSalCheck';
$route['sendCusLinkViaSMS'] = 'PD_Controller/sendCusLinkViaSMS';
// $route['getPDFormDetailsJSON'] = 'PD_Controller/getPDFormDetailsJSON';
$route['smartyTestFunction'] = 'PD_Controller/smartyTestFunction';

View File

@ -805,13 +805,14 @@ class PD_Controller extends REST_Controller {
public function updatePDMaster_post()
{
$pd_details = $this->post('records');
log_message('ERROR',"UpdatePD Called");
// log_message('ERROR',print_r($pd_details));
if((isset($pd_details['pd_id']) && $pd_details['pd_id'] != "" ) && (isset($pd_details['random_string']) && $pd_details['random_string'] != " "))
{
$logger = MYLOG::logFunction(null,$pd_details['pd_id']);
EXTERNAL_DIR_CHECK::checkExternalDirectory($pd_details['pd_id']);
$exist_pd_details = $this->PD_Model->getPDMasterDetails($pd_details['pd_id']);
//print_r($exist_pd_details);
// print_r($exist_pd_details);
if(!file_exists($this->external_path.'/pd_reports/'.$pd_details['pd_id']))
{
@ -831,7 +832,7 @@ class PD_Controller extends REST_Controller {
}
if(isset($pd_details['pd_status']) && $pd_details['pd_status'] == STARTED)
{
// echo 'STARTED';
$pd_details['start_location'] = $pd_details['link'];
unset($pd_details['link']);
@ -851,14 +852,15 @@ class PD_Controller extends REST_Controller {
SMS_GUPSHUP::sendSMS($msg,$no,array('pd_id' => $pd_details['pd_id'],'status' => 'STARTED','msg' => 'Started OTP msg from PD controlller'));
}
if($exist_pd_details[0]['fk_pd_type'] == 3)
{
$msg = "Dear Applicant, Please click the link to upload the photographs." . CUSTOMER_IMG_URL .$exist_pd_details[0]['random_string'];
SMS_GUPSHUP::sendSMS($msg,$no,array('pd_id' => $exist_pd_details[0]['pd_id'],'status' => 'STARTED','msg' => 'Cus Link from PD controlller'));
}
// if($exist_pd_details[0]['fk_pd_type'] == 3)
// {
// // echo 'JBDJS';
// $msg = "Dear Applicant, Please click the link to upload the photographs. " . CUSTOMER_IMG_URL .$exist_pd_details[0]['random_string'];
// SMS_GUPSHUP::sendSMS($msg,$no,array('pd_id' => $exist_pd_details[0]['pd_id'],'status' => 'STARTED','msg' => 'Cus Link from PD controlller'));
// }
}
// die();
if(isset($pd_details['pd_status']) && ($pd_details['pd_status'] == COMPLETED) || ($pd_details['pd_status'] == ADD_ON_PENDING) )
{
@ -9765,6 +9767,43 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
// }
}
}
function sendCusLinkViaSMS_post()
{
$mobile_no = $this->post('mobile_no');
$random_string = $this->post('random_string');
$pd_id = $this->post('pd_id');
$response = false;
$msg = "Dear Applicant, Please click the link to upload the photographs. " . CUSTOMER_IMG_URL .$random_string;
$res = SMS_GUPSHUP::sendSMS($msg,$mobile_no,array('pd_id' => $pd_id,'status' => 'STARTED','msg' => 'Cus Link from PD controlller'),true);
$res = explode('|', $res);
if(is_array($res) && count($res))
{
if(trim($res[0]) == "success")
{
$response = true;
}
}
if($response)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['msg'] = 'SMS Sent Successfully';
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'SMS Sent Falied. Try Later!';
$this->response($data,REST_Controller::HTTP_OK);
}
}
}

View File

@ -3,7 +3,7 @@
class SMS_GUPSHUP
{
public static function sendSMS($msg,$no,$additional_data = array())
public static function sendSMS($msg,$no,$additional_data = array(),$return = false)
{
$CI =&get_instance();
$msg=str_replace(array(" ","'",":",",","/","#",),array('%20','%27', '%3A', '%2C', '%2F', '%23'),$msg);
@ -20,6 +20,11 @@ class SMS_GUPSHUP
$logger = MYLOG::logFunction(null,$additional_data['pd_id']);
$logger->info("Msg Send Status",array('response_data' => $contents,'mobile_no' => $no,'msg' => $msg,'sms_api_url' => $sms_api_url,'additional_data' => $additional_data));
if($return)
{
return $contents;
}
}