feat: implement VMware vCenter integration, enhance product pricing display, and update order processing logic.

This commit is contained in:
pbao9
2026-03-01 23:10:35 +07:00
parent 6b18c3ff12
commit 1cfcaee871
27 changed files with 1738 additions and 104 deletions
@@ -1,9 +1,14 @@
<?php
namespace App\Http\Controllers\Api\Service;
class PaymentController
use App\Http\Controllers\Controller;
use App\Jobs\VirtualMachine\ProcessOrderPaymentJob;
use App\Models\Order;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class PaymentController extends Controller
{
/**
* Thanh toán order bằng credit
@@ -32,15 +37,15 @@ class PaymentController
], 400);
}
// Kiểm tra credit
if ($customer->credit < $order->amount) {
// Kiểm tra số dư tài khoản (total)
if ($customer->total < $order->amount) {
return response()->json([
'error' => true,
'message' => 'Số dư không đủ để thanh toán',
'data' => [
'required' => $order->amount,
'current_credit' => $customer->credit,
'shortage' => $order->amount - $customer->credit
'current_total' => $customer->total,
'shortage' => $order->amount - $customer->total
]
], 400);
}
@@ -51,6 +56,7 @@ class PaymentController
return response()->json([
'error' => false,
'message' => 'Đơn hàng đang được xử lý. Bạn sẽ nhận được thông báo khi hoàn tất.',
'notice' => 'Dịch vụ VPS sẽ được khởi tạo trong vòng 5-10 phút. Vui lòng đợi trong giây lát.',
'data' => [
'order_id' => $order->id,
'order_num' => $order->order_num,
@@ -65,4 +71,4 @@ class PaymentController
], 500);
}
}
}
}