Add complete billing system with Stripe and PayPal gateway support, checkout flow with coupon validation, subscription management (cancel/resume/swap), payment method management, invoice and transaction history, webhook handlers, dunning/suspension system with scheduled processing, and 29 new tests (53 total passing). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Http\Responses\LoginResponse;
|
|
use App\Services\Billing\BillingServiceFactory;
|
|
use Illuminate\Cache\RateLimiting\Limit;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\RateLimiter;
|
|
use Illuminate\Support\Facades\URL;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Laravel\Fortify\Contracts\LoginResponse as LoginResponseContract;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(LoginResponseContract::class, LoginResponse::class);
|
|
$this->app->singleton(BillingServiceFactory::class);
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
if ($this->app->environment('production', 'local')) {
|
|
URL::forceScheme('https');
|
|
}
|
|
|
|
RateLimiter::for('api', function (Request $request) {
|
|
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
|
});
|
|
|
|
RateLimiter::for('register', function (Request $request) {
|
|
return Limit::perMinute(3)->by($request->ip());
|
|
});
|
|
}
|
|
}
|