Update: 2026-06-18 16:46:30

This commit is contained in:
Hamza-Ayed
2026-06-18 16:46:30 +03:00
parent 8b52d2f115
commit f13faa8c31
12 changed files with 693 additions and 169 deletions

View File

@@ -11,6 +11,7 @@ try {
$userType = filterRequest("user_type"); // 'driver' أو 'passenger'
$amount = filterRequest("amount");
$mtnPhone = filterRequest("mtn_phone");
$phone = filterRequest("phone");
if (empty($userId) || empty($userType) || !is_numeric($amount) || $amount <= 0 || empty($mtnPhone)) {
echo json_encode(["status" => "failure", "message" => "Invalid input provided."]);
@@ -43,12 +44,14 @@ try {
$upd = $con->prepare("
UPDATE mtn_invoices
SET amount = :amount,
phone = :phone,
mtn_phone = :mtn_phone,
updated_at = NOW()
WHERE id = :id
");
$upd->execute([
':amount' => $amount,
':phone' => $phone ?: null,
':mtn_phone'=> $mtnPhone,
':id' => $existing['id'],
]);
@@ -67,14 +70,15 @@ try {
$ins = $con->prepare("
INSERT INTO mtn_invoices
(invoice_number, user_id, user_type, amount, mtn_phone, status, created_at, updated_at)
(invoice_number, user_id, user_type, phone, amount, mtn_phone, status, created_at, updated_at)
VALUES
(:invoice_number, :user_id, :user_type, :amount, :mtn_phone, 'pending', NOW(), NOW())
(:invoice_number, :user_id, :user_type, :phone, :amount, :mtn_phone, 'pending', NOW(), NOW())
");
$ins->execute([
':invoice_number' => $invoiceNumber,
':user_id' => $userId,
':user_type' => $userType,
':phone' => $phone ?: null,
':amount' => $amount,
':mtn_phone' => $mtnPhone
]);