feat: Enhance service management and transaction handling
- Implemented client access token verification middleware to secure API endpoints. - Updated ServiceController to fetch active hosting services for authenticated users. - Refactored OrderController to ensure order retrieval is customer-specific. - Improved error logging in VmController for unexpected vCenter responses. - Disabled VNPay auto-deposit in TransactionController, switching to manual deposit flow. - Enhanced ServiceClientDetailResource to include Plesk credentials for hosting accounts. - Adjusted VpsServiceResource to dynamically set page type based on product type. - Added logging for PowerShellService to capture errors in RDP port changes. - Provisioning job now resolves service plans and logs relevant information for hosting accounts. - Updated database migrations to add necessary fields for service plans and DNS servers. - Refactored Service and ServicePlan models to establish relationships with hosting accounts and DNS servers.
This commit is contained in:
@@ -128,13 +128,14 @@ class OrderControllerRefactor extends Controller
|
||||
|
||||
public function retryOrderProvisioning(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$order = $this->orderRepository->find($id);
|
||||
$customerId = (int) $request->user()->id;
|
||||
$order = $this->orderRepository->findForCustomer($id, $customerId);
|
||||
|
||||
if (! $order) {
|
||||
return response()->json(['success' => false, 'message' => 'Đơn hàng không tồn tại.'], 404);
|
||||
}
|
||||
|
||||
$result = $this->orderQueryService->retryProvisioning($order, (int) $request->user()->id);
|
||||
$result = $this->orderQueryService->retryProvisioning($order, $customerId);
|
||||
|
||||
if (! $result['ok']) {
|
||||
return response()->json(['success' => false, 'message' => $result['message']], $result['code']);
|
||||
|
||||
@@ -262,10 +262,14 @@ class VmController extends Controller
|
||||
], $ok ? 200 : 400);
|
||||
}
|
||||
|
||||
\Illuminate\Support\Facades\Log::error('changePort: unexpected vCenter response', [
|
||||
'vm_id' => $vm->id,
|
||||
'result' => $result,
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Phản hồi không hợp lệ từ vCenter.',
|
||||
'data' => ['raw' => $result],
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -280,9 +284,9 @@ class VmController extends Controller
|
||||
return response()->json(['error' => true, 'message' => 'Please choose product']);
|
||||
}
|
||||
|
||||
$vm = ModuleVmware::with('vCenter')->find((int) $productId);
|
||||
if (!$vm) {
|
||||
return response()->json(['error' => true, 'message' => "Can't find product"]);
|
||||
$vm = $this->resolveVmById($productId, $request);
|
||||
if ($vm instanceof JsonResponse) {
|
||||
return $vm;
|
||||
}
|
||||
|
||||
$result = $this->getConsoleTicket($serviceVCenter, $vm);
|
||||
|
||||
Reference in New Issue
Block a user