feat: refactor cart item handling to use mapped buyable types and improve method signatures
This commit is contained in:
@@ -138,11 +138,11 @@ class CheckoutService
|
||||
}
|
||||
|
||||
// Check tenant relation depending on type
|
||||
if ($item->buyable_type === 'variant' && $buyable->product->tenant_codigo !== $tenant->codigo) {
|
||||
if ($item->buyable_type === \App\Domains\Catalog\Models\ProductVariant::class && $buyable->product->tenant_codigo !== $tenant->codigo) {
|
||||
throw ValidationException::withMessages([
|
||||
'cart_id' => 'One or more product variants do not belong to the tenant.',
|
||||
]);
|
||||
} elseif ($item->buyable_type === 'bundle' && $buyable->tenant_codigo !== $tenant->codigo) {
|
||||
} elseif ($item->buyable_type === \App\Domains\Bundle\Models\Bundle::class && $buyable->tenant_codigo !== $tenant->codigo) {
|
||||
throw ValidationException::withMessages([
|
||||
'cart_id' => 'One or more bundles do not belong to the tenant.',
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user