Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TimeOutAdmin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TimeOut
TimeOutAdmin
Commits
3a7c1b26
Commit
3a7c1b26
authored
Nov 26, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
J : flight and hotel apis in seperate page
parent
e6cb1bd6
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1678 additions
and
678 deletions
+1678
-678
Webservice.php
application/controllers/Webservice.php
+0
-181
WebserviceFlight.php
application/controllers/WebserviceFlight.php
+163
-0
WebserviceHotel.php
application/controllers/WebserviceHotel.php
+141
-0
Validation_app_model.php
application/models/Validation_app_model.php
+0
-24
Validation_flight_model.php
application/models/Validation_flight_model.php
+473
-0
Validation_hotel_model.php
application/models/Validation_hotel_model.php
+378
-0
Webservice_flight_model.php
application/models/Webservice_flight_model.php
+243
-0
Webservice_hotel_model.php
application/models/Webservice_hotel_model.php
+280
-0
Webservice_model.php
application/models/Webservice_model.php
+0
-473
No files found.
application/controllers/Webservice.php
View file @
3a7c1b26
...
@@ -614,186 +614,5 @@ class Webservice extends CI_Controller {
...
@@ -614,186 +614,5 @@ class Webservice extends CI_Controller {
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
}
}
/*********************************** START Hotel API ****************************************/
public
function
get_hotel_city_list
(){
$data
=
$_GET
;
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
get_hotel_city_list
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
hotel_search
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
hotel_search
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
get_specific_hotel_content
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
get_specific_hotel_content
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
get_room_rates
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
get_room_rates
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
get_rate_rules
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
get_rate_rules
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
hotel_book
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
hotel_book
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
trawex_cancel_booking
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
trawex_cancel_booking
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
/*********************************** END Hotel API ****************************************/
/********************************** START Flight API ***************************************/
public
function
flight_authenticate
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
flight_authenticate
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_availability_search
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
flight_availability_search
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_fare_rules
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
flight_fare_rules
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_revalidate
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
flight_revalidate
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_book
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$thia
->
Webservice_model
->
flight_book
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_ticket_order
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
flight_ticket_order
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_trip_details
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
flight_trip_details
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
cancel_flights
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
cancel_flights
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
airportSearch
(){
$data
=
$_GET
;
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
airportSearch
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
/******************************* END Flight API******************************************/
}
}
?>
?>
application/controllers/WebserviceFlight.php
0 → 100644
View file @
3a7c1b26
<?php
defined
(
'BASEPATH'
)
OR
exit
(
'No direct script access allowed'
);
if
(
isset
(
$_SERVER
[
'HTTP_ORIGIN'
]))
{
header
(
"Access-Control-Allow-Origin:
{
$_SERVER
[
'HTTP_ORIGIN'
]
}
"
);
header
(
'Access-Control-Allow-Credentials: true'
);
header
(
'Access-Control-Max-Age: 86400'
);
}
if
(
$_SERVER
[
'REQUEST_METHOD'
]
==
'OPTIONS'
)
{
if
(
isset
(
$_SERVER
[
'HTTP_ACCESS_CONTROL_REQUEST_METHOD'
]))
header
(
"Access-Control-Allow-Methods: GET, POST, OPTIONS"
);
if
(
isset
(
$_SERVER
[
'HTTP_ACCESS_CONTROL_REQUEST_HEADERS'
]))
header
(
"Access-Control-Allow-Headers:
{
$_SERVER
[
'HTTP_ACCESS_CONTROL_REQUEST_HEADERS'
]
}
"
);
exit
(
0
);
}
//test changes
class
WebserviceFlight
extends
CI_Controller
{
var
$auth_token
;
public
function
__construct
()
{
parent
::
__construct
();
date_default_timezone_set
(
"Asia/Riyadh"
);
$this
->
load
->
model
(
'Webservice_flight_model'
);
$this
->
load
->
model
(
'Validation_flight_model'
);
$method
=
$this
->
router
->
fetch_method
();
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
if
(
isset
(
apache_request_headers
()[
'Auth'
])
||
isset
(
apache_request_headers
()[
'auth'
]))
{
$this
->
auth_token
=
(
isset
(
apache_request_headers
()[
'Auth'
]))
?
apache_request_headers
()[
'Auth'
]
:
apache_request_headers
()[
'auth'
];
$data
[
'auth_token'
]
=
$this
->
auth_token
;
}
$res
=
$this
->
Validation_flight_model
->
validation_check
(
$method
,
$data
);
if
(
$res
[
'state'
]
==
1
)
{
$this
->
errorResponse
(
$res
[
'response'
][
'code'
],
$res
[
'response'
][
'message'
]);
die
;
}
}
public
function
response
(
$data
)
{
$result
=
array
(
'status'
=>
'success'
,
'data'
=>
$data
);
print
json_encode
(
$result
);
}
public
function
successResponse
(
$data
=
''
)
{
$result
=
array
(
'status'
=>
'success'
,
);
print
json_encode
(
$result
);
}
public
function
errorResponse
(
$errorCode
,
$errorDesc
)
{
$result
=
array
(
'status'
=>
'error'
,
'error'
=>
$errorCode
,
'message'
=>
$errorDesc
);
print
json_encode
(
$result
);
}
public
function
flight_authenticate
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_flight_model
->
flight_authenticate
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_availability_search
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_flight_model
->
flight_availability_search
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_fare_rules
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_flight_model
->
flight_fare_rules
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_revalidate
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_flight_model
->
flight_revalidate
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_book
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$thia
->
Webservice_flight_model
->
flight_book
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_ticket_order
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_flight_model
->
flight_ticket_order
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
flight_trip_details
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_flight_model
->
flight_trip_details
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
cancel_flights
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_flight_model
->
cancel_flights
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
airportSearch
(){
$data
=
$_GET
;
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_flight_model
->
airportSearch
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
}
?>
application/controllers/WebserviceHotel.php
0 → 100644
View file @
3a7c1b26
<?php
defined
(
'BASEPATH'
)
OR
exit
(
'No direct script access allowed'
);
if
(
isset
(
$_SERVER
[
'HTTP_ORIGIN'
]))
{
header
(
"Access-Control-Allow-Origin:
{
$_SERVER
[
'HTTP_ORIGIN'
]
}
"
);
header
(
'Access-Control-Allow-Credentials: true'
);
header
(
'Access-Control-Max-Age: 86400'
);
}
if
(
$_SERVER
[
'REQUEST_METHOD'
]
==
'OPTIONS'
)
{
if
(
isset
(
$_SERVER
[
'HTTP_ACCESS_CONTROL_REQUEST_METHOD'
]))
header
(
"Access-Control-Allow-Methods: GET, POST, OPTIONS"
);
if
(
isset
(
$_SERVER
[
'HTTP_ACCESS_CONTROL_REQUEST_HEADERS'
]))
header
(
"Access-Control-Allow-Headers:
{
$_SERVER
[
'HTTP_ACCESS_CONTROL_REQUEST_HEADERS'
]
}
"
);
exit
(
0
);
}
//test changes
class
WebserviceHotel
extends
CI_Controller
{
var
$auth_token
;
public
function
__construct
()
{
parent
::
__construct
();
date_default_timezone_set
(
"Asia/Riyadh"
);
$this
->
load
->
model
(
'Webservice_hotel_model'
);
$this
->
load
->
model
(
'Validation_hotel_model'
);
$method
=
$this
->
router
->
fetch_method
();
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
if
(
isset
(
apache_request_headers
()[
'Auth'
])
||
isset
(
apache_request_headers
()[
'auth'
]))
{
$this
->
auth_token
=
(
isset
(
apache_request_headers
()[
'Auth'
]))
?
apache_request_headers
()[
'Auth'
]
:
apache_request_headers
()[
'auth'
];
$data
[
'auth_token'
]
=
$this
->
auth_token
;
}
$res
=
$this
->
Validation_hotel_model
->
validation_check
(
$method
,
$data
);
if
(
$res
[
'state'
]
==
1
)
{
$this
->
errorResponse
(
$res
[
'response'
][
'code'
],
$res
[
'response'
][
'message'
]);
die
;
}
}
public
function
response
(
$data
)
{
$result
=
array
(
'status'
=>
'success'
,
'data'
=>
$data
);
print
json_encode
(
$result
);
}
public
function
successResponse
(
$data
=
''
)
{
$result
=
array
(
'status'
=>
'success'
,
);
print
json_encode
(
$result
);
}
public
function
errorResponse
(
$errorCode
,
$errorDesc
)
{
$result
=
array
(
'status'
=>
'error'
,
'error'
=>
$errorCode
,
'message'
=>
$errorDesc
);
print
json_encode
(
$result
);
}
public
function
get_hotel_city_list
(){
$data
=
$_GET
;
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_hotel_model
->
get_hotel_city_list
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
hotel_search
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_hotel_model
->
hotel_search
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
get_specific_hotel_content
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_hotel_model
->
get_specific_hotel_content
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
get_room_rates
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_hotel_model
->
get_room_rates
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
get_rate_rules
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_hotel_model
->
get_rate_rules
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
hotel_book
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_hotel_model
->
hotel_book
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
trawex_cancel_booking
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_hotel_model
->
trawex_cancel_booking
(
$data
);
if
(
$res
[
'status'
]
==
1
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
}
?>
application/models/Validation_app_model.php
View file @
3a7c1b26
...
@@ -1078,12 +1078,6 @@ class Validation_app_model extends CI_Model {
...
@@ -1078,12 +1078,6 @@ class Validation_app_model extends CI_Model {
'message'
=>
'Frequent Flyr Number Field is null or empty'
'message'
=>
'Frequent Flyr Number Field is null or empty'
)
)
),
),
'adultmealplan'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Adult Meal Plan Field is null or empty'
)
),
'child_dob'
=>
array
(
'child_dob'
=>
array
(
'required'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'code'
=>
'ER02'
,
...
@@ -1132,12 +1126,6 @@ class Validation_app_model extends CI_Model {
...
@@ -1132,12 +1126,6 @@ class Validation_app_model extends CI_Model {
'message'
=>
'Child Frequent Flyr Number is null or empty'
'message'
=>
'Child Frequent Flyr Number is null or empty'
)
)
),
),
'childMealplan'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Child Meal Plan is null or empty'
)
),
'infant_dob'
=>
array
(
'infant_dob'
=>
array
(
'required'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'code'
=>
'ER02'
,
...
@@ -1168,24 +1156,12 @@ class Validation_app_model extends CI_Model {
...
@@ -1168,24 +1156,12 @@ class Validation_app_model extends CI_Model {
'message'
=>
'Infant Title is null or empty'
'message'
=>
'Infant Title is null or empty'
)
)
),
),
'infantMealplan'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Infant Meal Plan is null or empty'
)
),
'FareSourceCode'
=>
array
(
'FareSourceCode'
=>
array
(
'required'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'code'
=>
'ER02'
,
'message'
=>
'Fare Source Code is null or empty'
'message'
=>
'Fare Source Code is null or empty'
)
)
),
),
'PostCode'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'PostCode is null or empty'
)
),
),
),
'flight_ticket_order'
=>
array
(
'flight_ticket_order'
=>
array
(
'auth_token'
=>
array
(
'auth_token'
=>
array
(
...
...
application/models/Validation_flight_model.php
0 → 100644
View file @
3a7c1b26
<?php
class
Validation_flight_model
extends
CI_Model
{
public
$validation_array
=
array
(
'flight_authenticate'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
)
),
'flight_availability_search'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
),
'journey_type'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Journey Type is null or empty'
)
),
'airport_from_code'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Airport From Code is null or empty'
)
),
'airport_to_code'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'airport To Code is null or empty'
)
),
'departure_date'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Departure Date is null or empty'
)
),
'return_date'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Return Date is null or empty'
)
),
'adult_flight'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Adult Flight is null or empty'
)
),
'child_flight'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Child Flight is null or empty'
)
),
'infant_flight'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Infant Flight is null or empty'
)
),
'class'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Class Field is null or empty'
)
),
'target'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Target Field is null or empty'
)
),
'session_id'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Session Id is null or empty'
)
),
),
'flight_fare_rules'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
),
'fare_source_code'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Fare Source Code is null or empty'
)
),
'session_id'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Session Id is null or empty'
)
),
),
'flight_revalidate'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
),
'fare_source_code'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Fare Source Code is null or empty'
)
),
'session_id'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Session Id is null or empty'
)
),
),
'flight_book'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
),
'target'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Target Field is null or empty'
)
),
'session_id'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Session Id is null or empty'
)
),
'area_code'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Area Code is null or empty'
)
),
'country_code'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Country Code is null or empty'
)
),
'first_name'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'First Name is null or empty'
)
),
'last_name'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Last Name is null or empty'
)
),
'title'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Title Field is null or empty'
)
),
'email_id'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Email ID is null or empty'
)
),
'mobile_no'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Mobile Number is null or empty'
)
),
'dob'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'DOB is null or empty'
)
),
'gender'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Gender is null or empty'
)
),
'issue_country'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Issue Country is null or empty'
)
),
'passport_expiry'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Passport Expiry Field is null or empty'
)
),
'passport_no'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Passport Number is null or empty'
)
),
'type'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Type Field is null or empty'
)
),
'IsPassportMandatory'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Is Passport Mandatory Field is null or empty'
)
),
'adult_flight'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Adult flight is null or empty'
)
),
'child_flight'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Child Flight is null or empty'
)
),
'infant_flight'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Infant Flight is null or empty'
)
),
'frequentFlyrNum'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Frequent Flyr Number Field is null or empty'
)
),
'child_dob'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Child Dob is null or empty'
)
),
'child_gender'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Child Gender is null or empty'
)
),
'child_title'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Child Title is null or empty'
)
),
'child_first_name'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Child First Name is null or empty'
)
),
'child_last_name'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Child Last Name is null or empty'
)
),
'child_passport_expiry_date'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Child Passport Expiry Date is null or empty'
)
),
'child_passport_no'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Child Passport Number is null or empty'
)
),
'child_frequentFlyrNum'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Child Frequent Flyr Number is null or empty'
)
),
'infant_dob'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Infant Dob is null or empty'
)
),
'infant_gender'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Infant Gender is null or empty'
)
),
'infant_first_name'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Infant First Name is null or empty'
)
),
'infant_last_name'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Infant Last Name is null or empty'
)
),
'infant_title'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Infant Title is null or empty'
)
),
'FareSourceCode'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Fare Source Code is null or empty'
)
),
),
'flight_ticket_order'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
),
'target'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Target Field is null or empty'
)
),
'session_id'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Session Id is null or empty'
)
),
'UniqueID'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Unique Id is null or empty'
)
),
),
'flight_trip_details'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
),
'target'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Target Field is null or empty'
)
),
'session_id'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Session Id is null or empty'
)
),
'UniqueID'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Unique Id is null or empty'
)
),
),
'cancel_flights'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
),
'target'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Target Field is null or empty'
)
),
'session_id'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Session Field is null or empty'
)
),
'UniqueID'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Unique ID is null or empty'
)
),
),
'airportSearch'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
)
)
);
public
function
validation_check
(
$method_name
,
$parms
)
{
$state
=
0
;
$rules
=
$this
->
validation_array
[
$method_name
];
$error_key
=
''
;
foreach
(
$rules
as
$key
=>
$value
)
{
foreach
(
$value
as
$keys
=>
$values
)
{
switch
(
$keys
)
{
case
'required'
:
if
(
!
isset
(
$parms
[
$key
])
||
$parms
[
$key
]
==
''
||
$parms
[
$key
]
==
null
){
$state
=
1
;
$error_key
=
$values
;
}
break
;
case
'email'
:
if
(
isset
(
$parms
[
$key
])
&&
!
filter_var
(
$parms
[
$key
],
FILTER_VALIDATE_EMAIL
))
{
$state
=
1
;
$error_key
=
$values
;
}
break
;
case
'phone'
:
if
(
isset
(
$parms
[
$key
])){
$phone
=
preg_replace
(
'/[^0-9]/'
,
''
,
$parms
[
$key
]);
/*if (strlen($phone) !== 10) {
$state = 1;
$error_key = $values;
} */
}
break
;
default
:
# code...
break
;
}
if
(
$state
==
1
){
break
;
}
}
if
(
$state
==
1
){
break
;
}
}
return
array
(
'state'
=>
$state
,
'response'
=>
$error_key
);
}
}
?>
application/models/Validation_hotel_model.php
0 → 100644
View file @
3a7c1b26
<?php
class
Validation_hotel_model
extends
CI_Model
{
public
$validation_array
=
array
(
'get_hotel_city_list'
=>
array
(),
'hotel_search'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User id is null or empty'
)
)
),
'get_specific_hotel_content'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User id is null or empty'
)
),
'hotelId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Hotel Id is null or empty'
)
),
'productId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Product Id is null or empty'
)
),
'sessionId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Session Id is null or empty'
)
),
'trackingId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Tracking Id is null or empty'
)
)
),
'get_room_rates'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User id is null or empty'
)
),
'TraceId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Trace Id is null or empty'
)
),
'propertyid'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Property Id is null or empty'
)
),
'trackingId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Tracking Id is null or empty'
)
),
'sessionId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Session Id is null or empty'
)
),
'productId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Product Id is null or empty'
)
),
'TokenId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Token Id is null or empty'
)
),
'resultindex'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Result Index Field is null or empty'
)
),
'hotelcode'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Hotel Code is null or empty'
)
),
),
'get_rate_rules'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
),
'TokenId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Token Id is null or empty'
)
),
'TraceId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Trace Id is null or empty'
)
),
'allocationDetails'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Allocation Details is null or empty'
)
),
'booking_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Booking Token is null or empty'
)
),
'hotel_name'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Hotel Name is null or empty'
)
),
'hotelcode'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Hotel Code is null or empty'
)
),
'infosource'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Infosource Field is null or empty'
)
),
'meal_code'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Meal Code Field is null or empty'
)
),
'productId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Product Id is null or empty'
)
),
'propertyid'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Property Id is null or empty'
)
),
'rate_basis_id'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Rate Basis Id is null or empty'
)
),
'resultindex'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Result Index field is null or empty'
)
),
'room_code'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Room Code is null or empty'
)
),
'roomType_runno'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Room Type Runno Field is null or empty'
)
),
'sessionId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Session Id is null or empty'
)
),
'trackingId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Tracking Id is null or empty'
)
),
'boardCode'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Board Code Field is null or empty'
)
),
),
'hotel_book'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
),
'TokenId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Token Id is null or empty'
)
),
'TraceId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Trace Id is null or empty'
)
),
'changedOccupancy'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Changed Occupancy Field is null or empty'
)
),
'extrabeds'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Extrabeds Field is null or empty'
)
),
'guests_details'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Guest Details field is null or empty'
)
),
'hotelcode'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Hotel Code is null or empty'
)
),
'refcode'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Refcode Field is null or empty'
)
),
'prebookingtoken'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Pre Booking Token is null or empty'
)
),
'productId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Product Id is null or empty'
)
),
'propertyid'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Property Id is null or empty'
)
),
'resultindex'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Result Index field is null or empty'
)
),
'sessionId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Session Id is null or empty'
)
),
'trackingId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Tracking Id is null or empty'
)
),
),
'trawex_cancel_booking'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
),
'trackingId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Tracking Id is null or empty'
)
),
'productId'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Product Id is null or empty'
)
),
'supplierConfirmationNum'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Supplier Confirmation Number is null or empty'
)
),
'reference'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Reference Id is null or empty'
)
),
),
);
public
function
validation_check
(
$method_name
,
$parms
)
{
$state
=
0
;
$rules
=
$this
->
validation_array
[
$method_name
];
$error_key
=
''
;
foreach
(
$rules
as
$key
=>
$value
)
{
foreach
(
$value
as
$keys
=>
$values
)
{
switch
(
$keys
)
{
case
'required'
:
if
(
!
isset
(
$parms
[
$key
])
||
$parms
[
$key
]
==
''
||
$parms
[
$key
]
==
null
){
$state
=
1
;
$error_key
=
$values
;
}
break
;
case
'email'
:
if
(
isset
(
$parms
[
$key
])
&&
!
filter_var
(
$parms
[
$key
],
FILTER_VALIDATE_EMAIL
))
{
$state
=
1
;
$error_key
=
$values
;
}
break
;
case
'phone'
:
if
(
isset
(
$parms
[
$key
])){
$phone
=
preg_replace
(
'/[^0-9]/'
,
''
,
$parms
[
$key
]);
/*if (strlen($phone) !== 10) {
$state = 1;
$error_key = $values;
} */
}
break
;
default
:
# code...
break
;
}
if
(
$state
==
1
){
break
;
}
}
if
(
$state
==
1
){
break
;
}
}
return
array
(
'state'
=>
$state
,
'response'
=>
$error_key
);
}
}
?>
application/models/Webservice_flight_model.php
0 → 100644
View file @
3a7c1b26
<?php
class
Webservice_flight_model
extends
CI_Model
{
public
function
_consruct
(){
parent
::
_construct
();
}
public
function
auth_token_get
(
$token
)
{
$rs
=
$this
->
db
->
select
(
'user_id'
)
->
where
(
'auth_token'
,
$token
)
->
get
(
'customer_auth'
)
->
row
();
if
(
count
(
$rs
)
>
0
)
{
return
$rs
->
user_id
;
}
else
{
return
0
;
}
}
public
function
flight_authenticate
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/authenticate?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
flight_availability_search
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/flight_availability_search?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
"&journey_type="
.
$data
[
'journey_type'
]
.
"&airport_from_code="
.
$data
[
'airport_from_code'
]
.
"&airport_to_code="
.
$data
[
'airport_to_code'
]
.
"&departure_date="
.
$data
[
'departure_date'
]
.
"&return_date="
.
$data
[
'return_date'
]
.
"&adult_flight="
.
$data
[
'adult_flight'
]
.
"&child_flight="
.
$data
[
'child_flight'
]
.
"&infant_flight="
.
$data
[
'infant_flight'
]
.
"&class="
.
$data
[
'class'
]
.
"&target="
.
$data
[
'target'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
flight_fare_rules
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/fare_rules?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&fare_source_code="
.
$data
[
'fare_source_code'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
flight_revalidate
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/revalidate?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&fare_source_code="
.
$data
[
'fare_source_code'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
flight_book
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$data
[
'first_name'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'first_name'
]);
$data
[
'last_name'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'last_name'
]);
$data
[
'title'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'title'
]);
$data
[
'dob'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'dob'
]);
$data
[
'gender'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'gender'
]);
$data
[
'issue_country'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'issue_country'
]);
$data
[
'passport_expiry'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'passport_expiry'
]);
$data
[
'passport_no'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'passport_no'
]);
$url
=
"https://trawex.biz/api/flight_trawex/book?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&target="
.
$data
[
'target'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
"&area_code="
.
$data
[
'area_code'
]
.
"&country_code="
.
$data
[
'country_code'
]
.
"&first_name="
.
$data
[
'first_name'
]
.
"&last_name="
.
$data
[
'last_name'
]
.
"&title="
.
$data
[
'title'
]
.
"&email_id="
.
$data
[
'email_id'
]
.
"&mobile_no="
.
$data
[
'mobile_no'
]
.
"&dob="
.
$data
[
'dob'
]
.
"&gender="
.
$data
[
'gender'
]
.
"&issue_country="
.
$data
[
'issue_country'
]
.
"&passport_expiry="
.
$data
[
'passport_expiry'
]
.
"&passport_no="
.
$data
[
'passport_no'
]
.
"&type="
.
$data
[
'type'
]
.
"&IsPassportMandatory="
.
$data
[
'IsPassportMandatory'
]
.
"&adult_flight="
.
$data
[
'adult_flight'
]
.
"&child_flight="
.
$data
[
'child_flight'
]
.
"&infant_flight="
.
$data
[
'infant_flight'
]
.
"&frequentFlyrNum="
.
$data
[
'frequentFlyrNum'
]
.
"&adultmealplan="
.
$data
[
'adultmealplan'
]
.
"&child_dob="
.
$data
[
'child_dob'
]
.
"&child_gender="
.
$data
[
'child_gender'
]
.
"&child_title="
.
$data
[
'child_title'
]
.
"&child_first_name="
.
$data
[
'child_first_name'
]
.
"&child_last_name="
.
$data
[
'child_last_name'
]
.
"&child_passport_expiry_date="
.
$data
[
'child_passport_expiry_date'
]
.
"&child_passport_no="
.
$data
[
'child_passport_no'
]
.
"&child_frequentFlyrNum="
.
$data
[
'child_frequentFlyrNum'
]
.
"&childMealplan="
.
$data
[
'childMealplan'
]
.
"&infant_dob="
.
$data
[
'infant_dob'
]
.
"&infant_gender="
.
$data
[
'infant_gender'
]
.
"&infant_first_name="
.
$data
[
'infant_first_name'
]
.
"&infant_last_name="
.
$data
[
'infant_last_name'
]
.
"&infant_title="
.
$data
[
'infant_title'
]
.
"&infantMealplan="
.
$data
[
'infantMealplan'
]
.
"&FareSourceCode="
.
$data
[
'FareSourceCode'
]
.
"&PostCode="
.
$data
[
'PostCode'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'result'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
flight_ticket_order
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/ticket_order?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&UniqueID="
.
$data
[
'UniqueID'
]
.
"&target="
.
$data
[
'target'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'result'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
flight_trip_details
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/trip_details?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&UniqueID="
.
$data
[
'UniqueID'
]
.
"&target="
.
$data
[
'target'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'result'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
cancel_flights
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/cancel_flights?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&UniqueID="
.
$data
[
'UniqueID'
]
.
"&target="
.
$data
[
'target'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
""
;
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
airportSearch
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$cond
=
''
;
if
(
isset
(
$data
[
'query'
])
&&
!
empty
(
$data
[
'query'
])){
$cond
=
"WHERE airport_code LIKE '%"
.
$data
[
'query'
]
.
"%' OR airport_name LIKE '%"
.
$data
[
'query'
]
.
"%'"
;
}
$sql
=
"SELECT id FROM airport_details
$cond
"
;
$count
=
$this
->
db
->
query
(
$sql
)
->
num_rows
();
if
(
$count
>
0
){
$perPage
=
10
;
$page
=
(
isset
(
$data
[
'page'
]))
?
$data
[
'page'
]
:
1
;
$limit
=
(
$page
-
1
)
*
$perPage
;
$meta
=
array
(
'total_pages'
=>
ceil
(
$count
/
$perPage
),
'total'
=>
$count
,
'current_page'
=>
$page
,
'per_page'
=>
$perPage
);
$sql
=
"SELECT * FROM airport_details
$cond
LIMIT
$limit
,
$perPage
"
;
$airPortList
=
$this
->
db
->
query
(
$sql
);
if
(
!
isset
(
$airPortList
)
||
empty
(
$airPortList
=
$airPortList
->
result_array
())){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER04'
);
return
$res
;
}
$res
=
array
(
'status'
=>
1
,
'data'
=>
array
(
'airportlist'
=>
$airPortList
,
'meta'
=>
$meta
));
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
passToJsonCurl
(
$url
=
''
,
$postData
=
array
()){
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
json_encode
(
$postData
));
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYHOST
,
false
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
false
);
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
array
(
'Content-Type:application/json'
));
$result
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
return
$result
;
}
}
?>
application/models/Webservice_hotel_model.php
0 → 100644
View file @
3a7c1b26
<?php
class
Webservice_hotel_model
extends
CI_Model
{
public
function
_consruct
(){
parent
::
_construct
();
}
public
function
auth_token_get
(
$token
)
{
$rs
=
$this
->
db
->
select
(
'user_id'
)
->
where
(
'auth_token'
,
$token
)
->
get
(
'customer_auth'
)
->
row
();
if
(
count
(
$rs
)
>
0
)
{
return
$rs
->
user_id
;
}
else
{
return
0
;
}
}
public
function
get_hotel_city_list
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$cond
=
''
;
if
(
isset
(
$data
[
'query'
])
&&
!
empty
(
$data
[
'query'
])){
$cond
=
"AND THC.hotel_city_name LIKE '%"
.
$data
[
'query'
]
.
"%'"
;
}
$sql
=
"SELECT HC.hotel_city_id FROM hotel_cities AS HC
INNER JOIN translator_hotel_city AS THC ON(THC.hotel_city_id=HC.hotel_city_id)
WHERE HC.status=1
$cond
GROUP BY HC.hotel_city_id"
;
$count
=
$this
->
db
->
query
(
$sql
)
->
num_rows
();
if
(
$count
>=
1
){
$perPage
=
10
;
$page
=
(
isset
(
$data
[
'page'
]))
?
$data
[
'page'
]
:
1
;
$limit
=
(
$page
-
1
)
*
$perPage
;
$meta
=
array
(
'total_pages'
=>
ceil
(
$count
/
$perPage
),
'total'
=>
$count
,
'current_page'
=>
$page
,
'per_page'
=>
$perPage
);
$sql
=
"SELECT THC.hotel_city_id AS id,HC.hotel_city_icon AS image
FROM translator_hotel_city AS THC
INNER JOIN hotel_cities AS HC ON (HC.hotel_city_id=THC.hotel_city_id)
WHERE THC.status=1
$cond
GROUP BY HC.hotel_city_id LIMIT
$limit
,
$perPage
"
;
$hotelData
=
$this
->
db
->
query
(
$sql
)
->
result_array
();
$countryData
=
$this
->
getCountryData
(
$user_id
);
$lang
=
$countryData
[
'language_code'
];
foreach
(
$hotelData
as
$key
=>
$value
)
{
if
(
!
empty
(
$lanTrans
=
langTranslator
(
$value
[
'id'
],
'HCTY'
,
$lang
))){
$hotelData
[
$key
][
'name'
]
=
$lanTrans
[
'hotel_city_name'
];
}
}
if
(
count
(
$hotelData
)
<
0
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER10'
);
}
$res
=
array
(
'status'
=>
1
,
'data'
=>
array
(
'city_list'
=>
$hotelData
,
'meta'
=>
$meta
));
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER10'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Failed'
,
'code'
=>
'ER15'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
hotel_search
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$trackingId
=
time
()
.
rand
(
100000
,
999999
);
$settings
=
getSettings
();
if
(
!
isset
(
$data
[
'nextToken'
])
&&
empty
(
$data
[
'nextToken'
])){
$this
->
db
->
select
(
'nationality'
);
$userData
=
$this
->
db
->
get_where
(
'customer'
,
array
(
'customer_id'
=>
$user_id
))
->
row_array
();
$countryData
=
$this
->
getCountryData
(
$user_id
);
}
$url
=
(
isset
(
$data
[
'nextToken'
])
&&
!
empty
(
$data
[
'nextToken'
]))
?
"https://trawex.biz/api/hotel_trawexv5/getMoreHotels?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&sessionId="
.
$data
[
'sessionId'
]
.
"&nextToken="
.
$data
[
'nextToken'
]
.
"&trackingId="
.
$data
[
'trackingId'
]
.
""
:
"https://trawex.biz/api/hotel_trawexv5/hotel_search"
;
if
(
!
isset
(
$data
[
'nextToken'
])
&&
empty
(
$data
[
'nextToken'
])){
$postData
=
array
(
'user_id'
=>
$settings
[
'trawex_user_id'
],
'user_password'
=>
$settings
[
'trawex_user_password'
],
'access'
=>
$settings
[
'trawex_access'
],
'ip_address'
=>
$settings
[
'trawex_ip_address'
],
'trackingId'
=>
$trackingId
,
'city_name'
=>
$data
[
'city_name'
],
'country_name'
=>
$data
[
'country_name'
],
'room_count'
=>
$data
[
'room_count'
],
'adult'
=>
$data
[
'adult'
],
'child'
=>
$data
[
'child'
],
'child_age'
=>
$data
[
'child_age'
],
'checkin'
=>
$data
[
'checkin'
],
'checkout'
=>
$data
[
'checkout'
],
'client_nationality'
=>
$userData
[
'nationality'
],
'requiredCurrency'
=>
$countryData
[
'currency'
]);
}
$postFields
=
(
isset
(
$data
[
'nextToken'
])
&&
!
empty
(
$data
[
'nextToken'
]))
?
''
:
$postData
;
$result
=
$this
->
passToJsonCurl
(
$url
,
$postFields
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
status
->
trackingId
=
(
!
isset
(
$data
[
'nextToken'
])
&&
empty
(
$data
[
'nextToken'
]))
?
$trackingId
:
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
array
(
'itineraries'
=>
$result
));
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER07'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
get_specific_hotel_content
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/hotel_trawexv5/get_specific_hotel_content?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&sessionId="
.
$data
[
'sessionId'
]
.
"&trackingId="
.
$data
[
'trackingId'
]
.
"&productId="
.
$data
[
'productId'
]
.
"&hotelId="
.
$data
[
'hotelId'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
trackingId
=
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
get_room_rates
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/hotel_trawexv5/get_room_rates"
;
$postData
=
array
(
"user_id"
=>
$settings
[
'trawex_user_id'
],
"user_password"
=>
$settings
[
'trawex_user_password'
],
"access"
=>
$settings
[
'trawex_access'
],
"ip_address"
=>
$settings
[
'trawex_ip_address'
],
"TraceId"
=>
$data
[
'TraceId'
],
"propertyid"
=>
$data
[
'propertyid'
],
"trackingId"
=>
$data
[
'trackingId'
],
"sessionId"
=>
$data
[
'sessionId'
],
"productId"
=>
$data
[
'productId'
],
"TokenId"
=>
$data
[
'TokenId'
],
"resultindex"
=>
$data
[
'resultindex'
],
"hotelcode"
=>
$data
[
'hotelcode'
]);
$result
=
$this
->
passToJsonCurl
(
$url
,
$postData
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
trackingId
=
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
get_rate_rules
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/hotel_trawexv5/get_rate_rules"
;
$postData
=
array
(
"user_id"
=>
$settings
[
'trawex_user_id'
],
"user_password"
=>
$settings
[
'trawex_user_password'
],
"access"
=>
$settings
[
'trawex_access'
],
"ip_address"
=>
$settings
[
'trawex_ip_address'
],
"TraceId"
=>
$data
[
'TraceId'
],
"propertyid"
=>
$data
[
'propertyid'
],
"trackingId"
=>
$data
[
'trackingId'
],
"sessionId"
=>
$data
[
'sessionId'
],
"productId"
=>
$data
[
'productId'
],
"TokenId"
=>
$data
[
'TokenId'
],
"resultindex"
=>
$data
[
'resultindex'
],
"hotelcode"
=>
$data
[
'hotelcode'
],
"allocationDetails"
=>
$data
[
'allocationDetails'
],
"booking_token"
=>
$data
[
'booking_token'
],
"hotel_name"
=>
$data
[
'hotel_name'
],
"infosource"
=>
$data
[
'infosource'
],
"meal_code"
=>
$data
[
'meal_code'
],
"rate_basis_id"
=>
$data
[
'rate_basis_id'
],
"room_code"
=>
$data
[
'room_code'
],
"boardCode"
=>
$data
[
'boardCode'
],
"roomType_runno"
=>
$data
[
'roomType_runno'
]);
$result
=
$this
->
passToJsonCurl
(
$url
,
$postData
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
trackingId
=
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
hotel_book
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/hotel_trawexv5/hotel_book"
;
$postData
=
array
(
"user_id"
=>
$settings
[
'trawex_user_id'
],
"user_password"
=>
$settings
[
'trawex_user_password'
],
"access"
=>
$settings
[
'trawex_access'
],
"ip_address"
=>
$settings
[
'trawex_ip_address'
],
"TraceId"
=>
$data
[
'TraceId'
],
"propertyid"
=>
$data
[
'propertyid'
],
"trackingId"
=>
$data
[
'trackingId'
],
"sessionId"
=>
$data
[
'sessionId'
],
"productId"
=>
$data
[
'productId'
],
"TokenId"
=>
$data
[
'TokenId'
],
"resultindex"
=>
$data
[
'resultindex'
],
"hotelcode"
=>
$data
[
'hotelcode'
],
"changedOccupancy"
=>
$data
[
'changedOccupancy'
],
"extrabeds"
=>
$data
[
'extrabeds'
],
"guests_details"
=>
$data
[
'guests_details'
],
"refcode"
=>
$data
[
'refcode'
],
"prebookingtoken"
=>
$data
[
'prebookingtoken'
]
);
$result
=
$this
->
passToJsonCurl
(
$url
,
$postData
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
trackingId
=
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
trawex_cancel_booking
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/hotel_trawexv5/cancel_booking"
;
$postData
=
array
(
"user_id"
=>
$settings
[
'trawex_user_id'
],
"user_password"
=>
$settings
[
'trawex_user_password'
],
"access"
=>
$settings
[
'trawex_access'
],
"ip_address"
=>
$settings
[
'trawex_ip_address'
],
'trackingId'
=>
$data
[
'trackingId'
],
'productId'
=>
$data
[
'productId'
],
'supplierConfirmationNum'
=>
$data
[
'supplierConfirmationNum'
],
'reference'
=>
$data
[
'reference'
]
);
$result
=
$this
->
passToJsonCurl
(
$url
,
$postData
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
trackingId
=
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$re
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
passToJsonCurl
(
$url
=
''
,
$postData
=
array
()){
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
json_encode
(
$postData
));
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYHOST
,
false
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
false
);
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
array
(
'Content-Type:application/json'
));
$result
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
return
$result
;
}
}
?>
application/models/Webservice_model.php
View file @
3a7c1b26
...
@@ -2201,478 +2201,5 @@ class Webservice_model extends CI_Model {
...
@@ -2201,478 +2201,5 @@ class Webservice_model extends CI_Model {
}
}
return
$res
;
return
$res
;
}
}
public
function
get_hotel_city_list
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$cond
=
''
;
if
(
isset
(
$data
[
'query'
])
&&
!
empty
(
$data
[
'query'
])){
$cond
=
"AND THC.hotel_city_name LIKE '%"
.
$data
[
'query'
]
.
"%'"
;
}
$sql
=
"SELECT HC.hotel_city_id FROM hotel_cities AS HC
INNER JOIN translator_hotel_city AS THC ON(THC.hotel_city_id=HC.hotel_city_id)
WHERE HC.status=1
$cond
GROUP BY HC.hotel_city_id"
;
$count
=
$this
->
db
->
query
(
$sql
)
->
num_rows
();
if
(
$count
>=
1
){
$perPage
=
10
;
$page
=
(
isset
(
$data
[
'page'
]))
?
$data
[
'page'
]
:
1
;
$limit
=
(
$page
-
1
)
*
$perPage
;
$meta
=
array
(
'total_pages'
=>
ceil
(
$count
/
$perPage
),
'total'
=>
$count
,
'current_page'
=>
$page
,
'per_page'
=>
$perPage
);
$sql
=
"SELECT THC.hotel_city_id AS id,HC.hotel_city_icon AS image
FROM translator_hotel_city AS THC
INNER JOIN hotel_cities AS HC ON (HC.hotel_city_id=THC.hotel_city_id)
WHERE THC.status=1
$cond
GROUP BY HC.hotel_city_id LIMIT
$limit
,
$perPage
"
;
$hotelData
=
$this
->
db
->
query
(
$sql
)
->
result_array
();
$countryData
=
$this
->
getCountryData
(
$user_id
);
$lang
=
$countryData
[
'language_code'
];
foreach
(
$hotelData
as
$key
=>
$value
)
{
if
(
!
empty
(
$lanTrans
=
langTranslator
(
$value
[
'id'
],
'HCTY'
,
$lang
))){
$hotelData
[
$key
][
'name'
]
=
$lanTrans
[
'hotel_city_name'
];
}
}
if
(
count
(
$hotelData
)
<
0
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER10'
);
}
$res
=
array
(
'status'
=>
1
,
'data'
=>
array
(
'city_list'
=>
$hotelData
,
'meta'
=>
$meta
));
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER10'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Failed'
,
'code'
=>
'ER15'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
hotel_search
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$trackingId
=
time
()
.
rand
(
100000
,
999999
);
$settings
=
getSettings
();
if
(
!
isset
(
$data
[
'nextToken'
])
&&
empty
(
$data
[
'nextToken'
])){
$this
->
db
->
select
(
'nationality'
);
$userData
=
$this
->
db
->
get_where
(
'customer'
,
array
(
'customer_id'
=>
$user_id
))
->
row_array
();
$countryData
=
$this
->
getCountryData
(
$user_id
);
}
$url
=
(
isset
(
$data
[
'nextToken'
])
&&
!
empty
(
$data
[
'nextToken'
]))
?
"https://trawex.biz/api/hotel_trawexv5/getMoreHotels?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&sessionId="
.
$data
[
'sessionId'
]
.
"&nextToken="
.
$data
[
'nextToken'
]
.
"&trackingId="
.
$data
[
'trackingId'
]
.
""
:
"https://trawex.biz/api/hotel_trawexv5/hotel_search"
;
if
(
!
isset
(
$data
[
'nextToken'
])
&&
empty
(
$data
[
'nextToken'
])){
$postData
=
array
(
'user_id'
=>
$settings
[
'trawex_user_id'
],
'user_password'
=>
$settings
[
'trawex_user_password'
],
'access'
=>
$settings
[
'trawex_access'
],
'ip_address'
=>
$settings
[
'trawex_ip_address'
],
'trackingId'
=>
$trackingId
,
'city_name'
=>
$data
[
'city_name'
],
'country_name'
=>
$data
[
'country_name'
],
'room_count'
=>
$data
[
'room_count'
],
'adult'
=>
$data
[
'adult'
],
'child'
=>
$data
[
'child'
],
'child_age'
=>
$data
[
'child_age'
],
'checkin'
=>
$data
[
'checkin'
],
'checkout'
=>
$data
[
'checkout'
],
'client_nationality'
=>
$userData
[
'nationality'
],
'requiredCurrency'
=>
$countryData
[
'currency'
]);
}
$postFields
=
(
isset
(
$data
[
'nextToken'
])
&&
!
empty
(
$data
[
'nextToken'
]))
?
''
:
$postData
;
$result
=
$this
->
passToJsonCurl
(
$url
,
$postFields
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
status
->
trackingId
=
(
!
isset
(
$data
[
'nextToken'
])
&&
empty
(
$data
[
'nextToken'
]))
?
$trackingId
:
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
array
(
'itineraries'
=>
$result
));
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER07'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
get_specific_hotel_content
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/hotel_trawexv5/get_specific_hotel_content?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&sessionId="
.
$data
[
'sessionId'
]
.
"&trackingId="
.
$data
[
'trackingId'
]
.
"&productId="
.
$data
[
'productId'
]
.
"&hotelId="
.
$data
[
'hotelId'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
trackingId
=
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
get_room_rates
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/hotel_trawexv5/get_room_rates"
;
$postData
=
array
(
"user_id"
=>
$settings
[
'trawex_user_id'
],
"user_password"
=>
$settings
[
'trawex_user_password'
],
"access"
=>
$settings
[
'trawex_access'
],
"ip_address"
=>
$settings
[
'trawex_ip_address'
],
"TraceId"
=>
$data
[
'TraceId'
],
"propertyid"
=>
$data
[
'propertyid'
],
"trackingId"
=>
$data
[
'trackingId'
],
"sessionId"
=>
$data
[
'sessionId'
],
"productId"
=>
$data
[
'productId'
],
"TokenId"
=>
$data
[
'TokenId'
],
"resultindex"
=>
$data
[
'resultindex'
],
"hotelcode"
=>
$data
[
'hotelcode'
]);
$result
=
$this
->
passToJsonCurl
(
$url
,
$postData
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
trackingId
=
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
get_rate_rules
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/hotel_trawexv5/get_rate_rules"
;
$postData
=
array
(
"user_id"
=>
$settings
[
'trawex_user_id'
],
"user_password"
=>
$settings
[
'trawex_user_password'
],
"access"
=>
$settings
[
'trawex_access'
],
"ip_address"
=>
$settings
[
'trawex_ip_address'
],
"TraceId"
=>
$data
[
'TraceId'
],
"propertyid"
=>
$data
[
'propertyid'
],
"trackingId"
=>
$data
[
'trackingId'
],
"sessionId"
=>
$data
[
'sessionId'
],
"productId"
=>
$data
[
'productId'
],
"TokenId"
=>
$data
[
'TokenId'
],
"resultindex"
=>
$data
[
'resultindex'
],
"hotelcode"
=>
$data
[
'hotelcode'
],
"allocationDetails"
=>
$data
[
'allocationDetails'
],
"booking_token"
=>
$data
[
'booking_token'
],
"hotel_name"
=>
$data
[
'hotel_name'
],
"infosource"
=>
$data
[
'infosource'
],
"meal_code"
=>
$data
[
'meal_code'
],
"rate_basis_id"
=>
$data
[
'rate_basis_id'
],
"room_code"
=>
$data
[
'room_code'
],
"boardCode"
=>
$data
[
'boardCode'
],
"roomType_runno"
=>
$data
[
'roomType_runno'
]);
$result
=
$this
->
passToJsonCurl
(
$url
,
$postData
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
trackingId
=
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
hotel_book
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/hotel_trawexv5/hotel_book"
;
$postData
=
array
(
"user_id"
=>
$settings
[
'trawex_user_id'
],
"user_password"
=>
$settings
[
'trawex_user_password'
],
"access"
=>
$settings
[
'trawex_access'
],
"ip_address"
=>
$settings
[
'trawex_ip_address'
],
"TraceId"
=>
$data
[
'TraceId'
],
"propertyid"
=>
$data
[
'propertyid'
],
"trackingId"
=>
$data
[
'trackingId'
],
"sessionId"
=>
$data
[
'sessionId'
],
"productId"
=>
$data
[
'productId'
],
"TokenId"
=>
$data
[
'TokenId'
],
"resultindex"
=>
$data
[
'resultindex'
],
"hotelcode"
=>
$data
[
'hotelcode'
],
"changedOccupancy"
=>
$data
[
'changedOccupancy'
],
"extrabeds"
=>
$data
[
'extrabeds'
],
"guests_details"
=>
$data
[
'guests_details'
],
"refcode"
=>
$data
[
'refcode'
],
"prebookingtoken"
=>
$data
[
'prebookingtoken'
]
);
$result
=
$this
->
passToJsonCurl
(
$url
,
$postData
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
trackingId
=
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
trawex_cancel_booking
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/hotel_trawexv5/cancel_booking"
;
$postData
=
array
(
"user_id"
=>
$settings
[
'trawex_user_id'
],
"user_password"
=>
$settings
[
'trawex_user_password'
],
"access"
=>
$settings
[
'trawex_access'
],
"ip_address"
=>
$settings
[
'trawex_ip_address'
],
'trackingId'
=>
$data
[
'trackingId'
],
'productId'
=>
$data
[
'productId'
],
'supplierConfirmationNum'
=>
$data
[
'supplierConfirmationNum'
],
'reference'
=>
$data
[
'reference'
]
);
$result
=
$this
->
passToJsonCurl
(
$url
,
$postData
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$result
->
trackingId
=
$data
[
'trackingId'
];
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$re
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
flight_authenticate
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/authenticate?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER06'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER10'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER08'
);
}
return
$res
;
}
public
function
flight_availability_search
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/flight_availability_search?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
"&journey_type="
.
$data
[
'journey_type'
]
.
"&airport_from_code="
.
$data
[
'airport_from_code'
]
.
"&airport_to_code="
.
$data
[
'airport_to_code'
]
.
"&departure_date="
.
$data
[
'departure_date'
]
.
"&return_date="
.
$data
[
'return_date'
]
.
"&adult_flight="
.
$data
[
'adult_flight'
]
.
"&child_flight="
.
$data
[
'child_flight'
]
.
"&infant_flight="
.
$data
[
'infant_flight'
]
.
"&class="
.
$data
[
'class'
]
.
"&target="
.
$data
[
'target'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
flight_fare_rules
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/fare_rules?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&fare_source_code="
.
$data
[
'fare_source_code'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
flight_revalidate
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/revalidate?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&fare_source_code="
.
$data
[
'fare_source_code'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'data'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
flight_book
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$data
[
'first_name'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'first_name'
]);
$data
[
'last_name'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'last_name'
]);
$data
[
'title'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'title'
]);
$data
[
'dob'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'dob'
]);
$data
[
'gender'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'gender'
]);
$data
[
'issue_country'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'issue_country'
]);
$data
[
'passport_expiry'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'passport_expiry'
]);
$data
[
'passport_no'
]
=
str_replace
(
" "
,
"<br>"
,
$data
[
'passport_no'
]);
$url
=
"https://trawex.biz/api/flight_trawex/book?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&target="
.
$data
[
'target'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
"&area_code="
.
$data
[
'area_code'
]
.
"&country_code="
.
$data
[
'country_code'
]
.
"&first_name="
.
$data
[
'first_name'
]
.
"&last_name="
.
$data
[
'last_name'
]
.
"&title="
.
$data
[
'title'
]
.
"&email_id="
.
$data
[
'email_id'
]
.
"&mobile_no="
.
$data
[
'mobile_no'
]
.
"&dob="
.
$data
[
'dob'
]
.
"&gender="
.
$data
[
'gender'
]
.
"&issue_country="
.
$data
[
'issue_country'
]
.
"&passport_expiry="
.
$data
[
'passport_expiry'
]
.
"&passport_no="
.
$data
[
'passport_no'
]
.
"&type="
.
$data
[
'type'
]
.
"&IsPassportMandatory="
.
$data
[
'IsPassportMandatory'
]
.
"&adult_flight="
.
$data
[
'adult_flight'
]
.
"&child_flight="
.
$data
[
'child_flight'
]
.
"&infant_flight="
.
$data
[
'infant_flight'
]
.
"&frequentFlyrNum="
.
$data
[
'frequentFlyrNum'
]
.
"&adultmealplan="
.
$data
[
'adultmealplan'
]
.
"&child_dob="
.
$data
[
'child_dob'
]
.
"&child_gender="
.
$data
[
'child_gender'
]
.
"&child_title="
.
$data
[
'child_title'
]
.
"&child_first_name="
.
$data
[
'child_first_name'
]
.
"&child_last_name="
.
$data
[
'child_last_name'
]
.
"&child_passport_expiry_date="
.
$data
[
'child_passport_expiry_date'
]
.
"&child_passport_no="
.
$data
[
'child_passport_no'
]
.
"&child_frequentFlyrNum="
.
$data
[
'child_frequentFlyrNum'
]
.
"&childMealplan="
.
$data
[
'childMealplan'
]
.
"&infant_dob="
.
$data
[
'infant_dob'
]
.
"&infant_gender="
.
$data
[
'infant_gender'
]
.
"&infant_first_name="
.
$data
[
'infant_first_name'
]
.
"&infant_last_name="
.
$data
[
'infant_last_name'
]
.
"&infant_title="
.
$data
[
'infant_title'
]
.
"&infantMealplan="
.
$data
[
'infantMealplan'
]
.
"&FareSourceCode="
.
$data
[
'FareSourceCode'
]
.
"&PostCode="
.
$data
[
'PostCode'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'result'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
flight_ticket_order
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/ticket_order?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&UniqueID="
.
$data
[
'UniqueID'
]
.
"&target="
.
$data
[
'target'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'result'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
flight_trip_details
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/trip_details?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&UniqueID="
.
$data
[
'UniqueID'
]
.
"&target="
.
$data
[
'target'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
""
;
$result
=
$this
->
passToJsonCurl
(
$url
,
''
);
if
(
!
empty
(
$result
)){
$result
=
json_decode
(
$result
);
$res
=
array
(
'status'
=>
1
,
'result'
=>
$result
);
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No Data Found'
,
'code'
=>
'ER08'
);
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
cancel_flights
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$settings
=
getSettings
();
$url
=
"https://trawex.biz/api/flight_trawex/cancel_flights?user_id="
.
$settings
[
'trawex_user_id'
]
.
"&user_password="
.
$settings
[
'trawex_user_password'
]
.
"&access="
.
$settings
[
'trawex_access'
]
.
"&ip_address="
.
$settings
[
'trawex_ip_address'
]
.
"&UniqueID="
.
$data
[
'UniqueID'
]
.
"&target="
.
$data
[
'target'
]
.
"&session_id="
.
$data
[
'session_id'
]
.
""
;
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
airportSearch
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$cond
=
''
;
if
(
isset
(
$data
[
'query'
])
&&
!
empty
(
$data
[
'query'
])){
$cond
=
"WHERE airport_code LIKE '%"
.
$data
[
'query'
]
.
"%' OR airport_name LIKE '%"
.
$data
[
'query'
]
.
"%'"
;
}
$sql
=
"SELECT id FROM airport_details
$cond
"
;
$count
=
$this
->
db
->
query
(
$sql
)
->
num_rows
();
if
(
$count
>
0
){
$perPage
=
10
;
$page
=
(
isset
(
$data
[
'page'
]))
?
$data
[
'page'
]
:
1
;
$limit
=
(
$page
-
1
)
*
$perPage
;
$meta
=
array
(
'total_pages'
=>
ceil
(
$count
/
$perPage
),
'total'
=>
$count
,
'current_page'
=>
$page
,
'per_page'
=>
$perPage
);
$sql
=
"SELECT * FROM airport_details
$cond
LIMIT
$limit
,
$perPage
"
;
$airPortList
=
$this
->
db
->
query
(
$sql
);
if
(
!
isset
(
$airPortList
)
||
empty
(
$airPortList
=
$airPortList
->
result_array
())){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'No data Found'
,
'code'
=>
'ER04'
);
return
$res
;
}
$res
=
array
(
'status'
=>
1
,
'data'
=>
array
(
'airportlist'
=>
$airPortList
,
'meta'
=>
$meta
));
}
}
else
{
$res
=
array
(
'status'
=>
0
,
'message'
=>
'User Authentication Error'
,
'code'
=>
'ER06'
);
}
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South'
,
'code'
=>
'ER10'
);
}
return
$res
;
}
public
function
passToJsonCurl
(
$url
=
''
,
$postData
=
array
()){
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
json_encode
(
$postData
));
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYHOST
,
false
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
false
);
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
array
(
'Content-Type:application/json'
));
$result
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
return
$result
;
}
}
}
?>
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment