Commit 4ed95df4 by Tobin

dc

parent 3aa08eee
......@@ -783,6 +783,51 @@ class Api extends CI_Controller {
}
}
public function removeCard(){
$settings = getSettings();
$merchant_iv = $settings['merchant_iv'];
$merchant_id = $settings['merchant_id'];
$merchant_key = $settings['merchant_key'];
$cust_id = $this->Api_model->auth_token_get($this->auth_token);
if(empty($cust_id)){
$this->errorResponse('891','Invalid User');
}
$data = (array) json_decode(file_get_contents('php://input'));
$reqData = $this->decrypt($data['requestData'],$this->local_key,$this->local_iv);
if(empty($reqData) || empty($reqData = json_decode($reqData,true)) ||
!isset($reqData['email']) || empty($reqData['email']) ||
!isset($reqData['token']) || empty($reqData['token'])){
$this->errorResponse('892','Invalid Request Data');
}
$request = '{"sessionId":"'.time().rand(100000,999999).'","merchantId":"'.$merchant_id.'",
"custId":"'.$cust_id.'","emailId":"'.$reqData['email'].'",
"tokenNo":"'.$reqData['token'].'"}';
$plainText = $this->encryptePayData($merchant_iv,$merchant_key,$request);
$plainText = $merchant_id.'|'.$plainText;
$env = (strpos($settings['payment_gateway_url'],'staging') !== false)?'staging':'payments';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,"https://$env.bayanpay.sa/direcpay/secure/PaymentsDeleteStoredCardDtlsAPI");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$plainText);
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type: application/x-www-form-urlencoded'));
$result = curl_exec($ch);
if(empty($result)){
$this->errorResponse('892','Invalid Card Data');
}
$resp = $this->decryptePayData($merchant_iv,$merchant_key,$result);
if(empty($resp) || isset($resp->status) || $resp->status != 'SUCCESS'){
$this->errorResponse('893','No Card Found');
}
$this->response(array('message'=>$resp->statusMessage));
}
function hotelBooking(){
try{
$data = (array) json_decode(file_get_contents('php://input'));
......@@ -803,7 +848,5 @@ class Api extends CI_Controller {
$this->errorResponse('894','Something went wrong, Please try again');
}
}
}
?>
......@@ -655,11 +655,15 @@ class OrganizerServices extends CI_Controller {
}
}
public function mobileNumberAvailability(){
$data =(array)json_decode(file_get_contents('php://input'));
$res = $this->Organizer_model->mobileNumberAvailability($data);
if($res['status'] != 0){
$this->response($res['data']);
}else{
$this->errorResponse($res['code'],$res['message']);
}
}
/*================ END : Organizer API ================*/
}
......
......@@ -164,8 +164,8 @@
break;
case 2:
$menus = array('Dashboard'=>array(1,2,3,4),'Tag'=>array(),'Host'=>array(1),
'City'=>array(),'Category'=>array(),'Promocode'=>array(1,2,3,4),
'Event'=>array(1,2,3,4),'Checker'=>array(1,2,3,4),'Customer'=>array(),
'City'=>array(),'Category'=>array(),'Event'=>array(1,2,3,4),
'Checker'=>array(1,2,3,4),'Customer'=>array(),
'Booking'=>array(1,2,3,4),'Venue'=>array(1,2,3,4),'HotelCity'=>array(1,2,3,4));
break;
case 4:
......
......@@ -1755,6 +1755,29 @@ class Organizer_model extends CI_Model {
return $res;
}
public function mobileNumberAvailability($data){
$res = array('status'=>0,'message'=>'Ohh No!! Something Went South','code'=>'ER06');
try{
$number = trim(preg_replace('/[^A-Za-z0-9\-]/', '', $data['country_code'].$data['phone_no']),0);
$sql = "SELECT provider_id FROM provider AS PDR
INNER JOIN users AS USR ON (USR.id = PDR.provider_id)
WHERE (PDR.phone LIKE '%".$number."' OR PDR.phone LIKE '%".$data['phone_no']."') AND
USR.user_type = '2' AND USR.status = '1'";
$resp = $this->db->query($sql)->row_array();
$phAvail = false;
if(!empty($resp) && isset($resp['provider_id']) && !empty($resp['provider_id'])){
$phAvail = true;
}
$res = array('status'=>1,'data'=>array("country_code"=>$data['country_code'],
"phone"=>$data['phone_no'],
"is_phone_available"=>$phAvail));
}catch(Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something Went South','code'=>'ER06');
}
return $res;
}
function send_mail($subject,$email,$message,$attach=null) {
$ci =& get_instance();
$ci->load->library('email');
......
......@@ -397,6 +397,14 @@ class Validation_model extends CI_Model {
'message' => 'Request Data is null or empty'
)
)
),
'removeCard' => array(
'requestData' => array(
'required' => array(
'code' => 'ER18',
'message' => 'Request Data is null or empty'
)
)
)
);
......
......@@ -889,6 +889,20 @@ class Validation_organizer_model extends CI_Model {
)
)
),
'mobileNumberAvailability'=>array(
'phone_no' => array(
'required' => array(
'code' => 'ER30',
'message' => 'Organizer Pnone is null or empty'
)
),
'country_code' => array(
'required' => array(
'code' => 'ER32',
'message' => 'Country Code is null or empty'
)
)
)
);
public function _consruct(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment