Commit 5fbbba8f by Jansa Jose

J : update wallet balance functionality in booking function

parent a330b1d6
......@@ -1104,13 +1104,30 @@ class Webservice_model extends CI_Model {
if(!isset($post_data['amount']) || empty($post_data['amount'])){
$post_data['amount'] = 0;
}
if(isset($post_data['has_payment']) && $post_data['has_payment'] == 0){
$status = $post_data['status'] = '1';
}
if(isset($post_data['wallet']) && $post_data['wallet'] == 1){
$amt = (isset($post_data['discounted_price']) && !empty($post_data['discounted_price']))?$post_data['discounted_price']:$post_data['amount'];
$sql = "SELECT balance_amount FROM wallet WHERE customer_id='$user_id'";
$wallet = $this->db->query($sql)->row_array();
if(!empty($wallet) && !empty($wallet['balance_amount']) &&
$wallet['balance_amount'] >= $amt){
$balance = $wallet['balance_amount'] - $amt;
$this->db->update('wallet',array('balance_amount'=>$balance),array('customer_id'=>$user_id));
$post_data['status'] = 1;
} else {
return array('status'=>0,'code'=>'ER40',
'message'=>'Insufficient Wallet Balance');exit;
}
}
$evtData = $this->db->get_where('events',array('event_id'=>$post_data['event_id']));
$evtData = $evtData->row_array();
if(!empty($evtData) && isset($evtData['approve_booking']) && $evtData['approve_booking']=='1'){
if(!empty($evtData) && isset($evtData['approve_booking']) &&
$evtData['approve_booking']=='1'){
$post_data['status'] = '6';
}
......
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