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
2a264111
Commit
2a264111
authored
Nov 07, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cancel booking in trawex api
parent
6f7e5ea8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
3 deletions
+84
-3
Webservice.php
application/controllers/Webservice.php
+11
-3
Validation_app_model.php
application/models/Validation_app_model.php
+32
-0
Webservice_model.php
application/models/Webservice_model.php
+41
-0
No files found.
application/controllers/Webservice.php
View file @
2a264111
...
@@ -637,8 +637,16 @@ class Webservice extends CI_Controller {
...
@@ -637,8 +637,16 @@ class Webservice extends CI_Controller {
}
}
}
}
// public function cancel_booking(){
public
function
trawex_cancel_booking
(){
// $data = (array)json_decode(file_get_contents('php://input'));
$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'
]);
}
}
}
}
?>
?>
application/models/Validation_app_model.php
View file @
2a264111
...
@@ -456,6 +456,38 @@ class Validation_app_model extends CI_Model {
...
@@ -456,6 +456,38 @@ class Validation_app_model extends CI_Model {
)
)
),
),
),
),
'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
)
{
public
function
validation_check
(
$method_name
,
$parms
)
{
...
...
application/models/Webservice_model.php
View file @
2a264111
...
@@ -2301,5 +2301,46 @@ class Webservice_model extends CI_Model {
...
@@ -2301,5 +2301,46 @@ class Webservice_model extends CI_Model {
}
}
return
$res
;
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'
]
);
$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
);
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
;
}
}
}
?>
?>
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