/** * AlternativePaymentMethods Component * Display and select alternative payment methods (OXXO, SPEI, etc.) * Epic: OQI-005 Pagos y Stripe */ import React, { useState } from 'react'; import { Store, Building2, CreditCard, ChevronRight, Info, CheckCircle, Clock, AlertCircle, Loader2, } from 'lucide-react'; import type { PaymentMethodType } from '../../types/payment.types'; export interface AlternativePaymentMethod { id: PaymentMethodType; name: string; description: string; icon: React.ReactNode; processingTime: string; available: boolean; minAmount?: number; maxAmount?: number; fees?: string; instructions?: string[]; regions?: string[]; } const ALTERNATIVE_METHODS: AlternativePaymentMethod[] = [ { id: 'oxxo', name: 'OXXO Pay', description: 'Pay with cash at any OXXO convenience store', icon: , processingTime: '1-3 business days', available: true, minAmount: 10, maxAmount: 10000, fees: 'No additional fees', instructions: [ 'Complete checkout to receive a payment voucher', 'Visit any OXXO store and show the voucher', 'Pay in cash at the register', 'Your payment will be confirmed within 1-3 days', ], regions: ['Mexico'], }, { id: 'spei', name: 'SPEI Transfer', description: 'Instant bank transfer via SPEI (Mexico)', icon: , processingTime: 'Instant - 24 hours', available: true, minAmount: 1, maxAmount: 500000, fees: 'Bank fees may apply', instructions: [ 'Complete checkout to receive CLABE and reference number', 'Log into your bank app or website', 'Make a SPEI transfer to the provided CLABE', 'Include the reference number in your transfer', ], regions: ['Mexico'], }, { id: 'card', name: 'Credit/Debit Card', description: 'Pay with Visa, Mastercard, or Amex', icon: , processingTime: 'Instant', available: true, fees: 'No additional fees', instructions: ['Enter your card details securely'], regions: ['Worldwide'], }, ]; interface AlternativePaymentMethodsProps { selectedMethod: PaymentMethodType | null; onSelectMethod: (method: PaymentMethodType) => void; onContinue: () => void; amount?: number; currency?: string; isLoading?: boolean; showCardOption?: boolean; region?: string; } const AlternativePaymentMethods: React.FC = ({ selectedMethod, onSelectMethod, onContinue, amount = 0, currency = 'MXN', isLoading = false, showCardOption = true, region = 'Mexico', }) => { const [expandedMethod, setExpandedMethod] = useState(null); const formatCurrency = (value: number) => { return new Intl.NumberFormat('es-MX', { style: 'currency', currency, }).format(value); }; const availableMethods = ALTERNATIVE_METHODS.filter((method) => { if (!showCardOption && method.id === 'card') return false; if (method.regions && !method.regions.includes(region) && !method.regions.includes('Worldwide')) { return false; } if (method.minAmount && amount < method.minAmount) return false; if (method.maxAmount && amount > method.maxAmount) return false; return method.available; }); const toggleExpand = (methodId: PaymentMethodType) => { setExpandedMethod(expandedMethod === methodId ? null : methodId); }; const getMethodStatusColor = (method: AlternativePaymentMethod) => { if (!method.available) return 'text-gray-500'; if (selectedMethod === method.id) return 'text-blue-400'; return 'text-gray-400'; }; return (
{/* Header */}

Select Payment Method

{amount > 0 && ( Total: {formatCurrency(amount)} )}
{/* Payment Methods List */}
{availableMethods.map((method) => { const isSelected = selectedMethod === method.id; const isExpanded = expandedMethod === method.id; return (
{/* Method Header */}
{/* Expanded Details */} {isExpanded && (
Processing Time {method.processingTime}
{method.fees && (
Fees {method.fees}
)} {method.minAmount && (
Min Amount {formatCurrency(method.minAmount)}
)} {method.maxAmount && (
Max Amount {formatCurrency(method.maxAmount)}
)}
{method.instructions && method.instructions.length > 0 && (
How it works:
    {method.instructions.map((instruction, index) => (
  1. {index + 1} {instruction}
  2. ))}
)}
)}
); })}
{/* Amount Limits Warning */} {amount > 0 && (

Some payment methods have minimum and maximum amount limits. {selectedMethod === 'oxxo' && amount > 10000 && ( OXXO Pay has a maximum limit of $10,000 MXN per transaction. )}

)} {/* Continue Button */} {selectedMethod && ( )} {/* Security Note */}
All payments are processed securely via Stripe
); }; export default AlternativePaymentMethods;