import { CreditCard, CheckCircle2, RotateCw } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { Label } from "@/components/ui/label"; import { useState } from "react"; import { toast } from "sonner"; import { cn } from "@/lib/utils"; const availableGateways = [ { id: "stripe", name: "Stripe", logo: "https://upload.wikimedia.org/wikipedia/commons/b/ba/Stripe_Logo%2C_revised_2016.svg", fee: "2.9% + ₹30", status: "Connected", }, { id: "razorpay", name: "Razorpay", logo: "https://upload.wikimedia.org/wikipedia/commons/8/89/Razorpay_logo.svg", fee: "2%", status: "Available", }, { id: "phonepe", name: "PhonePe", logo: "https://upload.wikimedia.org/wikipedia/commons/thumb/7/71/PhonePe_Logo.svg/2560px-PhonePe_Logo.svg.png", fee: "1.9%", status: "Available", }, { id: "cashfree", name: "Cashfree", logo: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/12/Cashfree_Payments_Logo.svg/2560px-Cashfree_Payments_Logo.svg.png", fee: "1.95%", status: "Available", } ]; export function PaymentGatewayCard() { const [activeGateway, setActiveGateway] = useState("stripe"); const [loading, setLoading] = useState(null); const handleGatewayChange = (id: string) => { if (activeGateway === id) return; setLoading(id); // Simulate connection lag setTimeout(() => { setActiveGateway(id); setLoading(null); toast.success(`Switched active payment gateway to ${availableGateways.find(g => g.id === id)?.name}`); }, 1500); }; return (

Payment Gateway

Collection preferences

{loading ? ( ) : (
Processing )}
{availableGateways.map((gateway) => (
handleGatewayChange(gateway.id)} >
{/* Placeholder for logos if external works, else text */} {/* Using text fallback for safety/offline dev */} {gateway.name}

Fee: {gateway.fee}

{gateway.status === "Connected" || activeGateway === gateway.id ? ( ) : ( )}
))}

Processing payments settled in T+2 days via selected gateway.

); }