Demo plan + Payment integrations (Stripe/PayPal/Bank)
Models & migrations: - platform_settings table (key/value JSON store + Cache::remember 5min) - plans: is_demo bool + trial_days int - companies: is_demo bool Plans: - Demo plan seeded (is_demo=true, is_public=false, all features, 14 trial days) - Trial 14-day plan seeded (is_public=true, basic features) - Plan form: is_demo toggle + trial_days field - Plan table: badge 🎬 Demo / 🎁 N zile trial Central panel: - PaymentSettings page (heroicon-credit-card, sort 90) Form sections: General, Date legale, Stripe, PayPal, Transfer bancar Each gateway collapsible, fields hidden until enabled toggle Saves to platform_settings keyed by `payments.{gateway}` - CompanyResource: is_demo toggle + table description Payment flow (PaymentController): - GET /billing — tenant invoices list with Pay button - POST /pay/{sub} — start checkout (stripe/paypal/bank) - GET /pay/{sub}/{success,cancel} - POST /payments/stripe/webhook — mark paid + extend company.active_until - POST /payments/paypal/webhook — same Views: - site/billing.blade.php — invoices list with payment modal (3 methods) - site/bank-instructions — IBAN/BIC/reference for manual transfer - site/checkout-stub — placeholder until composer require stripe-php - site/payment-{success,cancel} Tenant panel: - userMenuItems → "Facturile mele" link to /billing
This commit is contained in:
@@ -24,6 +24,26 @@ Route::get('/', function () {
|
||||
return redirect('/admin');
|
||||
});
|
||||
|
||||
// ─── Plăți / Billing (tenant-side) ──────────────────────────────────
|
||||
// /billing — listă facturi tenant + buton plată
|
||||
// /pay/{id} — start checkout (Stripe / PayPal / bank)
|
||||
Route::get('/billing', [\App\Http\Controllers\PaymentController::class, 'billing'])->name('billing');
|
||||
Route::post('/pay/{subscription}', [\App\Http\Controllers\PaymentController::class, 'startCheckout'])
|
||||
->where('subscription', '\d+')
|
||||
->name('pay.start');
|
||||
Route::get('/pay/{subscription}/success', [\App\Http\Controllers\PaymentController::class, 'success'])
|
||||
->where('subscription', '\d+')
|
||||
->name('pay.success');
|
||||
Route::get('/pay/{subscription}/cancel', [\App\Http\Controllers\PaymentController::class, 'cancel'])
|
||||
->where('subscription', '\d+')
|
||||
->name('pay.cancel');
|
||||
|
||||
// ─── Webhooks (central, no auth) ────────────────────────────────────
|
||||
Route::post('/payments/stripe/webhook', [\App\Http\Controllers\PaymentController::class, 'stripeWebhook'])
|
||||
->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
|
||||
Route::post('/payments/paypal/webhook', [\App\Http\Controllers\PaymentController::class, 'paypalWebhook'])
|
||||
->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
|
||||
|
||||
// Stub `login` route — needed because Laravel's auth middleware tries to
|
||||
// route('login') when redirecting unauthenticated requests. We don't have a
|
||||
// global /login (panels use /admin/login and /app/login), so stub it.
|
||||
|
||||
Reference in New Issue
Block a user