Commit f7cfb1e2 by Jansa Jose

dc

parent b15822f0
...@@ -2608,14 +2608,12 @@ ...@@ -2608,14 +2608,12 @@
$headers = apache_request_headers(); $headers = apache_request_headers();
if(!isset($headers['Auth']) || empty($headers['Auth'])){ if(!isset($headers['Auth']) || empty($headers['Auth'])){
$respArr['status'] = 'error'; $this->fail();
$respArr['message'] = 'Authtoken is Required';
echo json_encode($respArr);exit;
} }
$authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']); $authRes = $this->Webservice_model->get_customer_authtoken($headers['Auth']);
if($authRes['status'] == 'error'){ if($authRes['status'] == 'error'){
echo json_encode($authRes);exit; $this->fail();
} }
$post = file_get_contents("php://input"); $post = file_get_contents("php://input");
...@@ -2626,7 +2624,7 @@ ...@@ -2626,7 +2624,7 @@
if($result['status'] == 'success'){ if($result['status'] == 'success'){
$this->orderPayNowApi($result['data']); $this->orderPayNowApi($result['data']);
} }
echo json_encode($result);exit; $this->fail();
} }
public function orderPayNowApi($transId=''){ public function orderPayNowApi($transId=''){
...@@ -2670,7 +2668,7 @@ ...@@ -2670,7 +2668,7 @@
$result = json_decode($request, true); $result = json_decode($request, true);
} }
$redir = $result['data']['authorization_url']; $redir = $result['data']['authorization_url'];
header("Location: ".$redir); redirect($redir);
} }
public function verify_payment_api($transId='',$payFor='1') { public function verify_payment_api($transId='',$payFor='1') {
...@@ -2716,6 +2714,17 @@ ...@@ -2716,6 +2714,17 @@
header("Location: ".base_url('Webservices/fail/'.$transId.'/'.$payFor)); header("Location: ".base_url('Webservices/fail/'.$transId.'/'.$payFor));
} }
} }
public function socialLogin(){
header('Content-type:application/json');
$headers = apache_request_headers();
$post = file_get_contents("php://input");
$postData = json_decode($post,true);
$result = $this->Webservice_model->socialLogin($postData);
echo json_encode($result);exit;
}
} }
......
...@@ -913,7 +913,8 @@ class Webservice_model extends CI_Model { ...@@ -913,7 +913,8 @@ class Webservice_model extends CI_Model {
} }
if(empty($transId)){ if(empty($transId)){
header("Location:".base_url('Webservices/fail/')); $respArr['status'] = 'error';
return $respArr;
} }
$respArr['status'] = 'success'; $respArr['status'] = 'success';
...@@ -1276,6 +1277,44 @@ class Webservice_model extends CI_Model { ...@@ -1276,6 +1277,44 @@ class Webservice_model extends CI_Model {
return $respArr; return $respArr;
} }
public function socialLogin($postData=array()){
$respArr = array('status'=>'error');
if(empty($postData['data'])){
$respArr['message'] = 'All Field is Required' ;
}
$result=$this->db->get_where('customers',array('email'=>$postData['data']['email'],'status'=>'1'));
if(!empty($result) && $result->num_rows() == 1 && !empty($custData = $result->row())){
$respArr['data'] = $custData;
$respArr['status'] = 1;
return $respArr;
}
if(empty($result) || $result->num_rows() < 1 || empty($custData = $result->row())){
$postData['data']['profile_image'] = '';
$postData['data']['is_otp_verified'] = 1;
if(isset($postData['data'],$postData['data']['image_url']) &&
!empty($postData['data']['image_url'])){
$imageData = file_get_contents($postData['data']['image_url']);
$userlImg = 'assets/uploads/services/userImg_'.time().'.jpg';
file_put_contents($userlImg, $imageData);
$postData['data']['profile_image'] = $userlImg;
}
unset($postData['data']['image_url']);
$this->db->insert('customers',$postData['data']);
$last_id = $this->db->insert_id();
$custData = $this->db->get_where('customers',array('customer_id'=>$last_id))->row();
$respArr['data'] = $custData;
$respArr['status'] = 1;
return $respArr;
}
}
} }
?> ?>
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