feat(purchase): update direct item handling to support multiple items in checkout
This commit is contained in:
@@ -19,29 +19,21 @@ class StartCheckoutRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
'cart_id' => [
|
||||
'required_without:direct_item',
|
||||
Rule::prohibitedIf(fn (): bool => $this->has('direct_item')),
|
||||
'required_without:direct_items',
|
||||
Rule::prohibitedIf(fn (): bool => $this->has('direct_items')),
|
||||
'integer',
|
||||
'exists:carritos,id',
|
||||
],
|
||||
'direct_item' => [
|
||||
'direct_items' => [
|
||||
'required_without:cart_id',
|
||||
Rule::prohibitedIf(fn (): bool => $this->has('cart_id')),
|
||||
'array',
|
||||
],
|
||||
'direct_item.catalog_item_id' => [
|
||||
'required_with:direct_item',
|
||||
'integer',
|
||||
],
|
||||
'direct_item.variant_id' => [
|
||||
'nullable',
|
||||
'integer',
|
||||
],
|
||||
'direct_item.cantidad' => [
|
||||
'required_with:direct_item',
|
||||
'integer',
|
||||
'min:1',
|
||||
],
|
||||
'direct_items.*' => ['required', 'array'],
|
||||
'direct_items.*.catalog_item_id' => ['required', 'integer'],
|
||||
'direct_items.*.variant_id' => ['nullable', 'integer'],
|
||||
'direct_items.*.cantidad' => ['required', 'integer', 'min:1'],
|
||||
'dni' => ['prohibited'],
|
||||
'telefono' => ['prohibited'],
|
||||
'nombre_apellido' => ['prohibited'],
|
||||
|
||||
Reference in New Issue
Block a user