import { AddOrderEditLineItemInput, CreateOrderEditInput } from "../types/order-edit"; import { OrderEdit } from "../models"; import { DeepPartial, EntityManager } from "typeorm"; import { FindConfig, Selector } from "../types/common"; import { LineItemAdjustmentService, LineItemService, NewTotalsService, OrderEditItemChangeService, OrderService, TaxProviderService, TotalsService } from "./index"; import EventBusService from "./event-bus"; import { IInventoryService } from "@medusajs/types"; import { OrderEditRepository } from "../repositories/order-edit"; import { TransactionBaseService } from "../interfaces"; type InjectedDependencies = { manager: EntityManager; orderEditRepository: typeof OrderEditRepository; orderService: OrderService; totalsService: TotalsService; newTotalsService: NewTotalsService; lineItemService: LineItemService; eventBusService: EventBusService; taxProviderService: TaxProviderService; lineItemAdjustmentService: LineItemAdjustmentService; orderEditItemChangeService: OrderEditItemChangeService; inventoryService?: IInventoryService; }; export default class OrderEditService extends TransactionBaseService { static readonly Events: { CREATED: string; UPDATED: string; DECLINED: string; REQUESTED: string; CANCELED: string; CONFIRMED: string; }; protected readonly orderEditRepository_: typeof OrderEditRepository; protected readonly orderService_: OrderService; protected readonly totalsService_: TotalsService; protected readonly newTotalsService_: NewTotalsService; protected readonly lineItemService_: LineItemService; protected readonly eventBusService_: EventBusService; protected readonly taxProviderService_: TaxProviderService; protected readonly lineItemAdjustmentService_: LineItemAdjustmentService; protected readonly orderEditItemChangeService_: OrderEditItemChangeService; protected readonly inventoryService_: IInventoryService | undefined; constructor({ orderEditRepository, orderService, lineItemService, eventBusService, totalsService, newTotalsService, orderEditItemChangeService, lineItemAdjustmentService, taxProviderService, inventoryService, }: InjectedDependencies); retrieve(orderEditId: string, config?: FindConfig): Promise; listAndCount(selector: Selector & { q?: string; }, config?: FindConfig): Promise<[OrderEdit[], number]>; list(selector: Selector, config?: FindConfig): Promise; create(data: CreateOrderEditInput, context: { createdBy: string; }): Promise; update(orderEditId: string, data: DeepPartial): Promise; delete(id: string): Promise; decline(orderEditId: string, context: { declinedReason?: string; declinedBy?: 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, config?: { preserveCustomAdjustments: boolean; }): Promise; decorateTotals(orderEdit: OrderEdit): Promise; addLineItem(orderEditId: string, data: AddOrderEditLineItemInput): Promise; deleteItemChange(orderEditId: string, itemChangeId: string): Promise; requestConfirmation(orderEditId: string, context?: { requestedBy?: string; }): Promise; cancel(orderEditId: string, context?: { canceledBy?: string; }): Promise; confirm(orderEditId: string, context?: { confirmedBy?: string; }): Promise; protected retrieveActive(orderId: string, config?: FindConfig): Promise; protected deleteClonedItems(orderEditId: string): Promise; private static isOrderEditActive; } export {};