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](/references/services/interfaces/IInventoryService)

Returns

undefined | IInventoryService

undefined \| IInventoryServiceundefined | IInventoryService

Methods

addLineItem

**addLineItem**(orderEditId, data): Promise&#60;void&#62;

Parameters

orderEditIdstringRequired

Returns

Promise<void>

PromisePromise<void>Required

atomicPhase_

Protected **atomicPhase_**<TypeParameter TResult, TypeParameter TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise&#60;TResult&#62;

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&#60;[OrderEdit](/references/services/classes/OrderEdit)&#62;

Parameters

orderEditIdstringRequired
contextobjectRequired

Default: {}

context.canceledBystring

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

confirm

**confirm**(orderEditId, context?): Promise&#60;[OrderEdit](/references/services/classes/OrderEdit)&#62;

Parameters

orderEditIdstringRequired
contextobjectRequired

Default: {}

context.confirmedBystring

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

create

**create**(data, context): Promise&#60;[OrderEdit](/references/services/classes/OrderEdit)&#62;

Parameters

contextobjectRequired
context.createdBystringRequired

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

decline

**decline**(orderEditId, context): Promise&#60;[OrderEdit](/references/services/classes/OrderEdit)&#62;

Parameters

orderEditIdstringRequired
contextobjectRequired
context.declinedBystring
context.declinedReasonstring

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

decorateTotals

**decorateTotals**(orderEdit): Promise&#60;[OrderEdit](/references/services/classes/OrderEdit)&#62;

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&#60;void&#62;

Parameters

idstringRequired

Returns

Promise<void>

PromisePromise<void>Required

deleteClonedItems

Protected **deleteClonedItems**(orderEditId): Promise&#60;void&#62;

Parameters

orderEditIdstringRequired

Returns

Promise<void>

PromisePromise<void>Required

deleteItemChange

**deleteItemChange**(orderEditId, itemChangeId): Promise&#60;void&#62;

Parameters

orderEditIdstringRequired
itemChangeIdstringRequired

Returns

Promise<void>

PromisePromise<void>Required

list

**list**(selector, config?): Promise&#60;[OrderEdit](/references/services/classes/OrderEdit)[]&#62;

Parameters

selectorSelector<OrderEdit>Required

Returns

Promise<OrderEdit[]>

PromisePromise<OrderEdit[]>Required

listAndCount

**listAndCount**(selector, config?): Promise&#60;[[OrderEdit](/references/services/classes/OrderEdit)[], number]&#62;

Parameters

selectorSelector<OrderEdit> & &#123; q?: string &#125;Required

Returns

Promise<[OrderEdit[], number]>

PromisePromise<[OrderEdit[], number]>Required

refreshAdjustments

**refreshAdjustments**(orderEditId, config?): Promise&#60;void&#62;

Parameters

orderEditIdstringRequired
configobjectRequired
config.preserveCustomAdjustmentsbooleanRequired

Default: false

Returns

Promise<void>

PromisePromise<void>Required

removeLineItem

**removeLineItem**(orderEditId, lineItemId): Promise&#60;void&#62;

Parameters

orderEditIdstringRequired
lineItemIdstringRequired

Returns

Promise<void>

PromisePromise<void>Required

requestConfirmation

**requestConfirmation**(orderEditId, context?): Promise&#60;[OrderEdit](/references/services/classes/OrderEdit)&#62;

Parameters

orderEditIdstringRequired
contextobjectRequired

Default: {}

context.requestedBystring

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

retrieve

**retrieve**(orderEditId, config?): Promise&#60;[OrderEdit](/references/services/classes/OrderEdit)&#62;

Parameters

orderEditIdstringRequired
configFindConfig<OrderEdit>Required

Default: {}

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

retrieveActive

Protected **retrieveActive**(orderId, config?): Promise&#60;undefined \| null \| [OrderEdit](/references/services/classes/OrderEdit)&#62;

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> | &#123; code: string &#125;Required

Returns

boolean

booleanboolean

update

**update**(orderEditId, data): Promise&#60;[OrderEdit](/references/services/classes/OrderEdit)&#62;

Parameters

orderEditIdstringRequired
dataDeepPartial<OrderEdit>Required

Returns

Promise<OrderEdit>

PromisePromise<OrderEdit>Required

updateLineItem

**updateLineItem**(orderEditId, itemId, data): Promise&#60;void&#62;

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](/references/services/classes/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?