SMS INTEGRATION

This commit is contained in:
velz 2019-03-11 15:36:57 +05:30
parent 1708c92211
commit 0f08a56d31
6 changed files with 66 additions and 40 deletions

View File

@ -89,7 +89,7 @@ $autoload['drivers'] = array();
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myuitil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform');
$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myuitil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform','sms_gupshup');
/*
| -------------------------------------------------------------------

View File

@ -49,6 +49,12 @@ $config['authorization_key'] = 'sparqvenba2018';
/* End of file jwt.php */
/* Location: ./application/config/jwt.php */
// ************ SMSGUPSHUP Configurations ***********************//
$config['sms_api_user_id'] = '2000185290';
$config['sms_api_pwd'] = 'wRfAwb&v';
$config['sms_gupshup_url'] = 'http://enterprise.smsgupshup.com/GatewayAPI/rest?method=SendMessage&send_to={{send_to_mobile_no}}&msg={{send_msg}}&msg_type=TEXT&userid={{sms_api_user_id}}&auth_scheme=plain&password={{sms_api_pwd}}=1.1&format=text';
$config['master_tables_field_names'] = array('INDUSTRYCLASSIFICATION' => 'name','UOM' => 'name','OCCUPATIONMEMBERS' => 'name','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'name','RELATIONSHIPS' => 'name','FREQUENCY' => 'name', 'CUSTOMERBEHAVIOUR' => 'description', 'CUSTOMERSEGMENT' => 'name','DESIGNATION' => 'short_name', 'EARNINGMEMBERSSTATUS' => 'earning_member_status','EDUQUALIFICATION' => 'qualification_name','ADDRESSTYPE' => 'address_type','LOCALITY' => 'locality_name','ASSETTYPE' => 'name','PROPERTIES' => 'name','INVESTMENTTYPE' => 'name','INSURANCETYPE' => 'name','PERSONSMET' => 'person_met_name','RESIDENCEOWNERSHIP' => 'name','PAYMENTMODE' => 'name','ACCOUNTTYPE' => 'name','SOURCEOFOTHERINCOME' => 'name','MORTAGEPROPERTYTYPE' => 'name','ENDUSEOFLOAN' => 'enduse_of_loan','SOURCEOFBALANCETRANSFER' => 'name', 'STATUSOFCONSTRUCTION' => 'name','BTLENDERLIST'=>'lender_name','MORTAGEPROPERTIES'=>'property_name','EXISTINGLOANTYPES'=>'loan_type_name','PDAPPLICANTSDETAILS'=>'applicant_name','RELATIONWITHBUSINESS'=>'relation_with_business_name','BUSINESSENTITYTYPE'=>'business_entity_type_name','COMPANYRELATIONSHIPS'=>'name','STATE'=>'name','CITY'=>'name','COUNTRY'=>'country_name','BOUNCEMASTER'=>'bounce_reason_name','BUSINESSEXPENSES'=>'expense_item','BUSINESSINCOME'=>'business_income_item','COMMENTSONLOCALITY'=>'rating','COMPANY'=>'company_id','LOCALITY'=>'locality_name','NONINDIVIDUALENTITIES'=>'non_individual_entity_name','PDFORMS'=>'pd_form_name','PDLOCATIONAPPROACH'=>'description','PDTYPE'=>'type_name','PDNOTIFICATION'=>'pd_status','QUESTIONCATEGORY'=>'category_name','ROLES'=>'role_name','SUBPRODUCTS'=>'name','TITLES'=>'name','PINCODE'=>'pincode','PRODUCTS'=>'name','ENTITYTYPE'=>'name','PDTEAM'=>'team_name','ENTITY'=>'short_name','PDSTATUS'=>'pd_status_name','LISTOFMASTERS'=>'master_name','OTPREJECTION'=>'rejection_reason','ENDUSEOFTOPUP'=>'end_use_of_topup','VEHICLETYPE'=>'vehicle_type_name','PDOFFICERRECOMMENDATIONS'=>'pdofficer_recommendation','REGIONS'=>'name','PRICINGINFO'=>'pricing_info_id');
$config['master_tables_pkid'] = array('INDUSTRYCLASSIFICATION' => 'industry_classification_id','UOM' => 'uom_id','OCCUPATIONMEMBERS' => 'occupation_non_earning_member_id','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'type_of_activity_id','RELATIONSHIPS' => 'relationship_id','FREQUENCY' => 'frequency_id', 'CUSTOMERBEHAVIOUR' => 'customer_behaviour_id', 'CUSTOMERSEGMENT' => 'customer_segment_id','DESIGNATION' => 'designation_id', 'EARNINGMEMBERSSTATUS' => 'earning_member_status_id','EDUQUALIFICATION' => 'qualification_id','ADDRESSTYPE' => 'address_type_id','LOCALITY' => 'locality_id','ASSETTYPE' => 'id','PROPERTIES' => 'id','INVESTMENTTYPE' => 'id','INSURANCETYPE' => 'id','PERSONSMET' => 'person_met_id','RESIDENCEOWNERSHIP' => 'id','PAYMENTMODE' => 'id','ACCOUNTTYPE' => 'id','SOURCEOFOTHERINCOME' => 'id','MORTAGEPROPERTYTYPE' => 'id','ENDUSEOFLOAN' => 'enduse_of_loan_id','SOURCEOFBALANCETRANSFER' => 'id', 'STATUSOFCONSTRUCTION' => 'id','MORTAGEPROPERTIES' => 'mortage_property_id','BTLENDERLIST'=>'bt_lender_list_id','EXISTINGLOANTYPES'=>'existing_loan_type_id','PDAPPLICANTSDETAILS'=>'pd_co_applicant_id','RELATIONWITHBUSINESS'=>'relation_with_business_id','BUSINESSENTITYTYPE'=>'business_entity_type_id','COMPANYRELATIONSHIPS'=>'company_relationship_id','STATE'=>'state_id','CITY'=>'city_id','COUNTRY'=>'country_id','BOUNCEMASTER'=>'bounce_id','BUSINESSEXPENSES'=>'expense_item_id','BUSINESSINCOME'=>'business_income_id','COMMENTSONLOCALITY'=>'comments_on_locality_id','COMPANY'=>'name','LOCALITY'=>'locality_id','NONINDIVIDUALENTITIES'=>'non_individual_entity_id','PDFORMS'=>'form_id','PDLOCATIONAPPROACH'=>'pd_location_approach_id','PDTYPE'=>'pd_type_id','PDNOTIFICATION'=>'pdnotification_id','QUESTIONCATEGORY'=>'question_category_id','ROLES'=>'role_id','SUBPRODUCTS'=>'subproduct_id','TITLES'=>'title_id','PINCODE'=>'pincode_id','PRODUCTS'=>'product_id','ENTITYTYPE'=>'entity_type_id','PDTEAM'=>'pdteam_id','ENTITY'=>'entity_id','PDSTATUS'=>'pd_status_id','LISTOFMASTERS'=>'master_id','OTPREJECTION'=>'otp_rejection_id','ENDUSEOFTOPUP'=>'end_use_of_topup_id','VEHICLETYPE'=>'vehicle_type_id','PDOFFICERRECOMMENDATIONS'=>'pdofficer_recommendation_id','REGIONS'=>'region_id','PRICINGINFO'=>'pricing_info_id');

View File

@ -681,7 +681,10 @@ class PD_Controller extends REST_Controller {
$no = (string)$pd_details['mobile_no'];
unset($pd_details['mobile_no']);
$pd_details['OTP'] = $OTP;
$this->aws_sns->sendSMS($msg,$no);
$client = new \GuzzleHttp\Client();
$response = $client->post( $url);
SMS_GUPSHUP::sendSMS($msg,$no);
}
@ -3559,6 +3562,7 @@ class PD_Controller extends REST_Controller {
$temp = $this->load->view('report_templates/JSONTOREPORT',$data,true);
//PDF Gen using DOM PDF
$pdf_doc = $this->pdfgenerator->generate($temp, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
//End of PDF Gen using DOM PDF
@ -3604,7 +3608,7 @@ class PD_Controller extends REST_Controller {
if($is_regenerate != 0){ $latest_version = $data['pd_master_details'][0]['pd_report_latest_version'] + 1; }
//$result_array[0]['content']
$blob_table_temp_array = array('version_no' => $latest_version,'content' => null,'fk_pd_id' => $pdid,'fk_createdby' => $fk_createdby);
$blob_table_temp_array = array('version_no' => $latest_version,'content' => $temp,'fk_pd_id' => $pdid,'fk_createdby' => $fk_createdby);
$id = $this->PD_Model->saveRecords($blob_table_temp_array,PDREPORTSVERSIONBLOB);
@ -4279,24 +4283,6 @@ class PD_Controller extends REST_Controller {
public function codeigniterViewTest_post()
{
echo "fisrt";
$ch = curl_init();
$timeout = 5;
$url = 'http://enterprise.smsgupshup.com/GatewayAPI/rest?method=SendMessage&send_to=919791811189&msg=WelcometoMSGAPI&msg_type=TEXT&userid=2000185290&auth_scheme=plain&password=wRfAwb&v=1.1&format=text';
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$tinyurl = curl_exec($ch);
curl_close($ch);
echo $tinyurl;
echo 'done';
die();
$records = $this->post('records');
$pdid = $records['pd_id'];
$fk_createdby = $records['fk_createdby'];
// die();
$is_regenerate = 0;
if(isset($records['regenerate']))
{

View File

@ -1442,7 +1442,8 @@ class GETPROCESSEDJSON
{
foreach($raw_json['company_with_relationships'] as $company_with_relationship_key => $company_with_relationship)
{
// echo $company_with_relationship_key;
// print_r($company_with_relationship);
if(array_key_exists('companies',$raw_json))
{
//echo "exists";
@ -1472,20 +1473,25 @@ class GETPROCESSEDJSON
}
if($company_with_relationship['company_relationship'] != "" || $company_with_relationship['company_relationship '] != null)
if(array_key_exists('company_relationship',$company_with_relationship))
{
$CI->db->SELECT( $master_tables_field_names['COMPANYRELATIONSHIPS'] );
$CI->db->FROM(COMPANYRELATIONSHIPS);
$CI->db->WHERE('isactive',1);
$CI->db->WHERE( $master_tables_pkid['COMPANYRELATIONSHIPS'] ,$company_with_relationship['company_relationship']);
$name= $CI->db->GET()->result_array();
//print_r($CI->db->last_query());
if(count($name))
{
$raw_json['company_with_relationships'][$company_with_relationship_key]['company_relationship_master'] = $name[0][$master_tables_field_names['COMPANYRELATIONSHIPS']];
}
}
//echo "HI - ".$company_with_relationship['company_relationship'];
if(trim($company_with_relationship['company_relationship']) != "" || trim($company_with_relationship['company_relationship']) != null)
{
$CI->db->SELECT( $master_tables_field_names['COMPANYRELATIONSHIPS'] );
$CI->db->FROM(COMPANYRELATIONSHIPS);
$CI->db->WHERE('isactive',1);
$CI->db->WHERE( $master_tables_pkid['COMPANYRELATIONSHIPS'] ,$company_with_relationship['company_relationship']);
$name= $CI->db->GET()->result_array();
//print_r($CI->db->last_query());
if(count($name))
{
$raw_json['company_with_relationships'][$company_with_relationship_key]['company_relationship_master'] = $name[0][$master_tables_field_names['COMPANYRELATIONSHIPS']];
}
}
}
if($company_with_relationship['relation_to_company'] != "" || $company_with_relationship['relation_to_company'] != null)
{

View File

@ -83,7 +83,7 @@ class PDALERTS
$msg = self::stringReplace($msg,$core_details);
//echo $msg;
$msg = str_replace('<br>','',$msg);
$CI->aws_sns->sendSMS($msg,$lender_sms);
SMS_GUPSHUP::sendSMS($msg,$lender_sms);
}
@ -135,7 +135,7 @@ class PDALERTS
{
$msg = $pd_notification_msg[0]['pdofficer'];
$msg = self::stringReplace($msg,$core_details);
foreach($mobile_nos_to_send_notification as $mobile){ $CI->aws_sns->sendSMS($msg,(string)$mobile); };
foreach($mobile_nos_to_send_notification as $mobile){ SMS_GUPSHUP::sendSMS($msg,(string)$mobile); };
}
@ -153,7 +153,7 @@ class PDALERTS
{
$msg = $pd_notification_msg[0]['customer'];
$msg = self::stringReplace($msg,$core_details);
$CI->aws_sns->sendSMS($msg,(string)$core_details[0]['customer_mobile_no']);
SMS_GUPSHUP::sendSMS($msg,(string)$core_details[0]['customer_mobile_no']);
}
}
}
@ -170,7 +170,7 @@ class PDALERTS
{
$msg = $pd_notification_msg[0]['pdincharge'];
$msg = self::stringReplace($msg,$core_details);
$CI->aws_sns->sendSMS($msg,(string)$core_details[0]['centralpdofficer_mobile_no']);
SMS_GUPSHUP::sendSMS($msg,(string)$core_details[0]['centralpdofficer_mobile_no']);
}
}
}
@ -203,7 +203,7 @@ class PDALERTS
$msg = self::stringReplace($msg,$core_details);
foreach($mobile_nos_to_send_notification as $mobile){
$CI->aws_sns->sendSMS($msg,(string)$mobile['mobile_no']);
SMS_GUPSHUP::sendSMS($msg,(string)$mobile['mobile_no']);
};
}
}

View File

@ -0,0 +1,28 @@
<?php
class SMS_GUPSHUP
{
public static function sendSMS($msg,$no)
{
$CI =&get_instance();
$sms_api_url = $CI->config->item('sms_gupshup_url');
$sms_api_url = str_replace('{{sms_api_user_id}}',$CI->config->item('sms_api_user_id'),$sms_api_url);
$sms_api_url = str_replace('{{sms_api_pwd}}',$CI->config->item('sms_api_pwd'),$sms_api_url);
$sms_api_url = str_replace('{{send_to_mobile_no}}',$no,$sms_api_url);
$sms_api_url = str_replace('{{send_msg}}',$msg,$sms_api_url);
$client = new \GuzzleHttp\Client();
$response = $client->post($sms_api_url);
}
}
?>