feat: implement comprehensive multi-provider payment processing system
- Add unified payment provider architecture with contract-based design - Implement 6 payment providers: Stripe, Lemon Squeezy, Polar, Oxapay, Crypto, Activation Keys - Create subscription management with lifecycle handling (create, cancel, pause, resume, update) - Add coupon system with usage tracking and trial extensions - Build Filament admin resources for payment providers, subscriptions, coupons, and trials - Implement payment orchestration service with provider registry and configuration management - Add comprehensive payment logging and webhook handling for all providers - Create customer analytics dashboard with revenue, churn, and lifetime value metrics - Add subscription migration service for provider switching - Include extensive test coverage for all payment functionality
This commit is contained in:
45
database/factories/TrialExtensionFactory.php
Normal file
45
database/factories/TrialExtensionFactory.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\TrialExtension>
|
||||
*/
|
||||
class TrialExtensionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$originalEnd = fake()->dateTimeBetween('now', '+14 days');
|
||||
$extensionDays = fake()->numberBetween(1, 30);
|
||||
$newEnd = (new \DateTime($originalEnd->format('Y-m-d')))->modify("+{$extensionDays} days");
|
||||
|
||||
return [
|
||||
'subscription_id' => \App\Models\Subscription::factory(),
|
||||
'user_id' => \App\Models\User::factory(),
|
||||
'extension_days' => $extensionDays,
|
||||
'reason' => fake()->optional(0.7)->randomElement([
|
||||
'Customer request',
|
||||
'Technical issues',
|
||||
'Service outage compensation',
|
||||
'Goodwill gesture',
|
||||
'Payment processing delay',
|
||||
]),
|
||||
'extension_type' => fake()->randomElement(['manual', 'automatic', 'compensation']),
|
||||
'original_trial_ends_at' => $originalEnd,
|
||||
'new_trial_ends_at' => $newEnd,
|
||||
'granted_at' => fake()->dateTimeBetween('-1 week', 'now'),
|
||||
'granted_by_admin_id' => \App\Models\User::factory(),
|
||||
'metadata' => fake()->optional(0.2)->randomElements([
|
||||
'notes' => fake()->sentence(),
|
||||
'approval_ticket' => fake()->numerify('TCK-#####'),
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user