All checks were successful
Build and Push Docker Image / docker (push) Successful in 42s
## Stripe Payment Integration - Add Express.js backend server with Stripe Checkout Sessions - Create SQLite database for order tracking - Implement Stripe webhook handlers for payment events - Integrate with Wren Climate API for carbon offset fulfillment - Add CheckoutSuccess and CheckoutCancel pages - Create checkout API client for frontend - Update OffsetOrder component to redirect to Stripe Checkout - Add processing fee calculation (3% of base amount) - Implement order status tracking (pending → paid → fulfilled) Backend (server/): - Express server with CORS and middleware - SQLite database with Order schema - Stripe configuration and client - Order CRUD operations model - Checkout session creation endpoint - Webhook handler for payment confirmation - Wren API client for offset fulfillment Frontend: - CheckoutSuccess page with order details display - CheckoutCancel page with retry encouragement - Updated OffsetOrder to use Stripe checkout flow - Added checkout routes to App.tsx - TypeScript interfaces for checkout flow ## Visual & UX Enhancements - Add CertificationBadge component for project verification status - Create PortfolioDonutChart for visual portfolio allocation - Implement RadialProgress for percentage displays - Add reusable form components (FormInput, FormTextarea, FormSelect, FormFieldWrapper) - Refactor OffsetOrder with improved layout and animations - Add offset percentage slider with visual feedback - Enhance MobileOffsetOrder with better responsive design - Improve TripCalculator with cleaner UI structure - Update CurrencySelect with better styling - Add portfolio distribution visualization - Enhance project cards with hover effects and animations - Improve color palette and gradient usage throughout ## Configuration - Add VITE_API_BASE_URL environment variable - Create backend .env.example template - Update frontend .env.example with API URL - Add Stripe documentation references 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
143 lines
3.1 KiB
TypeScript
143 lines
3.1 KiB
TypeScript
export interface VesselData {
|
|
imo: string;
|
|
vesselName: string;
|
|
type: string;
|
|
length: number;
|
|
width: number;
|
|
estimatedEnginePower: number;
|
|
}
|
|
|
|
export interface CarbonCalculation {
|
|
yearlyEmissions: number;
|
|
offsetCost: number;
|
|
recommendedProjects: Array<{
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
costPerTon: number;
|
|
}>;
|
|
}
|
|
|
|
export interface CarbonEstimate {
|
|
fuelConsumption: number; // liters per year
|
|
co2Emissions: number; // tons per year
|
|
}
|
|
|
|
export interface TripEstimate {
|
|
distance: number; // nautical miles
|
|
duration: number; // hours
|
|
fuelConsumption: number; // liters
|
|
co2Emissions: number; // tons
|
|
}
|
|
|
|
export interface Currency {
|
|
code: string;
|
|
symbol: string;
|
|
rate: number; // Exchange rate relative to USD
|
|
}
|
|
|
|
export type CurrencyCode = 'USD' | 'EUR' | 'GBP' | 'CHF';
|
|
|
|
export interface Portfolio {
|
|
id: number;
|
|
name: string;
|
|
description: string;
|
|
projects: OffsetProject[];
|
|
pricePerTon: number;
|
|
currency: CurrencyCode;
|
|
}
|
|
|
|
export type CertificationStatus =
|
|
| 'standard 2020'
|
|
| 'standard 2023'
|
|
| 'nonstandard'
|
|
| 'in progress';
|
|
|
|
export interface OffsetProject {
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
shortDescription: string;
|
|
imageUrl: string;
|
|
pricePerTon: number;
|
|
percentage?: number; // Project's contribution to portfolio
|
|
certificationStatus?: CertificationStatus; // Wren certification standard
|
|
location: string;
|
|
type: string;
|
|
verificationStandard: string;
|
|
impactMetrics: {
|
|
co2Reduced: number;
|
|
treesPlanted?: number;
|
|
livelihoodsImproved?: number;
|
|
};
|
|
}
|
|
|
|
export type OffsetOrderSource =
|
|
| 'subscription'
|
|
| 'flight'
|
|
| 'gift'
|
|
| 'custom-duration'
|
|
| 'one-off'
|
|
| 'referral-bonus'
|
|
| 'annual-incentive'
|
|
| 'public-api'
|
|
| 'special-offer';
|
|
|
|
export interface OffsetOrder {
|
|
id: string;
|
|
amountCharged: number; // Amount in cents (amount_paid_by_customer from API)
|
|
currency: CurrencyCode;
|
|
tons: number;
|
|
portfolio: Portfolio;
|
|
status: 'pending' | 'completed' | 'failed';
|
|
createdAt: string;
|
|
dryRun: boolean;
|
|
source?: OffsetOrderSource; // Source of the payment
|
|
note?: string; // Optional note attached to the order
|
|
}
|
|
|
|
export type CalculatorType = 'trip' | 'annual';
|
|
|
|
// Stripe Checkout Types
|
|
export interface CheckoutSession {
|
|
sessionId: string;
|
|
url: string;
|
|
orderId: string;
|
|
}
|
|
|
|
export interface StoredOrder {
|
|
id: string;
|
|
stripeSessionId: string;
|
|
stripePaymentIntent: string | null;
|
|
wrenOrderId: string | null;
|
|
customerEmail: string | null;
|
|
tons: number;
|
|
portfolioId: number;
|
|
baseAmount: number; // in cents
|
|
processingFee: number; // in cents
|
|
totalAmount: number; // in cents
|
|
currency: CurrencyCode;
|
|
status: 'pending' | 'paid' | 'fulfilled' | 'failed';
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface OrderDetailsResponse {
|
|
order: {
|
|
id: string;
|
|
tons: number;
|
|
portfolioId: number;
|
|
baseAmount: number;
|
|
processingFee: number;
|
|
totalAmount: number;
|
|
currency: string;
|
|
status: string;
|
|
wrenOrderId: string | null;
|
|
createdAt: string;
|
|
};
|
|
session: {
|
|
paymentStatus: string;
|
|
customerEmail?: string;
|
|
};
|
|
}
|