feat(addons): finalize event addon catalog and ai styling upgrade flow
This commit is contained in:
@@ -41,4 +41,27 @@ class PackageAddon extends Model
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
public function resolvePaypalPrice(): ?float
|
||||
{
|
||||
$metadata = is_array($this->metadata) ? $this->metadata : [];
|
||||
$price = $metadata['price_eur'] ?? null;
|
||||
|
||||
return is_numeric($price) ? (float) $price : null;
|
||||
}
|
||||
|
||||
public function isSellableForProvider(?string $provider = null): bool
|
||||
{
|
||||
$provider = strtolower((string) ($provider ?? config('package-addons.provider') ?? config('checkout.default_provider', 'paypal')));
|
||||
|
||||
if (! $this->active) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($provider === 'lemonsqueezy') {
|
||||
return filled($this->variant_id);
|
||||
}
|
||||
|
||||
return $this->resolvePaypalPrice() !== null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user