discountPercent > 0; } /** * Check if free. */ public function isFree(): bool { return $this->final <= 0; } /** * Get savings amount. */ public function getSavings(): float { return max(0, $this->initial - $this->final); } /** * Get formatted display price. */ public function getDisplayPrice(): string { if ($this->formattedPrice !== null) { return $this->formattedPrice; } if ($this->isFree()) { return 'Free'; } return sprintf('%s %.2f', $this->currency, $this->final); } /** * Convert to array. */ public function toArray(): array { return [ 'currency' => $this->currency, 'initial' => $this->initial, 'final' => $this->final, 'discount_percent' => $this->discountPercent, 'formatted' => $this->formattedPrice, ]; } }