Fix JSON payload parsing in payment server
This commit is contained in:
@@ -184,6 +184,17 @@ function authenticateJWT(bool $isReg = false): object
|
|||||||
|
|
||||||
|
|
||||||
function filterRequest($requestname, $type = 'string') {
|
function filterRequest($requestname, $type = 'string') {
|
||||||
|
// If $_POST is empty, try parsing JSON from php://input
|
||||||
|
if (empty($_POST)) {
|
||||||
|
$json = file_get_contents('php://input');
|
||||||
|
if (!empty($json)) {
|
||||||
|
$data = json_decode($json, true);
|
||||||
|
if (is_array($data)) {
|
||||||
|
$_POST = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_POST[$requestname]) && !empty($_POST[$requestname])) {
|
if (isset($_POST[$requestname]) && !empty($_POST[$requestname])) {
|
||||||
$value = trim($_POST[$requestname]);
|
$value = trim($_POST[$requestname]);
|
||||||
// Remove any control characters
|
// Remove any control characters
|
||||||
|
|||||||
@@ -11,7 +11,16 @@ try {
|
|||||||
$phone = filterRequest("phone");
|
$phone = filterRequest("phone");
|
||||||
|
|
||||||
if (empty($userId) || empty($userType) || !is_numeric($amount) || $amount <= 0 || empty($cliqPhone)) {
|
if (empty($userId) || empty($userType) || !is_numeric($amount) || $amount <= 0 || empty($cliqPhone)) {
|
||||||
echo json_encode(["status" => "failure", "message" => "Invalid input provided."]);
|
echo json_encode([
|
||||||
|
"status" => "failure",
|
||||||
|
"message" => "Invalid input provided.",
|
||||||
|
"debug" => [
|
||||||
|
"userId" => $userId,
|
||||||
|
"userType" => $userType,
|
||||||
|
"amount" => $amount,
|
||||||
|
"cliqPhone" => $cliqPhone
|
||||||
|
]
|
||||||
|
]);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class AppLink {
|
|||||||
case 'Egypt':
|
case 'Egypt':
|
||||||
return 'https://wallet-egypt.siromove.com/v1/main';
|
return 'https://wallet-egypt.siromove.com/v1/main';
|
||||||
case 'Jordan':
|
case 'Jordan':
|
||||||
return 'https://walletintaleq.intaleq.xyz/v2/main';
|
return 'https://jordan-siro.intaleqapp.com/v2/main';
|
||||||
default:
|
default:
|
||||||
return 'https://wallet.siromove.com/v1/main';
|
return 'https://wallet.siromove.com/v1/main';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class AppLink {
|
|||||||
case 'Egypt':
|
case 'Egypt':
|
||||||
return 'https://wallet-egypt.siromove.com/v1/main';
|
return 'https://wallet-egypt.siromove.com/v1/main';
|
||||||
case 'Jordan':
|
case 'Jordan':
|
||||||
return 'https://walletintaleq.intaleq.xyz/v2/main';
|
return 'https://jordan-siro.intaleqapp.com/v2/main';
|
||||||
default:
|
default:
|
||||||
return 'https://wallet.siromove.com/v1/main';
|
return 'https://wallet.siromove.com/v1/main';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user