OrderService
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>getTotalsRelations
anyRequiredmanager_
EntityManagerRequiredorderRepository_
Repository<Order> & { findOneWithRelations: Method findOneWithRelations ; findWithRelations: Method findWithRelations }RequiredtransactionManager_
undefined | EntityManagerRequiredEvents
objectRequiredEvents.CANCELED
stringRequiredEvents.COMPLETED
stringRequiredEvents.FULFILLMENT_CANCELED
stringRequiredEvents.FULFILLMENT_CREATED
stringRequiredEvents.GIFT_CARD_CREATED
stringRequiredEvents.ITEMS_RETURNED
stringRequiredEvents.PAYMENT_CAPTURED
stringRequiredEvents.PAYMENT_CAPTURE_FAILED
stringRequiredEvents.PLACED
stringRequiredEvents.REFUND_CREATED
stringRequiredEvents.REFUND_FAILED
stringRequiredEvents.RETURN_ACTION_REQUIRED
stringRequiredEvents.RETURN_REQUESTED
stringRequiredEvents.SHIPMENT_CREATED
stringRequiredEvents.SWAP_CREATED
stringRequiredEvents.UPDATED
stringRequiredAccessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
addShippingMethod
Parameters
Returns
archive
Archives an order. It only alloved, if the order has been fulfilled and payment has been captured.
Parameters
orderId
stringRequiredReturns
atomicPhase_
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.
Parameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
Promise<TResult>Requiredcancel
Cancels an order. Throws if fulfillment process has been initiated. Throws if payment process has been initiated.
Parameters
orderId
stringRequiredReturns
cancelFulfillment
Cancels a fulfillment (if related to an order)
Parameters
fulfillmentId
stringRequiredReturns
capturePayment
Captures payment for an order.
Parameters
orderId
stringRequiredReturns
completeOrder
Parameters
orderId
stringRequiredReturns
createFromCart
Creates an order from a cart
Parameters
Returns
createFulfillment
Creates fulfillments for an order. In a situation where the order has more than one shipping method, we need to partition the order items, such that they can be sent to their respective fulfillment provider.
Parameters
orderId
stringRequiredconfig
objectconfig.location_id
stringconfig.metadata
Record<string, unknown>config.no_notification
booleanReturns
createGiftCardsFromLineItem_
Parameters
manager
EntityManagerRequiredReturns
createRefund
Refunds a given amount back to the customer.
Parameters
orderId
stringRequiredrefundAmount
numberRequiredreason
stringRequirednote
stringconfig
objectconfig.no_notification
booleanReturns
createShipment
Adds a shipment to the order to indicate that an order has left the warehouse. Will ask the fulfillment provider for any documents that may have been created in regards to the shipment.
Parameters
orderId
stringRequiredfulfillmentId
stringRequiredtrackingLinks
TrackingLink[]config
objectconfig.metadata
Record<string, unknown>Requiredconfig.no_notification
booleanReturns
decorateTotals
**decorateTotals**(order, totalsFields?): Promise<[Order](/references/js-client/internal/classes/internal.Order)>
Parameters
totalsFields
string[]Returns
**decorateTotals**(order, context?): Promise<[Order](/references/js-client/internal/classes/internal.Order)>
Parameters
context
TotalsContextReturns
decorateTotalsLegacy
Parameters
totalsFields
string[]Returns
getFulfillmentItems
Retrieves the order line items, given an array of items.
Parameters
Returns
list
Parameters
config
FindConfig<Order>Returns
listAndCount
Parameters
config
FindConfig<Order>Returns
registerReturnReceived
Handles receiving a return. This will create a refund to the customer. If the returned items don't match the requested items the return status will be updated to requires_action. This behaviour is useful in situations where a custom refund amount is requested, but the returned items are not matching the requested items. Setting the allowMismatch argument to true, will process the return, ignoring any mismatches.
Parameters
orderId
stringRequiredcustomRefundAmount
numberReturns
retrieve
Gets an order by id.
Parameters
orderId
stringRequiredconfig
FindConfig<Order>Returns
retrieveByCartId
Gets an order by cart id.
Parameters
cartId
stringRequiredconfig
FindConfig<Order>Returns
retrieveByCartIdWithTotals
Parameters
cartId
stringRequiredoptions
FindConfig<Order>Returns
retrieveByExternalId
Gets an order by id.
Parameters
externalId
stringRequiredconfig
FindConfig<Order>Returns
retrieveLegacy
Parameters
config
FindConfig<Order>Returns
retrieveWithTotals
Parameters
Returns
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
booleantransformQueryForTotals
Parameters
Returns
object
objectupdate
Updates an order. Metadata updates should
use dedicated method, e.g. setMetadata
etc. The function
will throw errors if metadata updates are attempted.
Parameters
orderId
stringRequiredReturns
updateBillingAddress
Updates the order's billing address.
Parameters
Returns
Promise
Promise<void>RequiredupdateShippingAddress
Updates the order's shipping address.
Parameters
Returns
Promise
Promise<void>RequiredvalidateFulfillmentLineItem
Checks that a given quantity of a line item can be fulfilled. Fails if the fulfillable quantity is lower than the requested fulfillment quantity. Fulfillable quantity is calculated by subtracting the already fulfilled quantity from the quantity that was originally purchased.
Parameters
quantity
numberRequiredReturns
null \| LineItem
null | LineItemwithTransaction
Parameters
transactionManager
EntityManager