diff --git a/app/checkout/success/demo/page.tsx b/app/checkout/success/demo/page.tsx new file mode 100644 index 0000000..7b468d3 --- /dev/null +++ b/app/checkout/success/demo/page.tsx @@ -0,0 +1,395 @@ +'use client'; + +import { motion } from 'framer-motion'; +import { Leaf } from 'lucide-react'; +import { CarbonImpactComparison } from '../../../../src/components/CarbonImpactComparison'; +import { RechartsPortfolioPieChart } from '../../../../src/components/RechartsPortfolioPieChart'; +import { useRouter } from 'next/navigation'; + +// Mock order data for demo purposes +const mockOrderDetails = { + order: { + id: 'demo_order_123', + tons: 5.2, + portfolioId: 1, + baseAmount: 9360, // $93.60 in cents + processingFee: 281, // $2.81 in cents + totalAmount: 9641, // $96.41 in cents + currency: 'USD', + status: 'paid', + wrenOrderId: 'wren_abc123xyz', + stripeSessionId: 'cs_test_demo123', + createdAt: new Date().toISOString(), + portfolio: { + id: 1, + name: 'Puffin Maritime Carbon Portfolio', + description: 'Curated mix of high-impact verified carbon offset projects', + projects: [ + { + id: 1, + name: 'Rimba Raya Biodiversity Reserve', + type: 'Forestry', + description: 'Protecting 64,000 hectares of tropical peat swamp forest in Borneo', + shortDescription: 'Tropical forest conservation in Borneo', + pricePerTon: 15, + percentage: 0.3, + imageUrl: '/projects/forest.jpg', + location: 'Borneo, Indonesia', + verificationStandard: 'VCS, CCB', + impactMetrics: { + co2Reduced: 3500000 + } + }, + { + id: 2, + name: 'Verified Blue Carbon', + type: 'Blue Carbon', + description: 'Coastal wetland restoration for carbon sequestration', + shortDescription: 'Coastal wetland restoration', + pricePerTon: 25, + percentage: 0.25, + imageUrl: '/projects/ocean.jpg', + location: 'Global', + verificationStandard: 'VCS', + impactMetrics: { + co2Reduced: 1200000 + } + }, + { + id: 3, + name: 'Direct Air Capture Technology', + type: 'Direct Air Capture', + description: 'Advanced technology removing CO2 directly from atmosphere', + shortDescription: 'Direct air capture technology', + pricePerTon: 35, + percentage: 0.2, + imageUrl: '/projects/tech.jpg', + location: 'Iceland', + verificationStandard: 'ISO 14064', + impactMetrics: { + co2Reduced: 500000 + } + }, + { + id: 4, + name: 'Renewable Energy Development', + type: 'Renewable Energy', + description: 'Wind and solar power generation replacing fossil fuels', + shortDescription: 'Clean energy generation', + pricePerTon: 12, + percentage: 0.25, + imageUrl: '/projects/solar.jpg', + location: 'Global', + verificationStandard: 'Gold Standard', + impactMetrics: { + co2Reduced: 2800000 + } + } + ] + } + }, + session: { + paymentStatus: 'paid', + customerEmail: 'demo@puffinoffset.com' + } +}; + +// Map backend status to user-friendly labels +const getStatusDisplay = (status: string): { label: string; className: string } => { + switch (status) { + case 'paid': + case 'fulfilled': + return { label: 'Confirmed', className: 'bg-green-100 text-green-700' }; + case 'pending': + return { label: 'Processing', className: 'bg-yellow-100 text-yellow-700' }; + default: + return { label: status.toUpperCase(), className: 'bg-slate-100 text-slate-700' }; + } +}; + +// Format currency with commas +const formatCurrency = (amount: number): string => { + return amount.toLocaleString('en-US', { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }); +}; + +export default function CheckoutSuccessDemoPage() { + const router = useRouter(); + const orderDetails = mockOrderDetails; + const { order, session } = orderDetails; + const totalAmount = order.totalAmount / 100; + const baseAmount = order.baseAmount / 100; + const processingFee = order.processingFee / 100; + const effectiveStatus = session.paymentStatus === 'paid' ? 'paid' : order.status; + const statusDisplay = getStatusDisplay(effectiveStatus); + + return ( + <> + {/* Print-specific styles */} + + +
+ 🎠DEMO MODE - This is a mock order for visual comparison purposes +
+
+ + Thank you for your carbon offset purchase +
+{order.tons} tons COâ‚‚
+{order.stripeSessionId}
+{order.wrenOrderId}
++ + {statusDisplay.label} + +
+{session.customerEmail}
++ {new Date().toLocaleDateString('en-US', { + year: 'numeric', + month: 'long', + day: 'numeric' + })} +
++ Your {order.tons} tons of COâ‚‚ offsets are distributed across these verified projects: +
++ + Confirmation email sent to {session.customerEmail} +
+Thank you for making a positive impact on our planet
+Questions? Contact us at support@puffinoffset.com
+