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
fedae876
Commit
fedae876
authored
Nov 14, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
J: update user location and flight apis
parent
e52b719e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
181 additions
and
0 deletions
+181
-0
Webservice.php
application/controllers/Webservice.php
+55
-0
Validation_app_model.php
application/models/Validation_app_model.php
+20
-0
Webservice_model.php
application/models/Webservice_model.php
+106
-0
No files found.
application/controllers/Webservice.php
View file @
fedae876
...
...
@@ -593,6 +593,17 @@ class Webservice extends CI_Controller {
}
}
public
function
update_user_location
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Webservice_model
->
update_user_location
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
successResponse
();
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
get_hotel_city_list
(){
$data
=
$_GET
;
$data
[
'auth_token'
]
=
$this
->
auth_token
;
...
...
@@ -717,6 +728,50 @@ class Webservice extends CI_Controller {
}
}
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'
]);
}
}
...
...
application/models/Validation_app_model.php
View file @
fedae876
...
...
@@ -914,6 +914,26 @@ class Validation_app_model extends CI_Model {
)
),
),
'update_user_location'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'User Id is null or empty'
)
),
'latitude'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Latitude Field is null or empty'
)
),
'longitude'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER02'
,
'message'
=>
'Longitude Field is null or empty'
)
),
),
);
public
function
validation_check
(
$method_name
,
$parms
)
{
...
...
application/models/Webservice_model.php
View file @
fedae876
...
...
@@ -2106,6 +2106,22 @@ class Webservice_model extends CI_Model {
return
$res
;
}
public
function
update_user_location
(
$data
){
$res
=
array
(
'status'
=>
0
,
'message'
=>
'Ohh No!! Something Went South!!'
,
'code'
=>
'ER06'
);
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
){
$this
->
db
->
update
(
'customer'
,
array
(
'cust_lat'
=>
$data
[
'latitude'
],
'cust_lng'
=>
$data
[
'longitude'
]),
array
(
'customer_id'
=>
$user_id
));
$res
=
array
(
'status'
=>
1
);
}
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'
=>
'ER06'
);
}
return
$res
;
}
public
function
get_hotel_city_list
(
$data
){
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
...
...
@@ -2442,6 +2458,96 @@ class Webservice_model extends CI_Model {
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
passToJsonCurl
(
$url
=
''
,
$postData
=
array
()){
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
...
...
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