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
0190fb92
Commit
0190fb92
authored
Mar 31, 2022
by
Antonio.Suerte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dynamic Payment API Error Code Formatting
parent
130b2df7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
16 deletions
+25
-16
Settle.php
api/mids/Settle.php
+25
-16
No files found.
api/mids/Settle.php
View file @
0190fb92
...
...
@@ -164,41 +164,41 @@ class Settle extends System {
$this
->
logDetails
(
print_r
(
$accessArray
,
true
));
if
(
strcasecmp
(
$this
->
requestType
,
"POST"
)
!==
0
){
$this
->
invalid
[]
=
"Invalid Request Type [
{
$this
->
requestType
}
]"
;
$this
->
invalid
[
"DERR1"
]
=
"Invalid Request Type [
{
$this
->
requestType
}
]"
;
}
if
(
$this
->
contentType
!=
"application/json"
){
$this
->
invalid
[]
=
"Invalid Content Type [
{
$this
->
contentType
}
]"
;
$this
->
invalid
[
"DERR2"
]
=
"Invalid Content Type [
{
$this
->
contentType
}
]"
;
}
if
(
$this
->
checkJSONString
(
$this
->
payload
)){
if
(
$this
->
currency
!=
NO_STRING
){
if
(
!
$this
->
checkCurrency
(
strtoupper
(
$this
->
currency
)))
$this
->
invalid
[]
=
"Invalid Currency [
{
$this
->
currency
}
]"
;
$this
->
invalid
[
"DERR3"
]
=
"Invalid Currency [
{
$this
->
currency
}
]"
;
}
else
$this
->
invalid
[]
=
"Currency is required"
;
$this
->
invalid
[
"DERR4"
]
=
"Currency is required"
;
if
(
$this
->
amount
!=
NO_STRING
){
if
(
$this
->
amount
==
NO_COUNT
){
$this
->
invalid
[]
=
"Amount cannot be 0"
;
$this
->
invalid
[
"DERR5"
]
=
"Amount cannot be 0"
;
}
if
(
!
$this
->
checkStringNumber
(
$this
->
amount
)){
$this
->
invalid
[]
=
"Invalid Inputted Amount."
;
$this
->
invalid
[
"DERR6"
]
=
"Invalid Inputted Amount."
;
}
}
else
$this
->
invalid
[]
=
"Amount is required"
;
$this
->
invalid
[
"DERR7"
]
=
"Amount is required"
;
if
(
$this
->
language
!=
NO_STRING
){
$languages
=
[
"en"
,
"ja"
,
"tc"
,
"sc"
,
"id"
];
$this
->
language
=
strtolower
(
$this
->
language
);
if
(
!
in_array
(
$this
->
language
,
$languages
)){
$this
->
invalid
[]
=
"The Settlement Feature is not available to the language you've specified. [
{
$this
->
language
}
]"
;
$this
->
invalid
[
"DERR8"
]
=
"The Settlement Feature is not available to the language you've specified. [
{
$this
->
language
}
]"
;
}
}
else
$this
->
invalid
[]
=
"Language is required"
;
$this
->
invalid
[
"DERR9"
]
=
"Language is required"
;
if
(
$this
->
pnum
!=
NO_STRING
){
$apiSignature
=
$this
->
getRowData
(
$this
->
getAPISignatureCommon
(
$this
->
pnum
));
...
...
@@ -210,7 +210,7 @@ class Settle extends System {
$this
->
pnum
,
$this
->
signature
,
$userAccount
)){
$this
->
invalid
[]
=
"Invalid Settlement Signature"
;
$this
->
invalid
[
"DERR10"
]
=
"Invalid Settlement Signature"
;
}
$wlistSettings
=
$this
->
getColumnData
(
$apiSignature
,
COLUMN_WHITELIST_SETTING
);
...
...
@@ -222,25 +222,34 @@ class Settle extends System {
$ipAddresses
=
explode
(
","
,
$this
->
getColumnData
(
$apiSignature
,
"ip_address"
));
if
(
!
in_array
(
$this
->
ipAddress
,
$ipAddresses
))
$this
->
invalid
[]
=
"Invalid IP Address [
{
$this
->
ipAddress
}
]"
;
$this
->
invalid
[
"DERR11"
]
=
"Invalid IP Address [
{
$this
->
ipAddress
}
]"
;
}
if
(
!
$this
->
getColumnData
(
$wlistSettings
,
"allow_curl_in_payment"
)){
$this
->
invalid
[]
=
"Authentication Denied for this Program Code."
;
$this
->
invalid
[
"DERR12"
]
=
"Authentication Denied for this Program Code."
;
}
}
}
else
$this
->
invalid
[]
=
"Invalid Program Code"
;
$this
->
invalid
[
"DERR13"
]
=
"Invalid Program Code"
;
}
else
$this
->
invalid
[]
=
"Program Code is required"
;
$this
->
invalid
[
"DERR14"
]
=
"Program Code is required"
;
}
else
$this
->
invalid
[]
=
"Invalid Payload Format"
;
$this
->
invalid
[
"DERR15"
]
=
"Invalid Payload Format"
;
if
(
$this
->
isLoopData
(
$this
->
invalid
)){
$this
->
logDetails
(
"Settlement Request Denied: "
.
print_r
(
$this
->
invalid
,
true
));
header
(
"HTTP/1.1 401 Unauthenticated"
);
die
(
print_r
(
$this
->
invalid
,
true
));
$errorTraces
=
[];
foreach
(
$this
->
invalid
as
$errcode
=>
$description
){
$errorTraces
[]
=
[
"errcode"
=>
$errcode
,
"description"
=>
$description
];
}
die
(
json_encode
(
$errorTraces
));
}
}
...
...
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