> */ public function forAmount(float $basePrice): array { $tiers = [[ 'label' => 'Базовая цена', 'min_order_amount' => 0.0, 'discount_percent' => 0.0, 'price' => round($basePrice, 2), 'note' => 'Без промокода', ]]; foreach ($this->repository()->priceTiers() as $promocode) { $discount = (float) $promocode['discount_value']; $tiers[] = [ 'label' => $promocode['price_tier_label'] ?: $promocode['title'], 'code' => $promocode['code'], 'min_order_amount' => (float) $promocode['min_order_amount'], 'discount_percent' => $discount, 'price' => round($basePrice * (100 - $discount) / 100, 2), 'note' => $promocode['payment_note'], ]; } return $tiers; } private function repository(): PromocodeRepository { return $this->promocodes ?? new PromocodeRepository(); } }