Commit d03eead6 by Tobin

Merge branch 'master' into 'dev_production'

Master See merge request !223
parents 66807cea 7cd9e2f9
......@@ -624,12 +624,14 @@ class Api extends CI_Controller {
$merchant_key = $settings['merchant_key'];
$ses_id = time().rand(100000,999999);
$reqData = '{"sessionId":"'.$ses_id.'","merchantId":"'.$merchant_id.'","custId":"'.$cust_id.'","emailId":"'.$email.'"}';
$reqData = '{"sessionId":"'.$ses_id.'","merchantId":"'.$merchant_id.'","custId":"'.$cust_id.
'","emailId":"'.$email.'"}';
$plainText = $this->encryptePayData($merchant_iv,$merchant_key,$reqData);
$plainText = $merchant_id.'|'.$plainText;
$env = (strpos($settings['payment_gateway_url'],'staging') !==false )?'staging':'payments';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'https://staging.bayanpay.sa/direcpay/secure/PaymentsMerchStoredCardDtlsAPI');
curl_setopt($ch,CURLOPT_URL,"https://$env.bayanpay.sa/direcpay/secure/PaymentsMerchStoredCardDtlsAPI");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$plainText);
......@@ -671,6 +673,9 @@ class Api extends CI_Controller {
$mKey = base64_decode($merchant_key);
$encText = base64_decode($encText);
$padtext = openssl_decrypt($encText,$key,$mKey,OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $merchant_iv);
if(empty($padtext)){
return;
}
$padData = ord($padtext{strlen($padtext) - 1});
if ($padData > strlen($padtext)) return false;
......
......@@ -22,7 +22,7 @@ class FlightServices extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Riyadh");
$this->load->model('Flight_model');
$this->load->model('FlightServices_model');
$this->load->model('Validation_flight_model');
$method = $this->router->fetch_method();
$data = (array) json_decode(file_get_contents('php://input'));
......@@ -64,7 +64,7 @@ class FlightServices extends CI_Controller {
public function flight_authenticate(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_authenticate($data);
$res = $this->FlightServices_model->flight_authenticate($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -75,7 +75,7 @@ class FlightServices extends CI_Controller {
public function flight_availability_search(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_availability_search($data);
$res = $this->FlightServices_model->flight_availability_search($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -86,7 +86,7 @@ class FlightServices extends CI_Controller {
public function flight_fare_rules(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_fare_rules($data);
$res = $this->FlightServices_model->flight_fare_rules($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -97,7 +97,7 @@ class FlightServices extends CI_Controller {
public function flight_revalidate(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_revalidate($data);
$res = $this->FlightServices_model->flight_revalidate($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -108,7 +108,7 @@ class FlightServices extends CI_Controller {
public function flight_book(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $thia->Flight_model->flight_book($data);
$res = $thia->FlightServices_model->flight_book($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -119,7 +119,7 @@ class FlightServices extends CI_Controller {
public function flight_ticket_order(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_ticket_order($data);
$res = $this->FlightServices_model->flight_ticket_order($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -130,7 +130,7 @@ class FlightServices extends CI_Controller {
public function flight_trip_details(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->flight_trip_details($data);
$res = $this->FlightServices_model->flight_trip_details($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -141,7 +141,7 @@ class FlightServices extends CI_Controller {
public function cancel_flights(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->cancel_flights($data);
$res = $this->FlightServices_model->cancel_flights($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -152,7 +152,7 @@ class FlightServices extends CI_Controller {
public function airportSearch(){
$data = $_GET;
$data['auth_token'] = $this->auth_token;
$res = $this->Flight_model->airportSearch($data);
$res = $this->FlightServices_model->airportSearch($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......
......@@ -22,7 +22,7 @@ class HotelServices extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Riyadh");
$this->load->model('Hotel_model');
$this->load->model('HotelServices_model');
$this->load->model('Validation_hotel_model');
$method = $this->router->fetch_method();
$data = (array) json_decode(file_get_contents('php://input'));
......@@ -63,8 +63,7 @@ class HotelServices extends CI_Controller {
public function get_hotel_city_list(){
$data = $_GET;
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->get_hotel_city_list($data);
$res = $this->HotelServices_model->get_hotel_city_list($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -75,7 +74,7 @@ class HotelServices extends CI_Controller {
public function hotel_search(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->hotel_search($data);
$res = $this->HotelServices_model->hotel_search($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -86,7 +85,7 @@ class HotelServices extends CI_Controller {
public function get_specific_hotel_content(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->get_specific_hotel_content($data);
$res = $this->HotelServices_model->get_specific_hotel_content($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -97,7 +96,7 @@ class HotelServices extends CI_Controller {
public function get_room_rates(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->get_room_rates($data);
$res = $this->HotelServices_model->get_room_rates($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -108,7 +107,7 @@ class HotelServices extends CI_Controller {
public function get_rate_rules(){
$data = (array) json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->get_rate_rules($data);
$res = $this->HotelServices_model->get_rate_rules($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -119,7 +118,7 @@ class HotelServices extends CI_Controller {
public function hotel_book(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->hotel_book($data);
$res = $this->HotelServices_model->hotel_book($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......@@ -130,7 +129,7 @@ class HotelServices extends CI_Controller {
public function trawex_cancel_booking(){
$data = (array)json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token;
$res = $this->Hotel_model->trawex_cancel_booking($data);
$res = $this->HotelServices_model->trawex_cancel_booking($data);
if($res['status'] == 1){
$this->response($res['data']);
}else{
......
......@@ -134,7 +134,7 @@ class Api_model extends CI_Model {
'newline' => "\r\n"
));
$ci->email->from('[email protected]', 'TimeOut');
$ci->email->from('[email protected]', 'TimeOut');
$ci->email->to($email);
$ci->email->subject($subject);
$ci->email->message($message);
......
<?php
class Flight_model extends CI_Model {
class FlightServices_model extends CI_Model {
public function _consruct(){
parent::_construct();
......
......@@ -683,7 +683,7 @@ class Webservice_model extends CI_Model {
'newline' => "\r\n"
));
$ci->email->from('[email protected]', 'TimeOut');
$ci->email->from('[email protected]', 'TimeOut');
$ci->email->to($email);
$ci->email->subject($subject);
$ci->email->message($message);
......@@ -729,7 +729,7 @@ class Webservice_model extends CI_Model {
$sql = "SELECT TC.category_id,TC.category_name,TC.category_image
FROM translator_category AS TC
INNER JOIN event_category AS ECAT ON (ECAT.cat_id=TC.category_id)
WHERE ECAT.status = 1 AND (TC.language_code='$lang' OR TC.language_code='EN')
WHERE ECAT.status = 1 AND TC.language_code='$lang'
$where
GROUP BY ECAT.cat_id ORDER BY ECAT.priority";
$result = $this->db->query($sql)->result();
......@@ -814,7 +814,7 @@ class Webservice_model extends CI_Model {
$sql = "SELECT TREG.region_name FROM region AS REG
INNER JOIN translator_region AS TREG ON (TREG.region_id = REG.id)
WHERE REG.status='1' AND REG.id='$city_id' AND
(TREG.language_code='$lang' OR TREG.language_code='EN')
TREG.language_code='$lang'
GROUP BY REG.id";
$re = $this->db->query($sql)->row();
$cityName = $re->region_name;
......@@ -826,7 +826,7 @@ class Webservice_model extends CI_Model {
FROM region AS REG
INNER JOIN translator_region AS TREG ON (TREG.region_id = REG.id)
WHERE REG.status = '1' AND
(TREG.language_code='$lang' OR TREG.language_code='EN')
TREG.language_code='$lang'
HAVING distance < ".$radius."
ORDER BY distance ASC LIMIT 1")->row_array();
if(!empty($data)){
......@@ -1428,19 +1428,28 @@ class Webservice_model extends CI_Model {
translator_event.event_name,booking.qrcode AS event_image,
venue.location,event_date_time.time,booking.event_id,
booking.no_of_ticket AS ticket_count,events.has_payment,
booking.status AS booking_status
booking.status AS booking_status,transaction.status AS transaction_status
FROM booking
INNER JOIN events ON booking.event_id = events.event_id
INNER JOIN event_date_time ON booking.event_date_id = event_date_time.id
INNER JOIN venue ON venue.id = events.venue_id
INNER JOIN translator_event ON translator_event.event_id=events.event_id
WHERE booking.customer_id = '$user_id' AND booking.status IN(0,1,2,6)
LEFT JOIN transaction ON transaction.booking_id=booking.bookId
WHERE booking.customer_id = '$user_id' AND booking.status IN (0,1,2,6)
AND (translator_event.language_code='$lang' OR
translator_event.language_code='EN')
GROUP BY booking.id
ORDER BY booking.id DESC
LIMIT $page_limit, $per_page";
$result = $this->db->query($sql)->result_array();
if(!empty($result)){
foreach ($result AS $key => $value) {
if($value['has_payment'] == '1' && $value['transaction_status'] != '1'){
unset($result[$key]);
}
}
$result = array_values($result);
}
$meta = array('total_pages'=>ceil($count/$per_page),
'total'=>$count,
'current_page'=>$page,
......@@ -1594,7 +1603,7 @@ class Webservice_model extends CI_Model {
TCAT.category_image AS category_image
FROM event_category AS ECAT
INNER JOIN translator_category AS TCAT ON (TCAT.category_id=ECAT.cat_id)
WHERE ECAT.status = 1
WHERE ECAT.status = 1 AND TCAT.language_code='$lang'
GROUP BY ECAT.cat_id
ORDER BY ECAT.priority";
$category = $this->db->query($sql)->result();
......@@ -2185,7 +2194,7 @@ class Webservice_model extends CI_Model {
$sql = "SELECT CUST.customer_id AS user_id,CUST.name,CUST.profile_image AS user_image,CUST.cust_lat AS latitude,CUST.cust_lng AS longitude, (((acos(sin((".$data['latitude']."*pi()/180)) * sin((CUST.cust_lat*pi()/180)) + cos((".$data['latitude']."*pi()/180)) * cos((CUST.cust_lat*pi()/180)) * cos(((".$data['longitude']." - CUST.cust_lng)*pi()/180))))*180/pi())*60*1.1515) as distance
FROM customer AS CUST
INNER JOIN users AS USR ON (USR.id = CUST.customer_id)
WHERE USR.user_type='3' AND USR.status='1'
WHERE USR.user_type='3' AND USR.status='1' AND CUST.enable_chat='1'
HAVING distance < 5";
$result = $this->db->query($sql);
if(!empty($result) && !empty($result = $result->result_array())){
......
......@@ -68,7 +68,11 @@
case 3: echo 'Pending'; break;
case 4: echo 'Deleted'; break;
case 5: echo 'Payment Failed'; break;
case 6: echo 'Waiting for Aproval'; break;
case 6: if($booking->has_payment == 0){ echo 'Waiting for Aproval'; break; }
else {
if ($booking->trans_status == '1') { echo 'Waiting for Aproval'; break; }
else { echo 'Pending'; break; }
}
}
?>
</th>
......@@ -78,9 +82,17 @@
<i class="fa fa-fw fa-eye"></i>View
</a> <br>
<?php
if(($this->session->userdata('user_type')==1 && $booking->provider_id==1 &&
$booking->book_status=='6') ||
($this->session->userdata('user_type')==2 && $booking->book_status=='6')){
if(
(
($this->session->userdata('user_type')==1 && $booking->provider_id==1 &&
$booking->book_status=='6') ||
($this->session->userdata('user_type')==2 && $booking->book_status=='6')
) &&
(
($booking->has_payment == 0) ||
($booking->has_payment == 1 && $booking->trans_status == '1')
)
){
$msg = "Are you sure to Aprove this booking ?";
$bookId = encode_param($booking->booking_id);
$param = "{'booking_id':'$bookId','alertMsg':'$msg'}"; ?>
......
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