paxton-front/shared/woo_orders_create.ts
alsaze 2e01f58e67
Some checks failed
Deploy / build (push) Has been cancelled
refactoring
2025-11-21 12:48:00 +03:00

161 lines
3.1 KiB
TypeScript

// ------------------------------------
// REQUEST: Create WooCommerce Order
// ------------------------------------
export interface WooOrderCreateBilling {
first_name: string
last_name: string
address_1: string
address_2: string
city: string
state: string
postcode: string
country: string
email: string
phone: string
}
export interface WooOrderCreateShipping {
first_name: string
last_name: string
address_1: string
address_2: string
city: string
state: string
postcode: string
country: string
}
export interface WooOrderCreateLineItem {
product_id: number
variation_id?: number
quantity: number
}
export interface WooOrderCreateShippingLine {
method_id: string
method_title: string
total: string
}
export interface WooOrderCreateRequest {
payment_method: string
payment_method_title: string
set_paid: boolean
billing: WooOrderCreateBilling
shipping: WooOrderCreateShipping
line_items: WooOrderCreateLineItem[]
shipping_lines: WooOrderCreateShippingLine[]
}
// ------------------------------------
// RESPONSE: WooCommerce Order
// ------------------------------------
export interface WooMetaData {
id: number
key: string
value: any
}
export interface WooTaxItem {
id: number
total: string
subtotal: string
}
export interface WooLineItem {
id: number
name: string
product_id: number
variation_id: number
quantity: number
tax_class: string
subtotal: string
subtotal_tax: string
total: string
total_tax: string
taxes: WooTaxItem[]
meta_data: WooMetaData[]
sku: string
price: number
}
export interface WooTaxLine {
id: number
rate_code: string
rate_id: number
label: string
compound: boolean
tax_total: string
shipping_tax_total: string
meta_data: WooMetaData[]
}
export interface WooShippingLine {
id: number
method_title: string
method_id: string
total: string
total_tax: string
taxes: WooTaxItem[]
meta_data: WooMetaData[]
}
export interface WooLink {
href: string
}
export interface WooOrderLinks {
self: WooLink[]
collection: WooLink[]
}
export interface WooOrderCreateResponse {
id: number
parent_id: number
number: string
order_key: string
created_via: string
version: string
status: string
currency: string
date_created: string
date_created_gmt: string
date_modified: string
date_modified_gmt: string
discount_total: string
discount_tax: string
shipping_total: string
shipping_tax: string
cart_tax: string
total: string
total_tax: string
prices_include_tax: boolean
customer_id: number
customer_ip_address: string
customer_user_agent: string
customer_note: string
billing: WooOrderCreateBilling
shipping: WooOrderCreateShipping
payment_method: string
payment_method_title: string
transaction_id: string
date_paid: string | null
date_paid_gmt: string | null
date_completed: string | null
date_completed_gmt: string | null
cart_hash: string
meta_data: WooMetaData[]
line_items: WooLineItem[]
tax_lines: WooTaxLine[]
shipping_lines: WooShippingLine[]
fee_lines: any[]
coupon_lines: any[]
refunds: any[]
_links: WooOrderLinks
}