feat(cart): implement cart editing policies and update related functionality

This commit is contained in:
2026-08-19 10:15:37 -03:00
parent 67e6211857
commit 014b5bb012
20 changed files with 305 additions and 39 deletions

View File

@@ -73,7 +73,7 @@ class BootstrapTenantControllerTest extends TestCase
'display_categories' => false,
'display_seach_bar' => false,
'display_cart' => false,
'cart_editing_enabled' => false,
'cart_editing_policy' => 'disabled',
'display_cart_item_images' => false,
]);
@@ -91,7 +91,11 @@ class BootstrapTenantControllerTest extends TestCase
->assertJsonPath('data.display_categories', false)
->assertJsonPath('data.display_seach_bar', false)
->assertJsonPath('data.display_cart', false)
->assertJsonPath('data.cart_editing_enabled', false)
->assertJsonPath('data.cart_editing_policy.code', 'disabled')
->assertJsonPath('data.cart_editing_policy.allow_modify', false)
->assertJsonPath('data.cart_editing_policy.allow_delete', false)
->assertJsonPath('data.cart_editing_policy.allow_update_quantity', false)
->assertJsonPath('data.cart_editing_policy.allow_update_variant', false)
->assertJsonPath('data.display_cart_item_images', false)
->assertJsonPath('data.header_bg_color', '#ffffff')->assertJsonPath('data.footer_bg_color', '#ffffff');
@@ -758,7 +762,7 @@ class BootstrapTenantControllerTest extends TestCase
$response = $this->putJson("/api/tenants/{$tenant->codigo}", [
'primary_color' => '#000000',
'cart_editing_enabled' => false,
'cart_editing_policy' => 'quantity_and_remove',
'display_cart_item_images' => false,
]);
@@ -767,7 +771,11 @@ class BootstrapTenantControllerTest extends TestCase
->assertJsonPath('data.codigo', 'acme')
->assertJsonPath('data.nombre', 'Acme')
->assertJsonPath('data.primary_color', '#000000')
->assertJsonPath('data.cart_editing_enabled', false)
->assertJsonPath('data.cart_editing_policy.code', 'quantity_and_remove')
->assertJsonPath('data.cart_editing_policy.allow_modify', true)
->assertJsonPath('data.cart_editing_policy.allow_delete', true)
->assertJsonPath('data.cart_editing_policy.allow_update_quantity', true)
->assertJsonPath('data.cart_editing_policy.allow_update_variant', false)
->assertJsonPath('data.display_cart_item_images', false);
$this->assertDatabaseHas('tenants', [
@@ -775,7 +783,7 @@ class BootstrapTenantControllerTest extends TestCase
'codigo' => 'acme',
'nombre' => 'Acme',
'primary_color' => '#000000',
'cart_editing_enabled' => false,
'cart_editing_policy' => 'quantity_and_remove',
'display_cart_item_images' => false,
]);
}