2025-05-13 18:50:30 +02:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-29 21:45:14 +01:00
|
|
|
export type CertificationStatus =
|
|
|
|
|
| 'standard 2020'
|
|
|
|
|
| 'standard 2023'
|
|
|
|
|
| 'nonstandard'
|
|
|
|
|
| 'in progress';
|
|
|
|
|
|
2025-05-13 18:50:30 +02:00
|
|
|
export interface OffsetProject {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
description: string;
|
|
|
|
|
shortDescription: string;
|
|
|
|
|
imageUrl: string;
|
|
|
|
|
pricePerTon: number;
|
2025-10-29 21:45:14 +01:00
|
|
|
percentage?: number; // Project's contribution to portfolio
|
|
|
|
|
certificationStatus?: CertificationStatus; // Wren certification standard
|
2025-05-13 18:50:30 +02:00
|
|
|
location: string;
|
|
|
|
|
type: string;
|
|
|
|
|
verificationStandard: string;
|
|
|
|
|
impactMetrics: {
|
|
|
|
|
co2Reduced: number;
|
|
|
|
|
treesPlanted?: number;
|
|
|
|
|
livelihoodsImproved?: number;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-29 21:45:14 +01:00
|
|
|
export type OffsetOrderSource =
|
|
|
|
|
| 'subscription'
|
|
|
|
|
| 'flight'
|
|
|
|
|
| 'gift'
|
|
|
|
|
| 'custom-duration'
|
|
|
|
|
| 'one-off'
|
|
|
|
|
| 'referral-bonus'
|
|
|
|
|
| 'annual-incentive'
|
|
|
|
|
| 'public-api'
|
|
|
|
|
| 'special-offer';
|
|
|
|
|
|
2025-05-13 18:50:30 +02:00
|
|
|
export interface OffsetOrder {
|
|
|
|
|
id: string;
|
2025-10-29 21:45:14 +01:00
|
|
|
amountCharged: number; // Amount in cents (amount_paid_by_customer from API)
|
2025-05-13 18:50:30 +02:00
|
|
|
currency: CurrencyCode;
|
|
|
|
|
tons: number;
|
|
|
|
|
portfolio: Portfolio;
|
|
|
|
|
status: 'pending' | 'completed' | 'failed';
|
|
|
|
|
createdAt: string;
|
|
|
|
|
dryRun: boolean;
|
2025-10-29 21:45:14 +01:00
|
|
|
source?: OffsetOrderSource; // Source of the payment
|
|
|
|
|
note?: string; // Optional note attached to the order
|
2025-05-13 18:50:30 +02:00
|
|
|
}
|
|
|
|
|
|
2025-05-13 20:58:17 +02:00
|
|
|
export type CalculatorType = 'trip' | 'annual';
|
2025-10-29 21:45:14 +01:00
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
};
|
|
|
|
|
}
|