--- displayed_sidebar: servicesSidebar --- import TypeList from "@site/src/components/TypeList" # FulfillmentService Handles Fulfillments ## constructor ### Parameters ___ ## Properties `","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"__moduleDeclaration__","type":"`Record`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="FulfillmentService"/> ___ ## Accessors ### activeManager\_ #### Returns ___ ## Methods ### withTransaction #### Parameters #### Returns ### shouldRetryTransaction\_ #### Parameters ` \\| `object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="shouldRetryTransaction_"/> #### Returns ### 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. #### Type Parameters #### Parameters Promise<TResult>","description":"the transactional work to be done","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationOrErrorHandler","type":"`IsolationLevel` \\| (`error`: TError) => Promise<void \\| TResult>","description":"the isolation level to be used for the work.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"maybeErrorHandlerOrDontFail","type":"(`error`: TError) => Promise<void \\| TResult>","description":"Potential error handler","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="atomicPhase_"/> #### Returns ### partitionItems\_ #### Parameters #### Returns ### getFulfillmentItems\_ Retrieves the order line items, given an array of items. #### Parameters #### Returns ### 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 #### Returns ### retrieve Retrieves a fulfillment by its id. #### Parameters #### 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 #### 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 #### Returns