Commit 51e41fc3 by Jansa Jose

delete cart prdt in api

parent e75693f1
......@@ -1415,7 +1415,7 @@
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($postdata)); //Post Fields
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($postdata));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
......@@ -1480,7 +1480,8 @@
}
}
public function fail($ref='',$payFor='1'){
public function fail($ref='',$payFor='1',$mobile='0'){
if($mobile == '0'){
$settings = getSettings();
if($payFor == '1'){
$url = $settings['web_url']."/dashboard?status=failure&tab=appointment&ref=".$ref;
......@@ -1489,22 +1490,22 @@
$url = $settings['web_url']."/purchaseHome?status=failure&ref=".$ref;
header("Location:".$url);
}
}
public function success($ref='',$payFor='1'){
if($payFor == '1'){
$this->serviceBookSuccess($ref);
}else{
$this->orderPlacedSuccess($ref);
} else {
redirect('Webservices/mobPayFailed');
}
}
public function serviceBookSuccess($ref=''){
$this->db->select('customer_vehicle.car_name,bookings.scheduled_date,bookings.scheduled_time
,customers.email,bookings.cost');
public function mobPayFailed(){}
public function mobPaySuccess(){}
public function success($ref='',$payFor='1',$mobile='0'){
if($payFor == '1'){
$this->db->select('customer_vehicle.car_name,bookings.scheduled_date,
bookings.scheduled_time,customers.email,bookings.cost');
$this->db->from('transaction');
$this->db->join('bookings','transaction.booking_id = bookings.booking_id');
$this->db->join('customer_vehicle','customer_vehicle.customer_veh_id = bookings.customer_veh_id');
$this->db->join('customer_vehicle',
'customer_vehicle.customer_veh_id = bookings.customer_veh_id');
$this->db->join('customers','customers.customer_id = bookings.customer_id');
$this->db->where('transaction.id',$ref);
$bookData = $this->db->get()->row();
......@@ -1521,17 +1522,21 @@
$message = str_replace(array('{:car_name}','{:book_date}','{:amount}'),array($bookData->car_name,$bookData->scheduled_date,$bookData->cost),$template['success_booking']);
}
send_mail($subject,$email_id,$message);
}
if($mobile == '1'){
redirect('Webservices/mobPaySuccess');
} else {
$settings = getSettings();
if($payFor == '1'){
$url = $settings['web_url']."/dashboard?status=success&tab=appointment&ref=".$ref;
header("Location: ".$url);
}
public function orderPlacedSuccess($ref=''){
$settings = getSettings();
} else {
$url = $settings['web_url']."/track?ref=".$ref;
header("Location: ".$url);
}
}
}
//Search Products
public function productSearch(){
......@@ -2611,12 +2616,12 @@
if(empty($post) || empty($postData = json_decode($post,true)) ||
!isset($postData['Auth']) || empty($postData['Auth']) ||
!isset($postData['data']) || empty($postData['data'])){
$this->fail();
$this->fail('','','1');
}
$authRes = $this->Webservice_model->get_customer_authtoken($postData['Auth']);
if($authRes['status'] == 'error'){
$this->fail();
$this->fail('','','1');
}
$postData['customer_id'] = $authRes['data']['customer_id'];
......@@ -2625,12 +2630,12 @@
if($result['status'] == 'success'){
$this->orderPayNowApi($result['data']);
}
$this->fail();
$this->fail('','','1');
}
public function orderPayNowApi($transId=''){
if(empty($transId)){
$this->fail();
$this->fail('','','1');
}
$orderData = $this->Webservice_model->getOrderPayDetailsApi($transId);
......@@ -2675,7 +2680,7 @@
public function verify_payment_api($transId='',$payFor='1') {
if(empty($transId)){
$this->fail();
$this->fail('','','1');
}
$result = array();
......@@ -2699,20 +2704,19 @@
if($result){
if($result['data']){
if($result['data']['status'] == 'success'){
header("Location:".base_url('Webservices/success/'.$transId.'/'.$payFor));
}else{
header("Location:".base_url('Webservices/fail/'.$transId.'/'.$payFor));
}
header("Location:".base_url('Webservices/success/'.$transId.'/'.$payFor.'/1'));
} else {
header("Location:".base_url('Webservices/fail/'.$transId.'/'.$payFor.'/1'));
}
else{
header("Location: ".base_url('Webservices/fail/'.$transId.'/'.$payFor));
} else {
header("Location: ".base_url('Webservices/fail/'.$transId.'/'.$payFor.'/1'));
}
}else{
header("Location: ".base_url('Webservices/fail/'.$transId.'/'.$payFor));
} else {
header("Location: ".base_url('Webservices/fail/'.$transId.'/'.$payFor.'/1'));
}
}
}else{
header("Location: ".base_url('Webservices/fail/'.$transId.'/'.$payFor));
header("Location: ".base_url('Webservices/fail/'.$transId.'/'.$payFor.'/1'));
}
}
......
......@@ -183,8 +183,6 @@ class Mechanic_model extends CI_Model {
foreach($mechData AS $index => $data){
$data['distance'] = (int)$data['distance'];
if(empty($data['start_time']) || empty($data['end_time'])){
//$scheduleTiming = array('09:00 AM','10:00 AM','11:00 AM','12:00 PM','01:00 PM',
// '02:00 PM','03:00 PM','04:00 PM','05:00 PM','06:00 PM');
$scheduleTiming = array(
strtotime(date('Y-m-d 09:00'))*1000,
strtotime(date('Y-m-d 10:00'))*1000,
......@@ -206,7 +204,6 @@ class Mechanic_model extends CI_Model {
$scheduleTiming = array();
for( ; $schTime <= ($endTime-3600) ; $schTime += 3600){
//$scheduleTiming[] = date('h:i A',$schTime);
$scheduleTiming[] = $schTime * 1000;
}
}
......
......@@ -897,6 +897,7 @@ class Webservice_model extends CI_Model {
return $respArr;
}
$this->db->delete('cart',array('customer_id'=>$postData['customer_id']));
$bulk_flag = 0;
$bulkUnqueId = '';
if(($bulk_flag = count($postData['data'])) > 1){
......
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