AbstractFulfillmentService
internal.internal.AbstractFulfillmentService
Fulfillment Provider interface Fullfillment provider plugin services should extend the AbstractFulfillmentService from this file
Implements
Properties
Methods
calculatePrice
Abstract
calculatePrice(optionData
, data
, cart
): Promise
<number
>
Used to calculate a price for a given shipping option.
Parameters
Returns
Promise
<number
>
Promise
Promise<number>Required
Promise
Promise<number>RequiredImplementation of
FulfillmentService.calculatePrice
canCalculate
Abstract
canCalculate(data
): Promise
<boolean
>
Used to determine if a shipping option can have a calculated price
Parameters
Returns
Promise
<boolean
>
Promise
Promise<boolean>Required
Promise
Promise<boolean>RequiredImplementation of
FulfillmentService.canCalculate
cancelFulfillment
Abstract
cancelFulfillment(fulfillment
): Promise
<any
>
Cancel a fulfillment using data from the fulfillment
Parameters
Returns
Promise
<any
>
Promise
Promise<any>Required
Promise
Promise<any>RequiredImplementation of
FulfillmentService.cancelFulfillment
createFulfillment
Abstract
createFulfillment(data
, items
, order
, fulfillment
): Promise
<FulfillmentProviderData
>
Create a fulfillment using data from shipping method, line items, and fulfillment. All from the order.
The returned value of this method will populate the fulfillment.data
field.
Parameters
Returns
Promise
<FulfillmentProviderData
>
Implementation of
FulfillmentService.createFulfillment
createReturn
Abstract
createReturn(returnOrder
): Promise
<Record<string
, unknown
>>
Used to create a return order. Should return the data necessary for future operations on the return; in particular the data may be used to receive documents attached to the return.
Parameters
Returns
Promise
<Record<string
, unknown
>>
Promise
Promise<Record<string, unknown>>Required
Promise
Promise<Record<string, unknown>>RequiredImplementation of
FulfillmentService.createReturn
getFulfillmentDocuments
Abstract
getFulfillmentDocuments(data
): Promise
<any
>
Used to retrieve documents associated with a fulfillment.
Parameters
Returns
Promise
<any
>
Promise
Promise<any>Required
Promise
Promise<any>RequiredImplementation of
FulfillmentService.getFulfillmentDocuments
getFulfillmentOptions
Abstract
getFulfillmentOptions(): Promise
<any
[]>
Called before a shipping option is created in Admin. The method should return all of the options that the fulfillment provider can be used with, and it is here the distinction between different shipping options are enforced. For example, a fulfillment provider may offer Standard Shipping and Express Shipping as fulfillment options, it is up to the store operator to create shipping options in Medusa that are offered to the customer.
Returns
Promise
<any
[]>
Promise
Promise<any[]>Required
Promise
Promise<any[]>RequiredImplementation of
FulfillmentService.getFulfillmentOptions
getIdentifier
getIdentifier(): string
Return a unique identifier to retrieve the fulfillment plugin provider
Returns
string
string
stringImplementation of
FulfillmentService.getIdentifier
getReturnDocuments
Abstract
getReturnDocuments(data
): Promise
<any
>
Used to retrieve documents related to a return order.
Parameters
data
Record<string, unknown>RequiredReturns
Promise
<any
>
Promise
Promise<any>Required
Promise
Promise<any>RequiredImplementation of
FulfillmentService.getReturnDocuments
getShipmentDocuments
Abstract
getShipmentDocuments(data
): Promise
<any
>
Used to retrieve documents related to a shipment.
Parameters
data
Record<string, unknown>RequiredReturns
Promise
<any
>
Promise
Promise<any>Required
Promise
Promise<any>RequiredImplementation of
FulfillmentService.getShipmentDocuments
retrieveDocuments
Abstract
retrieveDocuments(fulfillmentData
, documentType
): Promise
<any
>
Parameters
fulfillmentData
Record<string, unknown>RequireddocumentType
"label" | "invoice"RequiredReturns
Promise
<any
>
Promise
Promise<any>Required
Promise
Promise<any>RequiredImplementation of
FulfillmentService.retrieveDocuments
validateFulfillmentData
Abstract
validateFulfillmentData(optionData
, data
, cart
): Promise
<Record<string
, unknown
>>
Called before a shipping method is set on a cart to ensure that the data sent with the shipping method is valid. The data object may contain extra data about the shipment such as an id of a drop point. It is up to the fulfillment provider to enforce that the correct data is being sent through.
Parameters
Returns
Promise
<Record<string
, unknown
>>
Promise
Promise<Record<string, unknown>>Requiredthe data to populate cart.shipping_methods.$.data
this
is usually important for future actions like generating shipping labels
Promise
Promise<Record<string, unknown>>Requiredcart.shipping_methods.$.data
this
is usually important for future actions like generating shipping labelsImplementation of
FulfillmentService.validateFulfillmentData
validateOption
Abstract
validateOption(data
): Promise
<boolean
>
Called before a shipping option is created in Admin. Use this to ensure that a fulfillment option does in fact exist.
Parameters
Returns
Promise
<boolean
>
Promise
Promise<boolean>Required
Promise
Promise<boolean>Required