Skip to main content

Class: DraftOrderService

Handles draft orders

implements {BaseService}

Hierarchy

  • "medusa-interfaces"

    DraftOrderService

Constructors

constructor

new DraftOrderService(__namedParameters)

Parameters

NameType
__namedParametersObject

Overrides

BaseService.constructor

Defined in

services/draft-order.js:15

Properties

Events

Static Events: Object

Type declaration

NameType
CREATEDstring
UPDATEDstring

Defined in

services/draft-order.js:10

Methods

create

create(data): Promise<DraftOrder>

Creates a draft order.

Parameters

NameTypeDescription
dataanydata to create draft order from

Returns

Promise<DraftOrder>

the created draft order

Defined in

services/draft-order.js:233


delete

delete(draftOrderId): Promise<any>

Deletes draft order idempotently.

Parameters

NameTypeDescription
draftOrderIdstringid of draft order to delete

Returns

Promise<any>

empty promise

Defined in

services/draft-order.js:135


list

list(selector, config?): Promise<DraftOrder>

Lists draft orders

Parameters

NameTypeDescription
selectoranyquery object for find
configanyconfigurable attributes for find

Returns

Promise<DraftOrder>

list of draft orders

Defined in

services/draft-order.js:215


listAndCount

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

Lists draft orders alongside the count

Parameters

NameTypeDescription
selectoranyquery selector to filter draft orders
configanyquery config

Returns

Promise<DraftOrder[]>

draft orders

Defined in

services/draft-order.js:161


registerCartCompletion

registerCartCompletion(doId, orderId): Promise<any>

Registers a draft order as completed, when an order has been completed.

Parameters

NameTypeDescription
doIdstringid of draft order to complete
orderIdstringid of order completed from draft order cart

Returns

Promise<any>

the created order

Defined in

services/draft-order.js:336


retrieve

retrieve(id, config?): Promise<DraftOrder>

Retrieves a draft order with the given id.

Parameters

NameTypeDescription
idstringid of the draft order to retrieve
configanyquery object for findOne

Returns

Promise<DraftOrder>

the draft order

Defined in

services/draft-order.js:84


retrieveByCartId

retrieveByCartId(cartId, config?): Promise<DraftOrder>

Retrieves a draft order based on its associated cart id

Parameters

NameTypeDescription
cartIdstringcart id that the draft orders's cart has
configanyquery object for findOne

Returns

Promise<DraftOrder>

the draft order

Defined in

services/draft-order.js:111


update

update(doId, data): Promise<DraftOrder>

Updates a draft order with the given data

Parameters

NameTypeDescription
doIdstringid of the draft order
dataDraftOrdervalues to update the order with

Returns

Promise<DraftOrder>

the updated draft order

Defined in

services/draft-order.js:357


withTransaction

withTransaction(transactionManager): DraftOrderService

Parameters

NameType
transactionManagerany

Returns

DraftOrderService

Defined in

services/draft-order.js:56