@extends('layouts.app') @php try { $paymentSettings = function_exists('get_payment_settings') ? get_payment_settings() : []; } catch (\Throwable $e) { $paymentSettings = []; } try { $availableMethods = function_exists('get_available_payment_methods') ? get_available_payment_methods() : []; } catch (\Throwable $e) { $availableMethods = []; } // Fallback: si aucune méthode n'est disponible, activer les méthodes par défaut if (empty($availableMethods)) { $availableMethods = [ 'stripe' => ['name' => 'Carte bancaire', 'icon' => 'fas fa-credit-card'], 'apple_pay' => ['name' => 'Apple Pay', 'icon' => 'fab fa-apple-pay'], 'google_pay' => ['name' => 'Google Pay', 'icon' => 'fab fa-google-pay'], 'klarna' => ['name' => 'Klarna', 'icon' => 'fab fa-klarna'], 'amazon_pay' => ['name' => 'Amazon Pay', 'icon' => 'fab fa-amazon'], 'cash' => ['name' => 'Espèces', 'icon' => 'fas fa-money-bill-wave'], ]; } // S'assurer que PayPal et virement ne sont jamais proposés unset($availableMethods['paypal'], $availableMethods['virement'], $availableMethods['iban']); $paymentRequirement = function_exists('normalize_payment_requirement_for_mode') ? normalize_payment_requirement_for_mode($booking->service?->payment_requirement ?? 'none') : ($booking->service?->payment_requirement ?? 'none'); $depositPct = (float) ($booking->service?->deposit_percentage ?? 0); $requirePaymentBeforeBooking = (bool) ($paymentSettings['require_payment_before_booking'] ?? false); $cashAllowedByCriteria = ($paymentRequirement === 'none') && !$requirePaymentBeforeBooking; $currentRouteName = request()->route()?->getName(); $isPrestataireContext = is_string($currentRouteName) && str_starts_with($currentRouteName, 'prestataire.'); $isClientContext = is_string($currentRouteName) && str_starts_with($currentRouteName, 'client.'); $routeForm = $isPrestataireContext && \Illuminate\Support\Facades\Route::has('prestataire.payments.form') ? route('prestataire.payments.form', $booking) : (\Illuminate\Support\Facades\Route::has('client.payments.form') ? route('client.payments.form', $booking) : (\Illuminate\Support\Facades\Route::has('payment.form') ? route('payment.form', $booking) : '#')); $routeIntent = $isPrestataireContext && \Illuminate\Support\Facades\Route::has('prestataire.payments.intent') ? route('prestataire.payments.intent', $booking) : (\Illuminate\Support\Facades\Route::has('client.payments.intent') ? route('client.payments.intent', $booking) : (\Illuminate\Support\Facades\Route::has('payment.intent') ? route('payment.intent', $booking) : '#')); $routeConfirm = $isPrestataireContext && \Illuminate\Support\Facades\Route::has('prestataire.payments.confirm') ? route('prestataire.payments.confirm', $booking) : (\Illuminate\Support\Facades\Route::has('client.payments.confirm') ? route('client.payments.confirm', $booking) : (\Illuminate\Support\Facades\Route::has('payment.confirm') ? route('payment.confirm', $booking) : '#')); $routeBack = $isPrestataireContext && \Illuminate\Support\Facades\Route::has('prestataire.payments.index') ? route('prestataire.payments.index') : (\Illuminate\Support\Facades\Route::has('client.bookings.index') ? route('client.bookings.index') : url('/')); // Stripe 3DS return URL (server callback records the transaction) $routeSuccess = \Illuminate\Support\Facades\Route::has('payment.success') ? route('payment.success', $booking) : $routeBack; $routeCash = $isPrestataireContext && \Illuminate\Support\Facades\Route::has('prestataire.payments.cash') ? route('prestataire.payments.cash', $booking) : (\Illuminate\Support\Facades\Route::has('client.payments.cash') ? route('client.payments.cash', $booking) : (\Illuminate\Support\Facades\Route::has('payment.cash') ? route('payment.cash', $booking) : '#')); @endphp @section('content')
Réservation #{{ $booking->booking_number }}
Service
{{ $booking->service?->name ?? 'Service' }}
Prestataire
{{ $booking->prestataire?->user?->name ?? 'N/A' }}
Date
{{ $booking->start_datetime?->format('d/m/Y à H:i') ?? '—' }}
Statut paiement
@if($booking->payment_status === 'paid') ✅ Payé @elseif($booking->payment_status === 'deposit_paid') 💰 Acompte payé @else ⏳ En attente @endif
✅ Acompte déjà payé : {{ number_format($booking->deposit_amount, 2) }} €
Il vous reste {{ number_format(max(0, $booking->total_price - $booking->deposit_amount), 2) }} € à payer.
Le paiement en espèces n'est pas disponible pour cette annonce selon les critères du prestataire.
@endifVous paierez {{ number_format($booking->total_price, 2) }} € directement au prestataire lors de la prestation.
Divisez votre paiement de {{ number_format($booking->total_price, 2) }} € en 3 mensualités de {{ number_format($booking->total_price / 3, 2) }} €.
Utilisez les informations de paiement de votre compte Amazon pour payer {{ number_format($booking->total_price, 2) }} €.