ruch
Version:
Revolutionary React TypeScript CLI with hexagonal architecture & AI-powered development assistance. Create maintainable, scalable applications with domain-driven design and integrated AI tooling.
125 lines (113 loc) • 2.24 kB
text/typescript
/**
* Order domain entities
*/
export interface Order {
id: string;
orderNumber: string;
userId: string;
status: OrderStatus;
items: OrderItem[];
totals: OrderTotals;
shippingAddress: Address;
billingAddress: Address;
paymentMethod: PaymentMethod;
shipping: ShippingMethod;
notes?: string;
createdAt: string;
updatedAt: string;
completedAt?: string;
}
export type OrderStatus =
| 'pending'
| 'confirmed'
| 'processing'
| 'shipped'
| 'delivered'
| 'cancelled'
| 'refunded';
export interface OrderItem {
id: string;
productId: string;
productName: string;
productImage: string;
sku: string;
price: number;
quantity: number;
subtotal: number;
options?: OrderItemOption[];
}
export interface OrderItemOption {
name: string;
value: string;
price?: number;
}
export interface OrderTotals {
subtotal: number;
tax: number;
shipping: number;
discount: number;
total: number;
currency: 'USD' | 'EUR' | 'GBP';
}
export interface Address {
id?: string;
firstName: string;
lastName: string;
company?: string;
address1: string;
address2?: string;
city: string;
state: string;
postalCode: string;
country: string;
phone?: string;
}
export interface PaymentMethod {
type: 'credit_card' | 'paypal' | 'bank_transfer';
details: {
last4?: string;
brand?: string;
expiryMonth?: number;
expiryYear?: number;
};
}
export interface ShippingMethod {
id: string;
name: string;
description: string;
price: number;
estimatedDays: number;
}
export interface CreateOrderData {
items: {
productId: string;
quantity: number;
options?: OrderItemOption[];
}[];
shippingAddress: Address;
billingAddress: Address;
paymentMethodId: string;
shippingMethodId: string;
notes?: string;
}
export interface UpdateOrderData {
status?: OrderStatus;
shippingAddress?: Address;
billingAddress?: Address;
notes?: string;
}
export interface OrderFilter {
status?: OrderStatus;
userId?: string;
dateFrom?: string;
dateTo?: string;
search?: string;
}
export interface OrderStats {
total: number;
pending: number;
processing: number;
shipped: number;
delivered: number;
cancelled: number;
}