Aunty-Sparkles-Website/lib/square-types.ts

78 lines
1.3 KiB
TypeScript

// Square catalog types
export interface SquareProduct {
id: string
variationId: string
name: string
description: string
price: number
currency: string
imageUrl: string
inventory: number
category: string
categoryName?: string
isAvailable: boolean
variations: SquareVariation[]
}
export interface SquareVariation {
id: string
name: string
price: number
currency: string
inventory: number
sku?: string
}
export interface SquareCategory {
id: string
name: string
imageUrl?: string
}
export interface SquareInventory {
catalogObjectId: string
quantity: number
locationId: string
state: 'IN_STOCK' | 'SOLD' | 'WASTE' | 'NONE'
}
// Payment types
export interface PaymentRequest {
sourceId: string
orderId?: string
amount: number
currency: string
customerInfo: CustomerInfo
items: CartItem[]
}
export interface CustomerInfo {
name: string
email: string
phone?: string
address?: {
street: string
city: string
state: string
zipCode: string
country?: string
}
}
export interface CartItem {
id: string
variationId: string
name: string
price: number
quantity: number
description?: string
}
export interface OrderResult {
orderId: string
paymentId: string
status: string
totalAmount: number
receiptUrl?: string
}