Commit 51e41fc3 by Jansa Jose

delete cart prdt in api

parent e75693f1
...@@ -1415,7 +1415,7 @@ ...@@ -1415,7 +1415,7 @@
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1); 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_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
...@@ -1480,59 +1480,64 @@ ...@@ -1480,59 +1480,64 @@
} }
} }
public function fail($ref='',$payFor='1'){ public function fail($ref='',$payFor='1',$mobile='0'){
$settings = getSettings(); if($mobile == '0'){
if($payFor == '1'){ $settings = getSettings();
$url = $settings['web_url']."/dashboard?status=failure&tab=appointment&ref=".$ref; if($payFor == '1'){
header("Location:".$url); $url = $settings['web_url']."/dashboard?status=failure&tab=appointment&ref=".$ref;
}else{ header("Location:".$url);
$url = $settings['web_url']."/purchaseHome?status=failure&ref=".$ref; }else{
header("Location:".$url); $url = $settings['web_url']."/purchaseHome?status=failure&ref=".$ref;
header("Location:".$url);
}
} else {
redirect('Webservices/mobPayFailed');
} }
} }
public function success($ref='',$payFor='1'){ public function mobPayFailed(){}
public function mobPaySuccess(){}
public function success($ref='',$payFor='1',$mobile='0'){
if($payFor == '1'){ if($payFor == '1'){
$this->serviceBookSuccess($ref); $this->db->select('customer_vehicle.car_name,bookings.scheduled_date,
}else{ bookings.scheduled_time,customers.email,bookings.cost');
$this->orderPlacedSuccess($ref); $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('customers','customers.customer_id = bookings.customer_id');
$this->db->where('transaction.id',$ref);
$bookData = $this->db->get()->row();
$subject = "DcarFixxers, Payment Successfull";
$email_id = $bookData->email;
$message = "<html>
<body>
Hi,\n\r Welcome to DcarFixxers. \r\n Your Payment for the vehicle ".$bookData->car_name." on date ".$bookData->scheduled_date." at ".$bookData->scheduled_time." for amount ".$bookData->cost." is Success
</body>
</html>";
$template = getNotifTemplate();
if(isset($template['success_booking']) && !empty($template['success_booking'])){
$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);
} else {
$url = $settings['web_url']."/track?ref=".$ref;
header("Location: ".$url);
}
} }
} }
public function serviceBookSuccess($ref=''){
$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('customers','customers.customer_id = bookings.customer_id');
$this->db->where('transaction.id',$ref);
$bookData = $this->db->get()->row();
$subject = "DcarFixxers, Payment Successfull";
$email_id = $bookData->email;
$message = "<html>
<body>
Hi,\n\r Welcome to DcarFixxers. \r\n Your Payment for the vehicle ".$bookData->car_name." on date ".$bookData->scheduled_date." at ".$bookData->scheduled_time." for amount ".$bookData->cost." is Success
</body>
</html>";
$template = getNotifTemplate();
if(isset($template['success_booking']) && !empty($template['success_booking'])){
$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);
$settings = getSettings();
$url = $settings['web_url']."/dashboard?status=success&tab=appointment&ref=".$ref;
header("Location: ".$url);
}
public function orderPlacedSuccess($ref=''){
$settings = getSettings();
$url = $settings['web_url']."/track?ref=".$ref;
header("Location: ".$url);
}
//Search Products //Search Products
public function productSearch(){ public function productSearch(){
header('Content-type:application/json'); header('Content-type:application/json');
...@@ -2611,12 +2616,12 @@ ...@@ -2611,12 +2616,12 @@
if(empty($post) || empty($postData = json_decode($post,true)) || if(empty($post) || empty($postData = json_decode($post,true)) ||
!isset($postData['Auth']) || empty($postData['Auth']) || !isset($postData['Auth']) || empty($postData['Auth']) ||
!isset($postData['data']) || empty($postData['data'])){ !isset($postData['data']) || empty($postData['data'])){
$this->fail(); $this->fail('','','1');
} }
$authRes = $this->Webservice_model->get_customer_authtoken($postData['Auth']); $authRes = $this->Webservice_model->get_customer_authtoken($postData['Auth']);
if($authRes['status'] == 'error'){ if($authRes['status'] == 'error'){
$this->fail(); $this->fail('','','1');
} }
$postData['customer_id'] = $authRes['data']['customer_id']; $postData['customer_id'] = $authRes['data']['customer_id'];
...@@ -2625,12 +2630,12 @@ ...@@ -2625,12 +2630,12 @@
if($result['status'] == 'success'){ if($result['status'] == 'success'){
$this->orderPayNowApi($result['data']); $this->orderPayNowApi($result['data']);
} }
$this->fail(); $this->fail('','','1');
} }
public function orderPayNowApi($transId=''){ public function orderPayNowApi($transId=''){
if(empty($transId)){ if(empty($transId)){
$this->fail(); $this->fail('','','1');
} }
$orderData = $this->Webservice_model->getOrderPayDetailsApi($transId); $orderData = $this->Webservice_model->getOrderPayDetailsApi($transId);
...@@ -2675,7 +2680,7 @@ ...@@ -2675,7 +2680,7 @@
public function verify_payment_api($transId='',$payFor='1') { public function verify_payment_api($transId='',$payFor='1') {
if(empty($transId)){ if(empty($transId)){
$this->fail(); $this->fail('','','1');
} }
$result = array(); $result = array();
...@@ -2693,26 +2698,25 @@ ...@@ -2693,26 +2698,25 @@
curl_close($ch); curl_close($ch);
if ($request) { if ($request) {
$result = json_decode($request, true); $result = json_decode($request, true);
$status = $this->Webservice_model->transactionRespApi($transId,$result,$payFor); $status = $this->Webservice_model->transactionRespApi($transId,$result,$payFor);
if($status){ if($status){
if($result){ if($result){
if($result['data']){ if($result['data']){
if($result['data']['status'] == 'success'){ if($result['data']['status'] == 'success'){
header("Location:".base_url('Webservices/success/'.$transId.'/'.$payFor)); header("Location:".base_url('Webservices/success/'.$transId.'/'.$payFor.'/1'));
}else{ } else {
header("Location:".base_url('Webservices/fail/'.$transId.'/'.$payFor)); 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));
} }
} } else {
header("Location: ".base_url('Webservices/fail/'.$transId.'/'.$payFor.'/1'));
}
} else {
header("Location: ".base_url('Webservices/fail/'.$transId.'/'.$payFor.'/1'));
}
}
}else{ }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 { ...@@ -183,8 +183,6 @@ class Mechanic_model extends CI_Model {
foreach($mechData AS $index => $data){ foreach($mechData AS $index => $data){
$data['distance'] = (int)$data['distance']; $data['distance'] = (int)$data['distance'];
if(empty($data['start_time']) || empty($data['end_time'])){ 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( $scheduleTiming = array(
strtotime(date('Y-m-d 09:00'))*1000, strtotime(date('Y-m-d 09:00'))*1000,
strtotime(date('Y-m-d 10:00'))*1000, strtotime(date('Y-m-d 10:00'))*1000,
...@@ -206,7 +204,6 @@ class Mechanic_model extends CI_Model { ...@@ -206,7 +204,6 @@ class Mechanic_model extends CI_Model {
$scheduleTiming = array(); $scheduleTiming = array();
for( ; $schTime <= ($endTime-3600) ; $schTime += 3600){ for( ; $schTime <= ($endTime-3600) ; $schTime += 3600){
//$scheduleTiming[] = date('h:i A',$schTime);
$scheduleTiming[] = $schTime * 1000; $scheduleTiming[] = $schTime * 1000;
} }
} }
......
...@@ -897,6 +897,7 @@ class Webservice_model extends CI_Model { ...@@ -897,6 +897,7 @@ class Webservice_model extends CI_Model {
return $respArr; return $respArr;
} }
$this->db->delete('cart',array('customer_id'=>$postData['customer_id']));
$bulk_flag = 0; $bulk_flag = 0;
$bulkUnqueId = ''; $bulkUnqueId = '';
if(($bulk_flag = count($postData['data'])) > 1){ 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