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
935453c1
Commit
935453c1
authored
Jun 06, 2023
by
iWallet Dev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remittance API Enhancement
parent
978ad27d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
127 additions
and
70 deletions
+127
-70
MoneyRequest.php
api/MoneyRequest.php
+127
-70
No files found.
api/MoneyRequest.php
View file @
935453c1
...
...
@@ -109,6 +109,19 @@ class MoneyRequest extends System {
*/
private
$accessLogDir
=
NO_STRING
;
/**
*
*
* @var boolean
*/
private
$forTest
=
false
;
/**
*
* @var integer
*/
private
$responseCode
=
200
;
public
function
__construct
(){
parent
::
__construct
();
...
...
@@ -125,6 +138,7 @@ class MoneyRequest extends System {
$this
->
currency
=
$this
->
getDataPost
(
'currency'
);
$this
->
message
=
$this
->
getDataPost
(
'message'
);
$this
->
signature
=
$this
->
getDataPost
(
'signature'
);
$this
->
forTest
=
$this
->
getDataPost
(
"test"
);
$this
->
ip
=
$this
->
getColumnData
(
$_SERVER
,
"REMOTE_ADDR"
);
$this
->
referer
=
$this
->
getColumnData
(
$_SERVER
,
"HTTP_REFERER"
);
...
...
@@ -196,6 +210,8 @@ class MoneyRequest extends System {
&&
(
$this
->
fromAccount
==
$this
->
toAccount
)){
$this
->
result
[
PARAM_RESULT
]
=
sprintf
(
'%02d'
,
VAL_INT_93
);
$this
->
result
[
PARAM_STATUS
]
=
"REJECTED"
;
$this
->
responseCode
=
406
;
}
else
{
// APIチェック用データ
// シグネチャ生成用のデータを取得する
...
...
@@ -218,6 +234,8 @@ class MoneyRequest extends System {
$this
->
result
[
PARAM_RESULT
]
=
sprintf
(
"%02d"
,
VAL_INT_90
);
$this
->
result
[
PARAM_STATUS
]
=
"REJECTED"
;
$this
->
responseCode
=
406
;
}
else
{
$this
->
randomSecondsDelay
();
...
...
@@ -235,12 +253,16 @@ class MoneyRequest extends System {
$this
->
result
[
PARAM_RESULT
]
=
$format
;
$this
->
result
[
PARAM_STATUS
]
=
"ERROR(CODE:
{
$format
}
)"
;
$this
->
responseCode
=
406
;
}
}
}
}
else
{
$this
->
result
[
PARAM_RESULT
]
=
sprintf
(
"%02d"
,
VAL_INT_92
);
$this
->
result
[
PARAM_STATUS
]
=
"REJECTED"
;
$this
->
responseCode
=
406
;
}
$this
->
logPost
(
$this
->
pnum
);
...
...
@@ -264,7 +286,9 @@ class MoneyRequest extends System {
$this
->
debitAmount
=
$this
->
getColumnData
(
$this
->
ctransfer
,
PARAM_AMOUNT
);
// 取引番号の生成
$this
->
transactionNum
=
$this
->
getTransactionNumberCommon
(
VAR_TRANSACTION_TRANSFER_DEPOSIT
);
$this
->
transactionNum
=
!
$this
->
forTest
?
$this
->
getTransactionNumberCommon
(
VAR_TRANSACTION_TRANSFER_DEPOSIT
)
:
"T01234567"
;
//to fee
$this
->
toFee
=
$this
->
currencyToInt
(
$this
->
getColumnData
(
$this
->
ctransfer
,
PARAM_TO_FEE
),
$this
->
currency
);
...
...
@@ -330,6 +354,8 @@ class MoneyRequest extends System {
}
private
function
printCallbackResult
(){
header
(
"HTTP/1.1
{
$this
->
responseCode
}
"
);
$this
->
accessModifyCommon
(
'INSERT_LOG_POST'
,
[
$this
->
ip
,
...
...
@@ -348,10 +374,7 @@ class MoneyRequest extends System {
echo
json_encode
(
$this
->
result
);
}
public
function
listen
(){
if
(
$this
->
proceedToRemittanceRequest
){
$params
=
$this
->
getTransactionalParams
();
private
function
actualProcessing
(
$params
){
$insertNewTransfer
=
$this
->
accessModify
(
'INSERT_TRANSFER'
,
$params
,
false
);
if
(
$insertNewTransfer
){
...
...
@@ -416,6 +439,8 @@ class MoneyRequest extends System {
$this
->
result
[
PARAM_RESULT
]
=
sprintf
(
"%02d"
,
VAL_INT_99
);
$this
->
result
[
PARAM_STATUS
]
=
"REJECTED"
;
$this
->
responseCode
=
406
;
$this
->
accessModifyCommon
(
"INSERT_LOG_POST"
,
[
$this
->
ip
,
...
...
@@ -426,6 +451,38 @@ class MoneyRequest extends System {
}
}
private
function
emulateProcessing
(
$params
){
$encodedParams
=
json_encode
(
$params
);
$this
->
accessModifyCommon
(
'INSERT_LOG_POST'
,
[
$this
->
ip
,
$this
->
pnum
,
$this
->
referer
,
"[TEST_INSERT_DB]
{
$encodedParams
}
"
]);
$this
->
result
[
PARAM_RESULT
]
=
sprintf
(
"%02d"
,
NO_COUNT
);
$this
->
result
[
PARAM_STATUS
]
=
"OK"
;
$this
->
result
[
PARAM_TRANSACTION_NUMBER
]
=
$params
[
VAL_INT_18
];
$this
->
result
[
PARAM_CURRENCY
]
=
$this
->
debitCurrency
;
$this
->
result
[
PARAM_AMOUNT
]
=
$this
->
debitAmount
;
$this
->
result
[
PARAM_FEE
]
=
$this
->
getColumnData
(
$this
->
ctransfer
,
PARAM_FROM_FEE
);
// this brings back memories - anton (2021)
$this
->
result
[
PARAM_FROM_ACCOUNT
]
=
$this
->
fromAccount
;
$this
->
result
[
PARAM_TO_ACCOUNT
]
=
$this
->
toAccount
;
}
public
function
listen
(){
if
(
$this
->
proceedToRemittanceRequest
){
$params
=
$this
->
getTransactionalParams
();
if
(
$this
->
forTest
)
$this
->
emulateProcessing
(
$params
);
else
$this
->
actualProcessing
(
$params
);
}
$this
->
printCallbackResult
();
}
}
...
...
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