54 lines
2 KiB
TypeScript
54 lines
2 KiB
TypeScript
|
|
/**
|
||
|
|
* CheckoutErrorView — Échec ou annulation du paiement
|
||
|
|
* v0.402 P1.2: Page affichée après redirect Hyperswitch (order failed/cancelled)
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { Link } from 'react-router-dom';
|
||
|
|
import { AlertCircle, ShoppingCart } from 'lucide-react';
|
||
|
|
import { Button } from '@/components/ui/button';
|
||
|
|
|
||
|
|
interface CheckoutErrorViewProps {
|
||
|
|
orderId?: string;
|
||
|
|
status?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export function CheckoutErrorView({ orderId, status }: CheckoutErrorViewProps) {
|
||
|
|
const isCancelled = status === 'cancelled' || status === 'canceled';
|
||
|
|
const title = isCancelled ? 'Paiement annulé' : 'Échec du paiement';
|
||
|
|
const message = isCancelled
|
||
|
|
? 'Vous avez annulé le paiement. Votre panier n\'a pas été modifié.'
|
||
|
|
: 'Le paiement n\'a pas pu être traité. Veuillez réessayer ou utiliser une autre méthode.';
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div className="flex flex-col items-center justify-center min-h-layout-page px-4 py-12">
|
||
|
|
<div className="max-w-md w-full space-y-8 text-center">
|
||
|
|
<div className="flex justify-center">
|
||
|
|
<div className="rounded-full bg-destructive/10 p-4">
|
||
|
|
<AlertCircle className="h-16 w-16 text-destructive" aria-hidden />
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div className="space-y-2">
|
||
|
|
<h1 className="text-2xl font-bold text-foreground">{title}</h1>
|
||
|
|
<p className="text-muted-foreground">{message}</p>
|
||
|
|
{orderId && (
|
||
|
|
<p className="text-xs text-muted-foreground font-mono">
|
||
|
|
Référence : {orderId.slice(0, 8)}…
|
||
|
|
</p>
|
||
|
|
)}
|
||
|
|
</div>
|
||
|
|
<div className="flex flex-col sm:flex-row gap-3 justify-center">
|
||
|
|
<Button variant="primary" asChild>
|
||
|
|
<Link to="/marketplace" className="inline-flex items-center gap-2">
|
||
|
|
<ShoppingCart className="h-4 w-4" />
|
||
|
|
Retour au panier
|
||
|
|
</Link>
|
||
|
|
</Button>
|
||
|
|
<Button variant="outline" asChild>
|
||
|
|
<Link to="/marketplace">Continuer mes achats</Link>
|
||
|
|
</Button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|