import IBooking, { IBookingFees, IBookingItem } from '../../Interfaces/Booking'; import { IExpeditionInfo } from '../../Interfaces/Customer'; import { IFilledDimensionUnits } from '../../Interfaces/Declination'; import Space from '../Space'; import { BaseServiceClass } from '../baseService'; import { ICustomPriceItem } from '../../Interfaces/G2'; export default class Booking extends BaseServiceClass { assignToClient: ({ clientId, clientRef, overrideExistingClient }: { clientId?: string | undefined; clientRef?: any; overrideExistingClient?: boolean | undefined; }, doNotSave?: boolean) => Promise; assignToUser: (userRef: string, save?: boolean) => Promise; addOrUpdateItem: ({ item: { sku, name, price, regPrice, parentSlug, discount, client_discount, units, custom_id }, qty }: { item: { sku: string; name: string; price: number; regPrice?: number | undefined; discount: number; client_discount?: number | undefined; parentSlug: string; units?: IFilledDimensionUnits[] | undefined; custom_id?: string | undefined; }; qty?: number | undefined; }) => Promise; removeItem: ({ item: { sku, custom_id } }: { item: { sku?: string | undefined; custom_id?: string | undefined; }; }) => Promise; recalculatePalletFee: () => void; /** * Set booking to approved status. Creates corresponding cart also. * @param priceList - Optionnal. Customers price list * @param fees - Optionnal. If provided, product fees fetching in array instead of database */ setToBeApproved: (priceList?: ICustomPriceItem[], fees?: IBookingFees) => Promise; approve: () => Promise; /** * Set booking as refused by client. Also deletes associated cart if found. */ newRefuse: () => Promise; /** * Refuse booking sumbited and reopen booking * @deprecated Old function logic, kept for compatibility purposes. New logic found in {@link newRefuse} */ refuse: () => Promise; /** * Re-open booking for modifications. Also deletes associated cart if found. */ reOpen: () => Promise; cancel: () => Promise; setIsDone: () => Promise; calculateRegularPriceForItem: (item: IBookingItem) => number; calculateShippingFeeQte: (dataToCheck?: IBooking) => number; calculateShippingAmount: (dataToCheck?: IBooking, useDiscountAmount?: boolean) => number; createOrder: ({ space, sendMail, priceList, fees }: { space: Space; sendMail?: boolean | undefined; priceList?: ICustomPriceItem[] | undefined; fees?: IBookingFees | undefined; }) => Promise; delete: () => Promise; deleteOrder: () => Promise; setIsFromWeb: (isFromWeb?: boolean, saveToDatabase?: boolean) => Promise; setType: (type: 'pickup' | 'shipping') => Promise; setNotes: (notes: string) => Promise; setPalettesQty: (palettes_qty: number) => Promise; setShippingPrice: (shipping_price: number) => Promise; setShippingAddress: (address: IExpeditionInfo, save?: boolean) => Promise; setBillingAddress: (address: IExpeditionInfo, save?: boolean) => Promise; addDiscount: (discount: number, isPercent: boolean) => Promise; setPaymentOnReception: (paymentOnReception: boolean, percent?: number) => Promise; setContactInfo: (contactInfo: { contact_firstname?: string; contact_name?: string; contact_email?: string; contact_phone?: string; }, dataToUse?: IBooking, saveToObj?: boolean) => Promise; setShippingPromo: (values: IBooking['shipping_discount']) => Promise; calculateShippingWithDiscount: () => number; }