import { Order, DeclineOrderOption } from './order.model'; import { ReturnModelType, DocumentType } from '@typegoose/typegoose'; import { AcceptOrderOption, CreateOrderOption, ORDER_STATUS, OrderOptions, GetRestaurantSlotOrdersDto, OrderDto, DraftItem } from './order.interface'; import { Restaurant } from '~backend/business/business.model'; import { RestaurantService } from '~backend/business/restaurant/restaurant.service'; import { PosEventService } from '~backend/pos-event/pos-event.service'; import { Bill } from '~core/modules/order/definitions'; import { ConfigService } from '@nestjs/config'; import { PromotionDoc } from '~core/modules/promotion'; import { VoucherClaim } from '~backend/marketing/marketing.model'; import { PaymentService } from '~backend/payment/payment.service'; import { Benefit } from '~backend/marketing/membership/membership.interface'; import { VoucherService } from '~backend/marketing/voucher/voucher.service'; import { MailService } from '~backend/mail/mail.service'; import { Address, DeliveryDto, DeliveryQuote, DELIVERY_PROVIDER_TYPE, DELIVERY_STATUS, DELIVERY_TYPE, Product, QuoteOption, DeliveryCancelDto, Driver } from './delivery/delivery.interface'; import { DeliveryService } from './delivery/delivery.service'; import { UserService } from '~backend/user/user.service'; import { UserNotificationService } from '~backend/user/notification/notification.service'; import { PublicSettingService } from '~backend/public-setting/public-setting.service'; import { WebsocketService } from '~backend/websocket/websocket.service'; import { CouchdbStaticService } from '~backend/couchdb/couchdb-static/couchdb-static.service'; import { ClickUpService } from '~backend/clickup/clickup.service'; export declare class OrderService { private readonly couchdbStaticService; readonly orderModel: ReturnModelType; private readonly configService; private readonly posEventService; private readonly paymentService; private readonly voucherService; private readonly deliveryService; private readonly restaurantService; private readonly userService; private readonly websocketService; private readonly publicSettingService; private readonly mailService; private readonly userNotificationService; private readonly clickupService; private readonly logger; constructor(couchdbStaticService: CouchdbStaticService, orderModel: ReturnModelType, configService: ConfigService, posEventService: PosEventService, paymentService: PaymentService, voucherService: VoucherService, deliveryService: DeliveryService, restaurantService: RestaurantService, userService: UserService, websocketService: WebsocketService, publicSettingService: PublicSettingService, mailService: MailService, userNotificationService: UserNotificationService, clickupService: ClickUpService); getByRestaurant(id: string): Promise; getByUser(id: string): Promise; find({ id, skip, limit, }: { id: string; skip?: number; limit?: number; }): Promise; /** * QR Code orde * - single query to Display * - frontend, split to v2 and v3. * - QRCode, many order to 1 bill, frontend group, backend */ getUserActiveOrders(userId: string): Promise; getRestaurantDineInOrders({ restaurantId, slot, status }: GetRestaurantSlotOrdersDto, afterTimestamp?: Date): Promise[]>; /** @deprecated */ getSlotOrders(slot: any): Promise; findOrderById(orderId: string): Promise; findById(orderId: string): Promise>; findDelivery(id: string): Promise; changeDeliveryStatus(id: string, status: DELIVERY_STATUS): Promise; updateTransactionId(id: string, transactionId: string): Promise; updateStatus(orderId: string, status: ORDER_STATUS): Promise; calculateOrder({ restaurant, option, promotions, vouchers, benefits, roundToNearest, deliveryQuotes, }: { restaurant: Restaurant; option: CreateOrderOption; promotions: PromotionDoc[]; vouchers: VoucherClaim[]; benefits?: Benefit.Benefit[]; roundToNearest?: number; deliveryQuotes?: DeliveryQuote[]; }): Promise; calculateQueue({ restaurant, items, roundToNearest, }: { restaurant: Restaurant; items: DraftItem[]; roundToNearest?: number; }): Promise; newOrder(option: CreateOrderOption, creditPayment?: { memberId: string; businessId: string; paymentAmount: number; }): Promise; accept(id: string, option: AcceptOrderOption): Promise; decline(id: string, option: DeclineOrderOption): Promise; populateBill(order: Order, restaurantId: string): Promise; deliveryQuote(body: QuoteOption): Promise; createPrepareOrder(order: Order, restaurantName?: string): Promise; refreshDeliveryProvider(orderId: string): Promise; automateManualDelivery(order: Order): Promise; /** * Function to calculate total price of subitems * @param subItems * @returns */ private getSubItemsPrice; private computeProductPrice; createDeliveryOrder(order: Order): Promise; createDeliveryDto(restaurantId: string, userId: string, destination: Address, products: Product[], selectedOption?: DELIVERY_TYPE): Promise; /** * * @param dto * @param userId */ getDeliveryOption(dto: CreateOrderOption, userId?: string): Promise; deliveryWebhook(type: DELIVERY_PROVIDER_TYPE, body: any): Promise; private filterPreorder; onProviderUpdate(orderData: Order, providerIndex: number, prevDriver: Driver, prevStatus: DELIVERY_STATUS): Promise; cancelDelivery(dto: DeliveryCancelDto): Promise; getOrders(body: OrderDto): Promise; /** * auto reject e payment transaction order at 23:55 */ private getSubItemsTotal; }