Files
portal-api/app/Http/Resources/Api/Service/Order/OrderItemResource.php
baodev0andClaude Sonnet 5.5 b44a88bb52 feat(service): huỷ dịch vụ, SSL, đổi mật khẩu hosting, lịch sử thanh toán theo hình thức
- Lịch sử thanh toán hoá đơn trả thêm `method` (tự động gia hạn / số dư / admin / chuyển khoản / hoàn tiền), bỏ đuôi `(method)` khỏi ghi chú
- `DnsServer::panelUrl()` = https://<domain>/ dùng cho email cấp hosting và nút Plesk của khách
- Order item trả thêm `uuid`/`type` của dịch vụ để FE dẫn tới trang quản lý
- Yêu cầu huỷ dịch vụ, chứng chỉ SSL, lịch sử gia hạn, đổi mật khẩu hosting cho khách

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 16:40:24 +07:00

43 lines
1.6 KiB
PHP

<?php
namespace App\Http\Resources\Api\Service\Order;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class OrderItemResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'billing_cycle' => $this->billing_cycle,
'months' => $this->months,
'server_name' => $this->server_name,
'os_id' => $this->os_id,
'price' => (float) $this->price,
'service' => $this->whenLoaded('service', fn () => [
'id' => $this->service->id,
'uuid' => $this->service->uuid,
'type' => $this->service->type,
'status' => $this->service->status,
'status_text' => $this->service->status_label,
'retry_requested_at' => $this->service->retry_requested_at?->toISOString(),
'can_retry_provisioning' => $this->service->status === 'pending' && ! $this->service->retry_requested_at,
]),
'product' => $this->whenLoaded('product', fn () => [
'id' => $this->product->id,
'uuid' => $this->product->uuid,
'name' => $this->product->name,
'product_type' => $this->product->product_type,
'specs' => [
'cpu' => $this->product->cpu,
'ram' => $this->product->ram,
'disk' => $this->product->disk,
'bandwidth' => $this->product->bandwidth,
],
]),
];
}
}