Commit 467bc43d by Tobin

dc

parent 192f4333
......@@ -298,6 +298,28 @@ class Api extends CI_Controller {
}
}
public function get_cms_data() {
$res = $this->Api_model->get_cms_data();
if($res['status']!=0){
$this->response($res['data']);
}
else{
$this->errorResponse($res['code'],$res['message']);
}
}
public function cancel_booking() {
$data = (array) json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Api_model->cancel_booking($data);
if($res['status']!=0){
$this->response($res['data']);
}
else{
$this->errorResponse($res['code'],$res['message']);
}
}
public function payNow($auth_token='',$amount=0,$booking_id='',$event_id=''){
if(empty($auth_token) || empty($amount) || empty($booking_id)){
redirect('https://projects.nuvento.com/failure');
......
......@@ -902,5 +902,47 @@ class Api_model extends CI_Model {
return $res;
}
function get_cms_data(){
$language = array();
try{
$cms = $this->db->get('privacy_policy')->row_array();
if($cms){
$language['ar'] = array(
'faq'=>$cms['faq_ar'],
'privacy_policy'=>$cms['privacy_policy_ar'],
'terms_and_conditions'=>$cms['terms_and_conditions_ar']);
$language['en'] = array(
'faq'=>$cms['faq_en'],
'privacy_policy'=>$cms['privacy_policy_en'],
'terms_and_conditions'=>$cms['terms_and_conditions_en']);
$res = array('status'=>1,'data'=>$language);
}
}catch(Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
}
return $res;
}
public function cancel_booking($data){
try{
$user_id = $this->auth_token_get($data['auth_token']);
if($user_id > 0) {
$booked_data = $this->db->get_where('booking',array('id'=>$data['booking_id']))->row();
if($booked_data){
if($this->db->update('booking',array('status'=>'0'),array('id'=>$data['booking_id']))){
$res = array('status'=>1);
}else{
$res = array('status'=>0,'message'=>'Booking Id doesnot Exist','code'=>'ER13');
}
}
}else {
$res = array('status'=>0,'message'=>'Invalid user','code'=>'ER19');
}
}catch(Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
}
return $res;
}
}
?>
\ No newline at end of file
......@@ -67,6 +67,21 @@ class Validation_model extends CI_Model {
'paymentResponse' => array() ,
'paymentFailureUrl' => array() ,
'paymentSuccessUrl' => array() ,
'get_cms_data' => array() ,
'cancel_booking' => array(
'booking_id' => array(
'required' => array(
'code' => 'ER16',
'message' => 'Booking id is null or empty'
)
) ,
'auth_token' => array(
'required' => array(
'code' => 'ER17',
'message' => 'User Id is null or empty'
)
)
) ,
'favourite' => array(
'event_id' => array(
'required' => array(
......
......@@ -45,7 +45,7 @@
<th>Venue</th>
<!-- <th>Location</th> -->
<th>Status</th>
<th width="300px">Action</th>
<th width="330px">Action</th>
</tr>
</thead>
<tbody>
......
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