<?php
 namespace App\Services\Tracking; use App\Models\Invoice; class InvoiceItemMapper { public static function toTrackingContents(Invoice $invoice): array { $items = $invoice->items; if (!$items) return []; return $items->map(function ($item) { return [ 'id' => (string) ($item->item_id ?? $item->id), 'quantity' => (int) ($item->quantity ?? 1), 'item_price' => (float) ($item->amount ?? 0), ]; })->values()->all(); } } 