38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Modules\Integration\Requests;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
class SyncVendingOrderRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine if the user is authorized to make this request.
|
||
|
|
*/
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 販賣機訂單同步的驗證規則
|
||
|
|
*
|
||
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||
|
|
*/
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'external_order_id' => 'required|string',
|
||
|
|
'machine_id' => 'nullable|string',
|
||
|
|
'warehouse' => 'nullable|string',
|
||
|
|
'warehouse_id' => 'nullable|integer',
|
||
|
|
'payment_method' => 'nullable|string|in:cash,electronic,line_pay,other',
|
||
|
|
'sold_at' => 'nullable|date',
|
||
|
|
'items' => 'required|array|min:1',
|
||
|
|
'items.*.product_code' => 'required|string', // 使用 ERP 商品代碼
|
||
|
|
'items.*.qty' => 'required|numeric|min:0.0001',
|
||
|
|
'items.*.price' => 'required|numeric|min:0',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|