refactor(pricing): dynamic payment provider buttons with database-driven text
- Replace hardcoded provider-specific buttons with dynamic database-driven approach
- Update getPlanProviders() to include display_name from payment_providers table
- Simplify plan-card.blade.php with single if/else logic for all providers
- Move trial button outside loop and comment for future implementation
- Use "Pay with {display_name}" pattern for consistent button text
- Maintain special handling for activation_key provider with disabled state
This commit is contained in:
@@ -166,7 +166,9 @@ class Pricing extends Component
|
||||
->join('payment_providers', 'plan_providers.provider', '=', 'payment_providers.name')
|
||||
->where('payment_providers.is_active', true)
|
||||
->orderBy('plan_providers.sort_order')
|
||||
->pluck('plan_providers.provider')
|
||||
->select('plan_providers.provider', 'payment_providers.display_name')
|
||||
->get()
|
||||
->keyBy('provider')
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
@@ -111,35 +111,21 @@
|
||||
|
||||
<!-- Payment Provider Buttons -->
|
||||
<div class="mt-6 space-y-2">
|
||||
@foreach($providers as $provider)
|
||||
@if($provider === 'stripe')
|
||||
@if($hasTrial && $trialConfig)
|
||||
<flux:button variant="primary" class="w-full" wire:click="startTrial({{ $plan->id }}, '{{ $provider }}')">
|
||||
Start Free Trial
|
||||
</flux:button>
|
||||
@endif
|
||||
<flux:button variant="{{ $hasTrial && $trialConfig ? 'outline' : 'primary' }}" class="w-full" wire:click="choosePlan({{ $plan->id }}, '{{ $provider }}')">
|
||||
Pay with Card
|
||||
</flux:button>
|
||||
@elseif($provider === 'lemon_squeezy')
|
||||
<flux:button variant="filled" class="w-full" wire:click="choosePlan({{ $plan->id }}, '{{ $provider }}')">
|
||||
Pay with Lemon Squeezy
|
||||
</flux:button>
|
||||
@elseif($provider === 'polar')
|
||||
<flux:button variant="filled" class="w-full" wire:click="choosePlan({{ $plan->id }}, '{{ $provider }}')">
|
||||
Pay with Polar.sh
|
||||
</flux:button>
|
||||
@elseif($provider === 'oxapay')
|
||||
<flux:button variant="filled" class="w-full" wire:click="choosePlan({{ $plan->id }}, '{{ $provider }}')">
|
||||
Pay with OxaPay
|
||||
</flux:button>
|
||||
@elseif($provider === 'crypto')
|
||||
<flux:button variant="filled" class="w-full" wire:click="choosePlan({{ $plan->id }}, '{{ $provider }}')">
|
||||
Pay with Crypto
|
||||
</flux:button>
|
||||
@elseif($provider === 'activation_key')
|
||||
<!-- TODO: Implement trial features in future - uncomment when trial logic is ready -->
|
||||
{{-- @if($hasTrial && $trialConfig)
|
||||
<flux:button variant="primary" class="w-full" wire:click="startTrial({{ $plan->id }}, 'stripe')">
|
||||
Start Free Trial
|
||||
</flux:button>
|
||||
@endif --}}
|
||||
|
||||
@foreach($providers as $providerName => $providerData)
|
||||
@if($providerName === 'activation_key')
|
||||
<flux:button variant="outline" class="w-full" disabled>
|
||||
Activate via Activation Key
|
||||
{{ 'Activate via '. $providerData['display_name'] ?? 'Activate via Activation Key' }}
|
||||
</flux:button>
|
||||
@else
|
||||
<flux:button variant="primary" class="w-full cursor-pointer" wire:click="choosePlan({{ $plan->id }}, '{{ $providerName }}')">
|
||||
Pay with {{ $providerData['display_name'] ?? $providerName }}
|
||||
</flux:button>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
Reference in New Issue
Block a user