Skip to main content
Skip to main content

OrderEditService

Constructors

constructor

new OrderEditService(«destructured»)

Parameters

__namedParametersInjectedDependenciesRequired

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
eventBusService_EventBusServiceRequired
lineItemAdjustmentService_LineItemAdjustmentServiceRequired
lineItemService_LineItemServiceRequired
manager_EntityManagerRequired
newTotalsService_NewTotalsServiceRequired
orderEditItemChangeService_OrderEditItemChangeServiceRequired
orderEditRepository_Repository<OrderEdit>Required
orderService_OrderServiceRequired
taxProviderService_TaxProviderServiceRequired
totalsService_TotalsServiceRequired
transactionManager_undefined | EntityManagerRequired
EventsobjectRequired
Events.CANCELEDstringRequired

Default: "order-edit.canceled"

Events.CONFIRMEDstringRequired

Default: "order-edit.confirmed"

Events.CREATEDstringRequired

Default: "order-edit.created"

Events.DECLINEDstringRequired

Default: "order-edit.declined"

Events.REQUESTEDstringRequired

Default: "order-edit.requested"

Events.UPDATEDstringRequired

Default: "order-edit.updated"

Accessors

activeManager_

Protected get activeManager_(): EntityManager

Returns

EntityManager

EntityManagerEntityManagerRequired

inventoryService_

Protected get inventoryService_(): undefined | IInventoryService

Returns

undefined | IInventoryService

undefined \| IInventoryServiceundefined | IInventoryService

Methods

addLineItem

addLineItem(orderEditId, data): Promise<void>

Parameters

orderEditIdstringRequired

Returns

Promise<void>

PromisePromise<void>Required

atomicPhase_

Protected atomicPhase_<TResult, TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise<TResult>

Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.

TResultobjectRequired
TErrorobjectRequired

Parameters

work(transactionManager: EntityManager) => Promise<TResult>Required
the transactional work to be done
isolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>
the isolation level to be used for the work.
maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>
Potential error handler

Returns

Promise<TResult>

PromisePromise<TResult>Required
the result of the transactional work

cancel

cancel(orderEditId, context?): Promise<OrderEdit>

Parameters

orderEditIdstringRequired
contextobjectRequired

Default: {}

context.canceledBystring

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

confirm

confirm(orderEditId, context?): Promise<OrderEdit>

Parameters

orderEditIdstringRequired
contextobjectRequired

Default: {}

context.confirmedBystring

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

create

create(data, context): Promise<OrderEdit>

Parameters

contextobjectRequired
context.createdBystringRequired

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

decline

decline(orderEditId, context): Promise<OrderEdit>

Parameters

orderEditIdstringRequired
contextobjectRequired
context.declinedBystring
context.declinedReasonstring

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

decorateTotals

decorateTotals(orderEdit): Promise<OrderEdit>

Parameters

orderEditOrderEditRequired
Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order.

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

delete

delete(id): Promise<void>

Parameters

idstringRequired

Returns

Promise<void>

PromisePromise<void>Required

deleteClonedItems

Protected deleteClonedItems(orderEditId): Promise<void>

Parameters

orderEditIdstringRequired

Returns

Promise<void>

PromisePromise<void>Required

deleteItemChange

deleteItemChange(orderEditId, itemChangeId): Promise<void>

Parameters

orderEditIdstringRequired
itemChangeIdstringRequired

Returns

Promise<void>

PromisePromise<void>Required

list

list(selector, config?): Promise<OrderEdit[]>

Parameters

selectorSelector<OrderEdit>Required

Returns

Promise<OrderEdit[]>

PromisePromise<OrderEdit[]>Required

listAndCount

listAndCount(selector, config?): Promise<[OrderEdit[], number]>

Parameters

selectorSelector<OrderEdit> & { q?: string }Required

Returns

Promise<[OrderEdit[], number]>

PromisePromise<[OrderEdit[], number]>Required

refreshAdjustments

refreshAdjustments(orderEditId, config?): Promise<void>

Parameters

orderEditIdstringRequired
configobjectRequired
config.preserveCustomAdjustmentsbooleanRequired

Default: false

Returns

Promise<void>

PromisePromise<void>Required

removeLineItem

removeLineItem(orderEditId, lineItemId): Promise<void>

Parameters

orderEditIdstringRequired
lineItemIdstringRequired

Returns

Promise<void>

PromisePromise<void>Required

requestConfirmation

requestConfirmation(orderEditId, context?): Promise<OrderEdit>

Parameters

orderEditIdstringRequired
contextobjectRequired

Default: {}

context.requestedBystring

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

retrieve

retrieve(orderEditId, config?): Promise<OrderEdit>

Parameters

orderEditIdstringRequired
configFindConfig<OrderEdit>Required

Default: {}

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

retrieveActive

Protected retrieveActive(orderId, config?): Promise<undefined | null | OrderEdit>

Parameters

orderIdstringRequired
configFindConfig<OrderEdit>Required

Default: {}

Returns

Promise<undefined | null | OrderEdit>

PromisePromise<undefined | null | OrderEdit>Required

shouldRetryTransaction_

Protected shouldRetryTransaction_(err): boolean

Parameters

errRecord<string, unknown> | { code: string }Required

Returns

boolean

booleanboolean

update

update(orderEditId, data): Promise<OrderEdit>

Parameters

orderEditIdstringRequired
dataDeepPartial<OrderEdit>Required

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

updateLineItem

updateLineItem(orderEditId, itemId, data): Promise<void>

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

Parameters

orderEditIdstringRequired
itemIdstringRequired
dataobjectRequired
data.quantitynumberRequired

Returns

Promise<void>

PromisePromise<void>Required

withTransaction

withTransaction(transactionManager?): OrderEditService

Parameters

transactionManagerEntityManager

Returns

OrderEditService

defaultOrderEditServiceRequired

isOrderEditActive

Static Private isOrderEditActive(orderEdit): boolean

Parameters

orderEditOrderEditRequired
Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order.

Returns

boolean

booleanboolean
Was this section helpful?