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
6aa6da11
Commit
6aa6da11
authored
Nov 07, 2019
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dc
parent
1a18dd8b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
12 deletions
+43
-12
Api.php
application/controllers/Api.php
+29
-7
Api_model.php
application/models/Api_model.php
+1
-1
Validation_model.php
application/models/Validation_model.php
+8
-1
Webservice_model.php
application/models/Webservice_model.php
+5
-3
No files found.
application/controllers/Api.php
View file @
6aa6da11
...
@@ -20,7 +20,9 @@ if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
...
@@ -20,7 +20,9 @@ if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
class
Api
extends
CI_Controller
{
class
Api
extends
CI_Controller
{
var
$auth_token
;
var
$auth_token
;
private
$cipher
=
"AES-256-CBC"
;
private
$cipher
=
"AES-256-CBC"
;
private
$local_iv
=
"9H77F2KL7KRF4W51"
;
private
$local_key
=
"af5b2a1h6947gt8fd045k78s2ah5609f"
;
public
function
__construct
()
{
public
function
__construct
()
{
parent
::
__construct
();
parent
::
__construct
();
date_default_timezone_set
(
"Asia/Riyadh"
);
date_default_timezone_set
(
"Asia/Riyadh"
);
...
@@ -603,7 +605,7 @@ class Api extends CI_Controller {
...
@@ -603,7 +605,7 @@ class Api extends CI_Controller {
empty
(
$resp
->
txnCardDetails
)
||
count
(
$resp
->
txnCardDetails
)
<=
0
){
empty
(
$resp
->
txnCardDetails
)
||
count
(
$resp
->
txnCardDetails
)
<=
0
){
$this
->
errorResponse
(
'893'
,
'No Data Found'
);
$this
->
errorResponse
(
'893'
,
'No Data Found'
);
}
}
$this
->
response
(
array
(
'saved_cards'
=>
$resp
->
txnCardDetails
));
$this
->
response
(
array
(
'saved_cards'
=>
encrypt
(
$resp
->
txnCardDetails
,
$this
->
local_key
,
$this
->
local_iv
)
));
}
}
function
encryptePayData
(
$merchant_iv
=
''
,
$merchant_key
=
''
,
$plainText
=
''
)
{
function
encryptePayData
(
$merchant_iv
=
''
,
$merchant_key
=
''
,
$plainText
=
''
)
{
...
@@ -641,25 +643,45 @@ class Api extends CI_Controller {
...
@@ -641,25 +643,45 @@ class Api extends CI_Controller {
return
''
;
return
''
;
}
}
if
(
in_array
(
$this
->
cipher
,
openssl_get_cipher_methods
()))
{
if
(
in_array
(
$this
->
cipher
,
openssl_get_cipher_methods
()))
{
$ciphertext
=
openssl_encrypt
(
$plainText
,
$this
->
cipher
,
$this
->
key
,
$options
=
0
,
$this
->
i
v
);
$ciphertext
=
openssl_encrypt
(
$plainText
,
$this
->
cipher
,
$mKey
,
$options
=
0
,
$mI
v
);
return
$ciphertext
;
return
$ciphertext
;
}
}
}
}
public
function
decrypt
(
$encText
=
''
,
$mKey
=
''
,
$mIv
=
''
)
{
public
function
decrypt
(
$encText
=
''
,
$mKey
=
''
,
$mIv
=
''
)
{
if
(
empty
(
$
plain
Text
)
||
empty
(
$mKey
)
||
empty
(
$mIv
)){
if
(
empty
(
$
enc
Text
)
||
empty
(
$mKey
)
||
empty
(
$mIv
)){
return
''
;
return
''
;
}
}
if
(
in_array
(
$this
->
cipher
,
openssl_get_cipher_methods
()))
{
if
(
in_array
(
$this
->
cipher
,
openssl_get_cipher_methods
()))
{
$original_plaintext
=
openssl_decrypt
(
$encText
,
$this
->
cipher
,
$this
->
key
,
$options
=
0
,
$this
->
i
v
);
$original_plaintext
=
openssl_decrypt
(
$encText
,
$this
->
cipher
,
$mKey
,
$options
=
0
,
$mI
v
);
return
$original_plaintext
;
return
$original_plaintext
;
}
}
}
}
public
function
addCard
(){
public
function
addCard
(){
pr
(
$_POST
);
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
}
// $dmyData = '{"auth_token":"cc731b6bd572eb452d85c96aaec77898","cardNumber":"5111111111111118",
// "expMonthYear":"0622","cardHolderName":"John","cvv":"100","cardType":"MasterCard"}';
// $data['requestData'] = $this->encrypt($dmyData,$this->local_key,$this->local_iv);
$settings
=
getSettings
();
$merchant_iv
=
$settings
[
'merchant_iv'
];
$merchant_key
=
$settings
[
'merchant_key'
];
$reqData
=
$this
->
decrypt
(
$data
[
'requestData'
],
$this
->
local_key
,
$this
->
local_iv
);
if
(
empty
(
$reqData
)
||
empty
(
$reqData
=
json_decode
(
$reqData
,
true
))){
redirect
(
$redUrl
.
'failure'
);
}
$payData
=
array
(
'auth_token'
=>
$reqData
[
'auth_token'
],
'amount'
=>
'1'
,
'booking_id'
=>
'ADD_CARD'
);
$res
=
$this
->
Api_model
->
payNow
(
$payData
);
if
(
$res
[
'status'
]
==
1
){
unset
(
$reqData
[
'auth_token'
]);
$this
->
paymentGateway
(
1
,
$res
[
'transaction_id'
],
'test'
,
'ADD_CARD'
,
$res
[
'custData'
],
$reqData
);
}
else
{
redirect
(
$redUrl
.
'failure'
);
}
}
/*================ START : Checker API ================*/
/*================ START : Checker API ================*/
...
...
application/models/Api_model.php
View file @
6aa6da11
...
@@ -1730,7 +1730,7 @@ class Api_model extends CI_Model {
...
@@ -1730,7 +1730,7 @@ class Api_model extends CI_Model {
->
select
(
'booking.id AS book_id,booking.bookId,customer.name AS customer_name,
->
select
(
'booking.id AS book_id,booking.bookId,customer.name AS customer_name,
booking.status,booking.no_of_ticket,booking.qrcode,
booking.status,booking.no_of_ticket,booking.qrcode,
booking.ticket_details,event_date_time.date AS booking_date'
)
booking.ticket_details,event_date_time.date AS booking_date'
)
->
where
(
'booking.bookId'
,
$data
[
'qr_pin'
]
)
->
where
(
array
(
'booking.bookId'
=>
$data
[
'qr_pin'
],
'status'
=>
'1'
)
)
->
from
(
'booking'
)
->
from
(
'booking'
)
->
join
(
'events'
,
'booking.event_id = events.event_id'
)
->
join
(
'events'
,
'booking.event_id = events.event_id'
)
->
join
(
'event_date_time'
,
'booking.event_date_id = event_date_time.id'
)
->
join
(
'event_date_time'
,
'booking.event_date_id = event_date_time.id'
)
...
...
application/models/Validation_model.php
View file @
6aa6da11
...
@@ -686,7 +686,14 @@ class Validation_model extends CI_Model {
...
@@ -686,7 +686,14 @@ class Validation_model extends CI_Model {
)
)
)
)
),
),
'addCard'
=>
array
()
'addCard'
=>
array
(
'requestData'
=>
array
(
'required'
=>
array
(
'code'
=>
'ER18'
,
'message'
=>
'Request Data is null or empty'
)
)
)
);
);
public
function
_consruct
(){
public
function
_consruct
(){
...
...
application/models/Webservice_model.php
View file @
6aa6da11
...
@@ -1832,9 +1832,10 @@ class Webservice_model extends CI_Model {
...
@@ -1832,9 +1832,10 @@ class Webservice_model extends CI_Model {
FROM customer AS CUST
FROM customer AS CUST
LEFT JOIN chats AS CHT ON ((CUST.customer_id=CHT.from_user OR CUST.customer_id=CHT.to_user) AND CHT.type=1)
LEFT JOIN chats AS CHT ON ((CUST.customer_id=CHT.from_user OR CUST.customer_id=CHT.to_user) AND CHT.type=1)
WHERE (
"
.
$phNumbers
.
"
) AND
WHERE (
$phNumbers
) AND
customer_id NOT IN (SELECT from_user FROM chats WHERE (from_user=
$user_id
AND type='2') OR (to_user =
$user_id
AND type='2')) AND
customer_id NOT IN (SELECT from_user FROM chats WHERE (from_user=
$user_id
AND type='2') OR (to_user =
$user_id
AND type='2')) AND
customer_id NOT IN (SELECT to_user FROM chats WHERE (from_user=
$user_id
AND type='2') OR (to_user =
$user_id
AND type='2'))"
);
customer_id NOT IN (SELECT to_user FROM chats WHERE (from_user=
$user_id
AND type='2') OR (to_user =
$user_id
AND type='2'))
GROUP BY CUST.customer_id"
);
$respArr
[
'status'
]
=
1
;
$respArr
[
'status'
]
=
1
;
$respArr
[
'data'
]
=
(
!
empty
(
$result
)
&&
!
empty
(
$result
=
$result
->
result_array
()))
?
$result
:
[];
$respArr
[
'data'
]
=
(
!
empty
(
$result
)
&&
!
empty
(
$result
=
$result
->
result_array
()))
?
$result
:
[];
...
@@ -1873,7 +1874,8 @@ class Webservice_model extends CI_Model {
...
@@ -1873,7 +1874,8 @@ class Webservice_model extends CI_Model {
CUST.customer_id
CUST.customer_id
FROM customer AS CUST
FROM customer AS CUST
INNER JOIN chats AS CHT ON (CUST.customer_id = CHT.from_user)
INNER JOIN chats AS CHT ON (CUST.customer_id = CHT.from_user)
WHERE type='0' AND to_user='"
.
$user_id
.
"'"
);
WHERE type='0' AND to_user='
$user_id
'
GROUP BY CUST.customer_id"
);
if
(
!
empty
(
$result
)
&&
!
empty
(
$result
=
$result
->
result
())){
if
(
!
empty
(
$result
)
&&
!
empty
(
$result
=
$result
->
result
())){
$respArr
[
'status'
]
=
1
;
$respArr
[
'status'
]
=
1
;
$respArr
[
'data'
]
=
$result
;
$respArr
[
'data'
]
=
$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