feat: add display_cart_item_images feature to tenants and update related resources

This commit is contained in:
2026-08-18 16:46:45 -03:00
parent 817d0de6d2
commit 8e26611097
13 changed files with 136 additions and 5 deletions

View File

@@ -847,6 +847,30 @@ class StorePurchaseTest extends TestCase
->assertJsonPath('data.total', '100.00');
}
public function test_purchase_detail_filters_item_images_when_the_tenant_disables_them(): void
{
$tenant = $this->createTenant('sonder', 'Sonder', 'sonder.com.ar');
$tenant->update(['display_cart_item_images' => false]);
$user = User::factory()->create([
'email' => 'buyer@example.com',
]);
$variant = $this->createVariantForTenant('sonder', 10, '50.00');
$purchase = $this->createCheckoutPurchase($user, 'sonder', $variant, 2);
$image = Attachment::create([
'key' => (string) Str::uuid(),
'path' => 'catalog/purchase-item.png',
'filename' => 'purchase-item.png',
'type' => AttachmentType::Image,
'mime_type' => 'image/png',
]);
$purchase->items()->firstOrFail()->update(['image_attachment_id' => $image->id]);
$this->actingAs($user, 'sanctum')
->getJson("/api/tenants/sonder/compras/{$purchase->id}")
->assertOk()
->assertJsonPath('data.items.0.item_details.imagen', null);
}
public function test_purchase_detail_uses_purchase_items_for_pending_payment_purchase(): void
{
$this->createTenant('sonder', 'Sonder', 'sonder.com.ar');