added zarbox list

This commit is contained in:
2026-06-09 19:58:48 +03:30
parent b5c2b2be72
commit ae9ba34ca8
3 changed files with 41 additions and 0 deletions
+28
View File
@@ -167,6 +167,34 @@ class ZaarboxPriceService
}
}
/**
* @return array<int, array{key: string, name: string, id: string, category: string, active: bool}>
*/
public function listProductOptions(): array
{
$prices = $this->fetchPriceList();
if ($prices === null) {
return [];
}
return collect($prices)
->map(function ($row) {
$row = is_array($row) ? $row : (array) $row;
return [
'key' => trim((string) ($row['key'] ?? '')),
'name' => trim((string) ($row['name'] ?? '')),
'id' => trim((string) ($row['id'] ?? '')),
'category' => trim((string) ($row['category'] ?? '')),
'active' => (bool) ($row['active'] ?? false),
];
})
->filter(fn (array $row) => $row['key'] !== '')
->sortBy('name', SORT_NATURAL | SORT_FLAG_CASE)
->values()
->all();
}
/**
* @return array{order_price: int, raw: array<string, mixed>|null}
*/