import { UbAllergenType, UbFulfillmentActionType, UbFulfillmentIssueType } from '../enums/ub-order'; import { UbMoney } from './ub-utils'; export interface UbCart { items: UbCartItem[]; /** order-level note * By default order-level instructions are disabled for POS-integrated stores. * When this feature is disabled customers cannot enter order-level instructions when checking out on Uber Eats. * Order-level instructions can be enabled by Uber Eats once this capability has been verified for your integration. */ special_instructions: string; /** 當品項無法供應時的處理 */ fulfillment_issues: UbFulfillmentIssue[]; } export interface UbCartItem { id: string; /** uber eat cart item id */ instance_id: string; title: string; /** Free-form text field reserved for metadata supplied by the store. */ external_data?: string; quantity: number; price: UbCartItemPrice; selected_modifier_groups: UbCartModifierGroup[]; /** 特殊需求,item備註 e.g. 過敏原 */ special_requests?: UbSpecialRequests[]; default_quantity: number; /** item-level note */ special_instructions?: string; /** 沒品項時的處理,放備註 */ fulfillment_action: UbFulfillmentAction; eater_id: string; } export interface UbCartItemPrice { /** 包含屬性的整個item的單價 */ unit_price: UbMoney; total_price: UbMoney; base_unit_price: UbMoney; base_total_price: UbMoney; } export interface UbCartModifierGroup { id: string; title: string; /** Free-form text field reserved for metadata supplied by the store. */ external_data?: string; selected_items: UbCartItem[]; /** A menu might have a choose your toppings selection where lettuce, tomato, and bacon are pre-selected by default, * however, the eater wishes to have no toppings and de-selects them for this order. * We represent that as a “choose your toppings” modifier_group with a “lettuce” item, a “tomato” item, * and a “bacon” item placed in this removed_items array. */ removed_items?: UbCartItem[]; } export interface UbFulfillmentAction { fulfillment_action_type: UbFulfillmentActionType; } export interface UbSpecialRequests { /** Special requests for an item related to allergies specified by the eater. * - The allergy requests product is disabled by default for POS integrated stores, * and can only be enabled by Uber Eats once the capability to ingest this information has been built and verified for your integration. */ allergy: UbAllergy; } export interface UbAllergy { allergens_to_exclude: UbAllergen[]; allergy_instructions?: string; } export interface UbAllergen { type: UbAllergenType; /** An allergen of type OTHER is one that is not yet supported via the API. * 當type==OTHER,才有的欄位 */ freeform_text?: string; } export interface UbFulfillmentIssue { fulfillment_issue_type: UbFulfillmentIssueType; fulfillment_action_type: UbFulfillmentActionType; root_item: UbCartItem; item_availability_info: UbCartItemAvailabilityInfo; } export interface UbCartItemAvailabilityInfo { /** This should be equal to the quantity of the item on the original order. */ items_requested: number; items_available: number; }