88 lines
3.1 KiB
PHP
88 lines
3.1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
use Inertia\Inertia;
|
|
use App\Models\Payment;
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Controllers\CardImportController;
|
|
|
|
Route::get('/', function () {
|
|
return Inertia::render('Landing');
|
|
})->name('home');
|
|
|
|
Route::get('dashboard', function () {
|
|
return Inertia::render('Dashboard');
|
|
})->middleware(['auth', 'verified'])->name('dashboard');
|
|
|
|
// Route::get('/cards', [App\Http\Controllers\CardController::class, 'index'])->name('cards.index');
|
|
Route::get('/tirage',[App\Http\Controllers\CardController::class, 'index'])->name('cards.shuffle');
|
|
Route::post('/draw-card', [App\Http\Controllers\CardController::class, 'drawCard']);
|
|
|
|
Route::post('/create-checkout-session', [App\Http\Controllers\StripeController::class, 'createCheckoutSession']);
|
|
|
|
Route::post('/checkout-rendez-vous', [App\Http\Controllers\StripeController::class, 'createRendezVousSession']);
|
|
|
|
Route::post('/stripe/webhook', [App\Http\Controllers\WebhookController::class, 'handleWebhook']);
|
|
|
|
Route::get('/rendez-vous', [App\Http\Controllers\AppointmentController::class, 'index']);
|
|
|
|
Route::get('/resultat', [App\Http\Controllers\CardController::class, 'cartResult']);
|
|
Route::get('/resultat-gratuit', function(Request $request) {
|
|
return Inertia::render('cards/FreeCardResult');
|
|
})->name('cards.freeResult');
|
|
|
|
Route::get('paiement', function () {
|
|
return Inertia::render('Checkout');
|
|
})->name('paiement');
|
|
|
|
|
|
Route::get('/success', function (Request $request) {
|
|
$clientSessionId = $request->query('client_session_id');
|
|
|
|
$payment = Payment::where('client_session_id', $clientSessionId)
|
|
->where('status', 'succeeded') // Only check for succeeded payments
|
|
->first();
|
|
|
|
if ($payment) {
|
|
return Inertia::render('payments/Success', [
|
|
'paymentSuccess' => true,
|
|
'drawCount' => $payment->draw_count
|
|
]);
|
|
}
|
|
|
|
return Inertia::render('payments/Error', ['message' => 'Payment validation failed.']);
|
|
})->name('payment.success');
|
|
|
|
Route::get('/rendez-vous/success', function (Request $request){
|
|
$clientSessionId = $request->query('client_session_id');
|
|
$payment = Payment::where('client_session_id', $clientSessionId)
|
|
->where('status', 'succeeded') // Only check for succeeded payments
|
|
->first();
|
|
|
|
if ($payment) {
|
|
return Inertia::render('AppointSuccess', [
|
|
'appointment_date' => $payment->appointment_date,
|
|
]);
|
|
}
|
|
|
|
})->name('appoint.success');
|
|
|
|
Route::get('/cancel', function () {
|
|
return Inertia::render('payments/Error'); // Your error page
|
|
})->name('payments.cancel');
|
|
|
|
Route::get('/term-condition', function () {
|
|
return Inertia::render('TermCondition'); // Your terms and conditions page
|
|
})->name('term-condition');
|
|
|
|
Route::get('/politique-confidalite', function () {
|
|
return Inertia::render('PolitiqueConf'); // Your terms and conditions page
|
|
})->name('politique-conf');
|
|
|
|
|
|
// CSV import endpoint for cards
|
|
Route::post('/cards/import', [CardImportController::class, 'store'])->middleware(['auth']);
|
|
|
|
require __DIR__.'/settings.php';
|
|
require __DIR__.'/auth.php';
|