/** * Checkout rates (Live courier rates) settings, as served by GET/PUT /settings/checkout. */ export type CheckoutRounding = 'none' | 'up_10p' | 'up_pound' | 'end_99'; /** increase: add the markup to the label price; decrease: take it off, to price below cost. */ export type CheckoutPriceDirection = 'increase' | 'decrease'; export interface CheckoutServiceDetails { name: string; courier: string; courierSlug: string; /** The merchant's own name for customers; empty uses the suggested name. */ customerName?: string; /** Pickup point services: the customer collects from a 'locker' or a 'shop'. '' for home delivery. */ pickup?: '' | 'locker' | 'shop'; } export interface CheckoutRatesSettings { enabled: boolean; services: string[]; serviceDetails: Record; markup: { direction?: CheckoutPriceDirection; percent: number; fixed: number }; rounding: CheckoutRounding; maxRates: number; updatedAt: string | null; } /** The settings plus what the screen needs to know about the store. */ export interface CheckoutRatesResponse extends CheckoutRatesSettings { linked: boolean; currency: string; zones: { withLiveRates: string[]; withoutFallback: string[] }; tax: { enabled: boolean; hasShippingRate: boolean }; /** How checkout asks for the customer's phone. Locker and shop services need it. */ checkoutPhone?: { field: CheckoutPhoneField; editUrl: string }; } export type CheckoutPhoneField = 'required' | 'optional' | 'hidden'; /** Error body from PUT /settings/checkout (WP_Error). */ export interface CheckoutRatesError { code?: string; message?: string; data?: { status?: number; errors?: Record; zones?: string[] }; }