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
256bcd4f
Commit
256bcd4f
authored
5 years ago
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dc
parent
2bb57c97
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
16 deletions
+69
-16
Api.php
application/controllers/Api.php
+44
-11
Api_model.php
application/models/Api_model.php
+11
-5
Validation_model.php
application/models/Validation_model.php
+14
-0
No files found.
application/controllers/Api.php
View file @
256bcd4f
...
...
@@ -371,7 +371,9 @@ class Api extends CI_Controller {
redirect
(
$redUrl
.
'failure'
);
}
$payData
=
array
(
'auth_token'
=>
$auth_token
,
'amount'
=>
$amount
,
'booking_id'
=>
$booking_id
);
$callback_url
=
(
isset
(
$reqData
[
'callback_url'
]))
?
$reqData
[
'callback_url'
]
:
''
;
$payData
=
array
(
'auth_token'
=>
$auth_token
,
'amount'
=>
$amount
,
'booking_id'
=>
$booking_id
,
'callback_url'
=>
$callback_url
);
$res
=
$this
->
Api_model
->
payNow
(
$payData
);
if
(
$res
[
'status'
]
==
1
){
...
...
@@ -533,12 +535,16 @@ class Api extends CI_Controller {
}
if
(
!
empty
(
$transaction_id
)
&&
!
empty
(
$last_id
)){
$this
->
Api_model
->
update_payment
(
$response
,
$transaction_id
,
$last_id
,
'1'
,
$eventid
);
$
resp
=
$
this
->
Api_model
->
update_payment
(
$response
,
$transaction_id
,
$last_id
,
'1'
,
$eventid
);
$customData
=
$this
->
txnManager
(
$eventid
,
array
(
'tnx_id'
=>
$booking_id
,
'status'
=>
'1'
));
}
if
(
!
empty
(
$booking_id
)){
redirect
(
$redUrl
.
'bookingdetails?booking_id='
.
$booking_id
);
$callback_url
=
$redUrl
.
'bookingdetails?booking_id='
;
if
(
isset
(
$resp
[
'callback_url'
])
&&
!
empty
(
$resp
[
'callback_url'
])){
$callback_url
=
$redUrl
.
$resp
[
'callback_url'
];
}
redirect
(
$callback_url
.
$booking_id
);
}
}
redirect
(
$redUrl
.
'failure'
);
...
...
@@ -581,7 +587,7 @@ class Api extends CI_Controller {
$last_id
=
$data
[
1
];
$eventid
=
$data
[
2
];
$booking_id
=
$data
[
3
];
$this
->
Api_model
->
update_payment
(
$response
,
''
,
$last_id
,
'0'
,
$eventid
);
$
resp
=
$
this
->
Api_model
->
update_payment
(
$response
,
''
,
$last_id
,
'0'
,
$eventid
);
$customData
=
$this
->
txnManager
(
$eventid
,
array
(
'tnx_id'
=>
$booking_id
,
'status'
=>
'2'
));
$sql
=
"SELECT BOK.event_id FROM transaction AS TX
...
...
@@ -589,7 +595,11 @@ class Api extends CI_Controller {
WHERE TX.id='
$last_id
'"
;
$trxData
=
$this
->
db
->
query
(
$sql
)
->
row_array
();
if
(
!
empty
(
$trxData
)
&&
isset
(
$trxData
[
'event_id'
])
&&
!
empty
(
$trxData
[
'event_id'
])){
redirect
(
$redUrl
.
'failure?event_id='
.
$trxData
[
'event_id'
]);
$callback_url
=
$redUrl
.
'failure?event_id='
;
if
(
isset
(
$resp
[
'callback_url'
])
&&
!
empty
(
$resp
[
'callback_url'
])){
$callback_url
=
$redUrl
.
$resp
[
'callback_url'
];
}
redirect
(
$callback_url
.
$trxData
[
'event_id'
]);
}
}
}
...
...
@@ -601,8 +611,7 @@ class Api extends CI_Controller {
$res
=
$this
->
Api_model
->
reset_password
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
...
...
@@ -617,8 +626,7 @@ class Api extends CI_Controller {
$res
=
$this
->
Api_model
->
checkSeatAvailability
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
...
...
@@ -627,8 +635,7 @@ class Api extends CI_Controller {
$res
=
$this
->
Api_model
->
getCountry
();
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
...
...
@@ -643,6 +650,7 @@ class Api extends CI_Controller {
}
public
function
getSavedCards
(){
try
{
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$cust_id
=
$this
->
Api_model
->
auth_token_get
(
$this
->
auth_token
);
if
(
empty
(
$cust_id
)
||
empty
(
$data
)
||
!
isset
(
$data
[
'email'
])
||
empty
(
$email
=
$data
[
'email'
])){
...
...
@@ -681,6 +689,9 @@ class Api extends CI_Controller {
$cardData
=
json_encode
(
json_decode
(
json_encode
(
$resp
->
txnCardDetails
),
true
));
$resp
=
$this
->
encrypt
(
$cardData
,
$this
->
local_key
,
$this
->
local_iv
);
$this
->
response
(
array
(
'saved_cards'
=>
$resp
));
}
catch
(
Exception
$e
)
{
$this
->
errorResponse
(
'894'
,
'Something went wrong, Please try again'
);
}
}
function
encryptePayData
(
$merchant_iv
=
''
,
$merchant_key
=
''
,
$plainText
=
''
)
{
...
...
@@ -761,5 +772,27 @@ class Api extends CI_Controller {
redirect
(
$redUrl
.
'failure'
);
}
}
function
hotelBooking
(){
try
{
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$cust_id
=
$this
->
Api_model
->
auth_token_get
(
$this
->
auth_token
);
if
(
empty
(
$cust_id
)){
$this
->
errorResponse
(
'891'
,
'Invalid User'
);
}
if
(
empty
(
$data
)
||
!
isset
(
$data
[
'request_data'
])
||
empty
(
$request_data
=
$data
[
'request_data'
])){
$this
->
errorResponse
(
'892'
,
'Request Data Missing'
);
}
pre
(
$request_data
);
$reqData
=
$this
->
encrypt
(
json_encode
(
$request_data
),
$this
->
local_key
,
$this
->
local_iv
);
$reqData
=
urlencode
(
base64_encode
(
$reqData
));
$res
[
'data'
][
'reqData'
]
=
$reqData
;
$this
->
response
(
$res
[
'data'
]);
}
catch
(
Exception
$e
)
{
$this
->
errorResponse
(
'894'
,
'Something went wrong, Please try again'
);
}
}
}
?>
This diff is collapsed.
Click to expand it.
application/models/Api_model.php
View file @
256bcd4f
...
...
@@ -1341,7 +1341,11 @@ class Api_model extends CI_Model {
try
{
$user_id
=
$this
->
auth_token_get
(
$data
[
'auth_token'
]);
if
(
$user_id
>
0
)
{
$this
->
db
->
insert
(
'transaction'
,
array
(
'customer_id'
=>
$user_id
,
'booking_id'
=>
$data
[
'booking_id'
],
'datetime'
=>
date
(
'Y-m-d h:i:s'
),
'amount'
=>
$data
[
'amount'
]));
$callback_url
=
(
isset
(
$data
[
'callback_url'
]))
?
$data
[
'callback_url'
]
:
''
;
$insertData
=
array
(
'customer_id'
=>
$user_id
,
'booking_id'
=>
$data
[
'booking_id'
],
'datetime'
=>
date
(
'Y-m-d h:i:s'
),
'amount'
=>
$data
[
'amount'
],
'callback_url'
=>
$callback_url
);
$this
->
db
->
insert
(
'transaction'
,
$insertData
);
$last_id
=
$this
->
db
->
insert_id
();
$custData
=
$this
->
getUserData
(
$user_id
);
...
...
@@ -1404,8 +1408,10 @@ class Api_model extends CI_Model {
$this
->
db
->
update
(
'transaction'
,
array
(
'transaction_id'
=>
$transactionid
,
'status'
=>
$status
,
'transaction_response'
=>
json_encode
(
$response
)),
array
(
'id'
=>
$last_id
));
if
(
!
empty
(
$eventid
)){
$callback_url
=
''
;
$transResp
=
$this
->
db
->
get_where
(
'transaction'
,
array
(
'id'
=>
$last_id
))
->
row_array
();
if
(
!
empty
(
$transResp
)){
$callback_url
=
$transResp
[
'callback_url'
];
}
if
(
$status
==
1
){
$trBook
=
$this
->
db
->
get_where
(
'transaction'
,
array
(
'id'
=>
$last_id
))
->
row_array
();
...
...
@@ -1460,9 +1466,9 @@ class Api_model extends CI_Model {
$this
->
db
->
update
(
'event_invites'
,
array
(
'status'
=>
'1'
),
array
(
'book_id'
=>
$book_id
));
$this
->
db
->
update
(
'promocode_used'
,
array
(
'status'
=>
'1'
),
array
(
'booking_id'
=>
$book_id
));
}
$res
=
array
(
'status'
=>
1
);
$res
=
array
(
'status'
=>
1
,
'callback_url'
=>
$callback_url
);
}
catch
(
Exception
$e
){
$res
=
array
(
'status'
=>
0
,
'
message'
=>
'Ohh No!! Something went South!!'
,
'code'
=>
'ER06'
);
$res
=
array
(
'status'
=>
0
,
'
callback_url'
=>
$callback_url
);
}
return
$res
;
}
...
...
This diff is collapsed.
Click to expand it.
application/models/Validation_model.php
View file @
256bcd4f
...
...
@@ -333,6 +333,20 @@ class Validation_model extends CI_Model {
)
)
,
'payNow'
=>
array
(),
'hotelBooking'
=>
array
(
'auth_token'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER16'
,
'message'
=>
'User Id is null or empty'
)
)
,
'request_data'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER18'
,
'message'
=>
'Booking Data is null or empty'
)
,
)
),
'searchEvent'
=>
array
(),
'validate_promo_code'
=>
array
(
'promo_code'
=>
array
(
...
...
This diff is collapsed.
Click to expand it.
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