import { DeepPartial, EntityManager } from "typeorm"; import { FindConfig, Selector } from "../types/common"; import { OrderEditRepository } from "../repositories/order-edit"; import { OrderEdit } from "../models"; import { TransactionBaseService } from "../interfaces"; import { EventBusService, LineItemAdjustmentService, LineItemService, OrderEditItemChangeService, OrderService, TaxProviderService, TotalsService } from "./index"; import { AddOrderEditLineItemInput, CreateOrderEditInput } from "../types/order-edit"; declare type InjectedDependencies = { manager: EntityManager; orderEditRepository: typeof OrderEditRepository; orderService: OrderService; totalsService: TotalsService; lineItemService: LineItemService; eventBusService: EventBusService; taxProviderService: TaxProviderService; lineItemAdjustmentService: LineItemAdjustmentService; orderEditItemChangeService: OrderEditItemChangeService; }; export default class OrderEditService extends TransactionBaseService { static readonly Events: { CREATED: string; UPDATED: string; DECLINED: string; REQUESTED: string; CANCELED: string; CONFIRMED: string; }; protected readonly manager_: EntityManager; protected transactionManager_: EntityManager | undefined; protected readonly orderEditRepository_: typeof OrderEditRepository; protected readonly orderService_: OrderService; protected readonly totalsService_: TotalsService; protected readonly lineItemService_: LineItemService; protected readonly eventBusService_: EventBusService; protected readonly taxProviderService_: TaxProviderService; protected readonly lineItemAdjustmentService_: LineItemAdjustmentService; protected readonly orderEditItemChangeService_: OrderEditItemChangeService; constructor({ manager, orderEditRepository, orderService, lineItemService, eventBusService, totalsService, orderEditItemChangeService, lineItemAdjustmentService, taxProviderService, }: InjectedDependencies); retrieve(orderEditId: string, config?: FindConfig): Promise; listAndCount(selector: Selector & { q?: string; }, config?: FindConfig): Promise<[OrderEdit[], number]>; list(selector: Selector, config?: FindConfig): Promise; /** * Compute and return the different totals from the order edit id * @param orderEditId */ getTotals(orderEditId: string): Promise<{ shipping_total: number; gift_card_total: number; gift_card_tax_total: number; discount_total: number; tax_total: number | null; subtotal: number; difference_due: number; total: number; }>; create(data: CreateOrderEditInput, context: { loggedInUserId: string; }): Promise; update(orderEditId: string, data: DeepPartial): Promise; delete(id: string): Promise; decline(orderEditId: string, context: { declinedReason?: string; loggedInUserId?: string; }): Promise; /** * Create or update order edit item change line item and apply the quantity * - If the item change already exists then update the quantity of the line item as well as the line adjustments * - If the item change does not exist then create the item change of type update and apply the quantity as well as update the line adjustments * @param orderEditId * @param itemId * @param data */ updateLineItem(orderEditId: string, itemId: string, data: { quantity: number; }): Promise; removeLineItem(orderEditId: string, lineItemId: string): Promise; refreshAdjustments(orderEditId: string): Promise; decorateTotals(orderEdit: OrderEdit): Promise; addLineItem(orderEditId: string, data: AddOrderEditLineItemInput): Promise; deleteItemChange(orderEditId: string, itemChangeId: string): Promise; requestConfirmation(orderEditId: string, context?: { loggedInUserId?: string; }): Promise; cancel(orderEditId: string, context?: { loggedInUserId?: string; }): Promise; confirm(orderEditId: string, context?: { loggedInUserId?: string; }): Promise; protected retrieveActive(orderId: string, config?: FindConfig): Promise; protected deleteClonedItems(orderEditId: string): Promise; private static isOrderEditActive; } export {};