Update: 2026-06-18 16:46:30
This commit is contained in:
@@ -8,6 +8,7 @@ try {
|
||||
$userType = filterRequest("user_type");
|
||||
$amount = filterRequest("amount");
|
||||
$cliqPhone = filterRequest("cliq_phone");
|
||||
$phone = filterRequest("phone");
|
||||
|
||||
if (empty($userId) || empty($userType) || !is_numeric($amount) || $amount <= 0 || empty($cliqPhone)) {
|
||||
echo json_encode(["status" => "failure", "message" => "Invalid input provided."]);
|
||||
@@ -36,12 +37,14 @@ try {
|
||||
$upd = $con->prepare("
|
||||
UPDATE cliq_invoices
|
||||
SET amount = :amount,
|
||||
phone = :phone,
|
||||
cliq_phone = :cliq_phone,
|
||||
updated_at = NOW()
|
||||
WHERE id = :id
|
||||
");
|
||||
$upd->execute([
|
||||
':amount' => $amount,
|
||||
':phone' => $phone ?: null,
|
||||
':cliq_phone' => $cliqPhone,
|
||||
':id' => $existing['id'],
|
||||
]);
|
||||
@@ -59,14 +62,15 @@ try {
|
||||
|
||||
$ins = $con->prepare("
|
||||
INSERT INTO cliq_invoices
|
||||
(invoice_number, user_id, user_type, amount, cliq_phone, status, created_at, updated_at)
|
||||
(invoice_number, user_id, user_type, phone, amount, cliq_phone, status, created_at, updated_at)
|
||||
VALUES
|
||||
(:invoice_number, :user_id, :user_type, :amount, :cliq_phone, 'pending', NOW(), NOW())
|
||||
(:invoice_number, :user_id, :user_type, :phone, :amount, :cliq_phone, 'pending', NOW(), NOW())
|
||||
");
|
||||
$ins->execute([
|
||||
':invoice_number' => $invoiceNumber,
|
||||
':user_id' => $userId,
|
||||
':user_type' => $userType,
|
||||
':phone' => $phone ?: null,
|
||||
':amount' => $amount,
|
||||
':cliq_phone' => $cliqPhone
|
||||
]);
|
||||
|
||||
@@ -14,7 +14,7 @@ function finalizeClickPayment(PDO $con, int $invoiceId): array
|
||||
{
|
||||
try {
|
||||
// جلب تفاصيل الفاتورة
|
||||
$stmt = $con->prepare("SELECT * FROM `click_invoices` WHERE id = :id AND status = 'completed' LIMIT 1");
|
||||
$stmt = $con->prepare("SELECT * FROM `cliq_invoices` WHERE id = :id AND status = 'completed' LIMIT 1");
|
||||
$stmt->execute([':id' => $invoiceId]);
|
||||
$invoice = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user