Update: 2026-07-02 15:35:12

This commit is contained in:
Hamza-Ayed
2026-07-02 15:35:12 +03:00
parent 2adf195b36
commit 75e6fc42d7
17 changed files with 389 additions and 19 deletions
@@ -42,6 +42,8 @@ $paymentAmount = filterRequest("paymentAmount");
$paymentMethod = filterRequest("paymentMethod");
$walletChecked = filterRequest("walletChecked"); // 'true' or 'false'
$authToken = filterRequest("authToken"); // kept for logging/audit, not used for auth
$is_zero_commission = filterRequest("is_zero_commission"); // 'true' or 'false'
$kazanPercent = filterRequest("kazanPercent"); // dynamic commission rate
// --- Validate required fields ---
if (empty($rideId) || empty($driverId) || empty($passengerId) ||
@@ -134,8 +136,17 @@ try {
}
}
// 3d. Deduct driver points (8% of payment amount)
$pointsSubtraction = floatval($paymentAmount) * (-0.08);
// 3d. Deduct driver points (dynamic commission rate)
$commissionRate = 0.08; // default fallback 8%
if (isset($kazanPercent) && is_numeric($kazanPercent)) {
$commissionRate = floatval($kazanPercent) / 100;
}
$pointsSubtraction = floatval($paymentAmount) * (-$commissionRate);
if ($is_zero_commission === 'true') {
$pointsSubtraction = 0; // 🆕 لا نخصم عمولة أبداً لأن السائق لديه تتابع نشط
}
$stmtDriverPoints = $con->prepare(
"INSERT INTO `driverWallet` (`driverID`, `paymentID`, `amount`, `paymentMethod`)
VALUES (:driverID, :paymentID, :amount, :paymentMethod)"