Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
iwl-live
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Anthony.Suerte
iwl-live
Commits
f168ba94
Commit
f168ba94
authored
Aug 10, 2021
by
Antonio.Suerte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Help2Pay Migration [Deposit Webhook Fix]
parent
bac49866
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
21 deletions
+32
-21
H2PDepositWebhook.php
api/H2PDepositWebhook.php
+21
-20
test_deposit.php
test/help2pay/test_deposit.php
+11
-1
No files found.
api/H2PDepositWebhook.php
View file @
f168ba94
...
...
@@ -21,7 +21,7 @@ class H2PDepositWebhook extends System {
private
function
setParameter
(){
$this
->
referenceId
=
$this
->
getDataPost
(
"Reference"
);
$this
->
status
=
$this
->
getDataPost
(
"Status"
);
$this
->
lang
=
$this
->
getData
Pos
t
(
"lang"
);
$this
->
lang
=
$this
->
getData
Ge
t
(
"lang"
);
$this
->
responseURL
=
"Logs/H2P/deposit_response"
;
$this
->
responseDbURL
=
"Logs/H2P/deposit_db_response"
;
...
...
@@ -107,39 +107,37 @@ class H2PDepositWebhook extends System {
return
$params
;
}
private
function
logTransactionDetails
(){
private
function
logTransactionDetails
(
$content
){
$logDate
=
date
(
"Y-m-d"
);
$logTimestamp
=
date
(
"[Y-m-d H:i:s]"
);
error_log
(
"
{
$logTimestamp
}
\r\n
{
$
this
->
referenceId
}
-deposit_response:
\r\n
{
$this
->
status
}
\r\n
"
,
VAL_INT_3
,
"
{
$logTimestamp
}
\r\n
{
$
content
}
\r\n
"
,
VAL_INT_3
,
"
{
$this
->
responseURL
}
/Log_
{
$logDate
}
.log"
);
chmod
(
"
{
$this
->
responseURL
}
/Log_
{
$logDate
}
.log"
,
511
);
}
public
function
listen
(){
$logPostVars
=
print_r
(
$_POST
,
true
);
error_log
(
date
(
"Y-m-d h:i:s A"
)
.
"
\r\n
Accessed
\r\n
{
$logPostVars
}
\r\n
"
,
VAL_INT_3
,
"
{
$this
->
responseURL
}
/Log_"
.
date
(
"Y-m-d"
)
.
".log"
);
$logPostVars
=
print_r
(
$_POST
,
true
);
$logGetVars
=
print_r
(
$_GET
,
true
);
// check deposit transaction
$depositData
=
$this
->
accessSelect
(
"SELECT_DEPOSIT_BY_TRANSACTION_NUMBER"
,
[
$this
->
referenceId
]);
$this
->
logTransactionDetails
(
"Accessed
\r\n
POST:
{
$logPostVars
}
GET:
{
$logGetVars
}
"
);
// fetches temporary transaction data
$temporaryDepositData
=
$this
->
accessSelect
(
"SELECT_DEPOSIT_H2P_TEMP"
,
[
$this
->
referenceId
]);
if
(
$this
->
isLoopData
(
$
d
epositData
)){
//
fetches temporary transaction data
$
temporaryDepositData
=
$this
->
accessSelect
(
"SELECT_DEPOSIT_H2P_TEMP
"
,
[
$this
->
referenceId
]);
if
(
$this
->
isLoopData
(
$
temporaryD
epositData
)){
//
check deposit transaction
$
depositData
=
$this
->
accessSelect
(
"SELECT_DEPOSIT_BY_TRANSACTION_NUMBER
"
,
[
$this
->
referenceId
]);
if
(
$this
->
isLoopData
(
$temporaryD
epositData
)){
if
(
!
$this
->
isLoopData
(
$d
epositData
)){
switch
(
$this
->
status
){
case
"000"
:
case
"006"
:
{
case
"006"
:
{
$tempDepositRowData
=
$this
->
getRowData
(
$temporaryDepositData
);
$this
->
accessModify
(
"INSERT_WB_DEPOSIT_TRANSACTION"
,
$this
->
credtingDepositData
(
$tempDepositRowData
),
$this
->
cred
i
tingDepositData
(
$tempDepositRowData
),
false
);
$address
=
NO_STRING
;
...
...
@@ -157,16 +155,19 @@ class H2PDepositWebhook extends System {
$this
->
accessModifyCommon
(
'UPDATE_DEPOSIT_ISSENDMAIL'
,
[
$this
->
referenceId
]);
$this
->
logTransactionDetails
();
$this
->
logTransactionDetails
(
"
{
$this
->
referenceId
}
-deposit_response:
\r\n
{
$this
->
status
}
"
);
echo
"0"
;
break
;
}
default
:
$this
->
logTransactionDetails
(
"Invalid Status Code
\r\n
{
$this
->
status
}
"
);
break
;
}
}
}
}
else
$this
->
logTransactionDetails
(
"Transaction already credited
\r\n
{
$this
->
referenceId
}
"
);
}
else
$this
->
logTransactionDetails
(
"Invalid H2P Deposit Transaction
\r\n
{
$this
->
referenceId
}
"
);
}
}
...
...
test/help2pay/test_deposit.php
View file @
f168ba94
...
...
@@ -111,6 +111,12 @@ class TestDeposit extends System {
*/
private
$backURI
=
NO_STRING
;
/**
*
* @var string
*/
private
$language
=
NO_STRING
;
public
function
__construct
(){
parent
::
__construct
();
$this
->
setParameter
();
...
...
@@ -134,9 +140,13 @@ class TestDeposit extends System {
$this
->
amount
=
$this
->
getDataPost
(
"amount"
);
$this
->
bank
=
$this
->
getDataPost
(
"bank"
);
$this
->
note
=
$this
->
getDataPost
(
"note"
);
$this
->
language
=
$this
->
getDataPost
(
"lang"
);
if
(
$this
->
language
==
NO_STRING
)
$this
->
language
=
"en"
;
$this
->
frontURI
=
SITE_PROTOCOL
.
"://"
.
SITE_DOMAIN_FULL
.
"/test/help2pay/deposit_status.php"
;
$this
->
backURI
=
SITE_PROTOCOL
.
"://"
.
SITE_DOMAIN_FULL
.
"/api/H2PDepositWebhook.php"
;
$this
->
backURI
=
SITE_PROTOCOL
.
"://"
.
SITE_DOMAIN_FULL
.
"/api/H2PDepositWebhook.php
?lang=
{
$this
->
language
}
"
;
}
private
function
validation
(){
...
...
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