feat: Implement payment proof upload for orders, add payment method selection API, and seed bank transfer payment options.

This commit is contained in:
pbao9
2026-03-11 16:57:26 +07:00
parent 74cbe2fe1a
commit 7f6264c87f
19 changed files with 706 additions and 49 deletions
+59 -5
View File
@@ -10,17 +10,71 @@ class OrderResource extends JsonResource
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'id' => $this->id,
'order_num' => $this->order_num,
'customer' => $this->whenLoaded('customer', fn() => [
'customer' => $this->whenLoaded('customer', fn() => [
'id' => $this->customer->id,
'fullname' => $this->customer->fullname,
'email' => $this->customer->email,
'phone' => $this->customer->phone ?? null,
]),
'amount' => $this->amount,
'status' => $this->status,
'date' => $this->date,
'user' => $this->whenLoaded('user', fn() => [
'id' => $this->user->id,
'firstname' => $this->user->firstname,
'lastname' => $this->user->lastname,
'email' => $this->user->email,
]),
'payment' => $this->whenLoaded('payment', fn() => [
'id' => $this->payment->id,
'name' => $this->payment->name,
'type' => $this->payment->type,
]),
'discount' => $this->whenLoaded('discount', fn() => [
'id' => $this->discount->id,
'code' => $this->discount->code,
'value' => $this->discount->value,
]),
'invoice' => $this->whenLoaded('invoice', fn() => [
'id' => $this->invoice->id,
'order_num' => $this->invoice->order_num,
'sub_total' => $this->invoice->sub_total,
'tax' => $this->invoice->tax,
'total' => $this->invoice->total,
'status' => $this->invoice->status,
'date' => $this->invoice->date,
'due_date' => $this->invoice->due_date,
'date_paid' => $this->invoice->date_paid,
]),
'amount' => $this->amount,
'payment_method' => $this->whenLoaded('payment', fn() => $this->payment->name),
'payment_proof' => $this->payment_proof,
'note' => $this->note,
'client_ip' => $this->client_ip,
'status' => $this->status,
'date' => $this->date,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'order_items' => $this->whenLoaded('orderItems', fn() => $this->orderItems->map(function ($item) {
return [
'id' => $item->id,
'product' => $item->product ? [
'id' => $item->product->id,
'name' => $item->product->name,
'product_type' => $item->product->product_type,
] : null,
'os' => $item->os ? [
'id' => $item->os->id,
'name' => $item->os->name,
'version' => $item->os->version,
] : null,
'billing_cycle' => $item->billing_cycle,
'months' => $item->months,
'expiry_date' => $item->expiry_date,
'quantity' => $item->quantity,
'server_name' => $item->server_name,
'price' => $item->price,
];
})),
];
}
}