FulfillmentService
Handles Fulfillments
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__container__
anyRequired__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
withTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
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.
Type Parameters
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
Promise<TResult>RequiredpartitionItems_
Parameters
Returns
FulfillmentItemPartition[]
FulfillmentItemPartition[]RequiredgetFulfillmentItems_
Retrieves the order line items, given an array of items.
Parameters
order
CreateFulfillmentOrderRequireditems
FulFillmentItemType[]RequiredReturns
validateFulfillmentLineItem_
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
retrieve
Retrieves a fulfillment by its id.
Parameters
fulfillmentId
stringRequiredDefault: {}
Returns
createFulfillment
Creates an order fulfillment If items needs to be fulfilled by different provider, we make sure to partition those items, and create fulfillment for those partitions.
Parameters
order
CreateFulfillmentOrderRequireditemsToFulfill
FulFillmentItemType[]RequiredDefault: {}
Returns
cancelFulfillment
Cancels a fulfillment with the fulfillment provider. Will decrement the fulfillment_quantity on the line items associated with the fulfillment. Throws if the fulfillment has already been shipped.
Parameters
Returns
createShipment
Creates a shipment by marking a fulfillment as shipped. Adds tracking links and potentially more metadata.
Parameters
fulfillmentId
stringRequiredconfig
CreateShipmentConfigRequiredtrackingLinks
object[]