Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
10 KiB
displayed_sidebar
| displayed_sidebar |
|---|
| jsClientSidebar |
Class: AbstractFulfillmentService
internal.internal.AbstractFulfillmentService
Fulfillment Provider interface Fullfillment provider plugin services should extend the AbstractFulfillmentService from this file
Implements
Properties
config
• Protected Optional Readonly config: Record<string, unknown>
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:79
container
• Protected Readonly container: MedusaContainer
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:78
identifier
▪ Static identifier: string
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:81
Methods
calculatePrice
▸ Abstract calculatePrice(optionData, data, cart): Promise<number>
Used to calculate a price for a given shipping option.
Parameters
| Name | Type |
|---|---|
optionData |
ShippingOptionData |
data |
FulfillmentProviderData |
cart |
Cart |
Returns
Promise<number>
Implementation of
FulfillmentService.calculatePrice
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:87
canCalculate
▸ Abstract canCalculate(data): Promise<boolean>
Used to determine if a shipping option can have a calculated price
Parameters
| Name | Type |
|---|---|
data |
ShippingOptionData |
Returns
Promise<boolean>
Implementation of
FulfillmentService.canCalculate
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:86
cancelFulfillment
▸ Abstract cancelFulfillment(fulfillment): Promise<any>
Cancel a fulfillment using data from the fulfillment
Parameters
| Name | Type |
|---|---|
fulfillment |
FulfillmentProviderData |
Returns
Promise<any>
Implementation of
FulfillmentService.cancelFulfillment
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:89
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
| Name | Type |
|---|---|
data |
ShippingMethodData |
items |
LineItem[] |
order |
Order |
fulfillment |
Fulfillment |
Returns
Promise<FulfillmentProviderData>
Implementation of
FulfillmentService.createFulfillment
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:88
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
| Name | Type |
|---|---|
returnOrder |
CreateReturnType |
Returns
Promise<Record<string, unknown>>
Implementation of
FulfillmentService.createReturn
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:90
getFulfillmentDocuments
▸ Abstract getFulfillmentDocuments(data): Promise<any>
Used to retrieve documents associated with a fulfillment.
Parameters
| Name | Type |
|---|---|
data |
FulfillmentProviderData |
Returns
Promise<any>
Implementation of
FulfillmentService.getFulfillmentDocuments
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:91
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[]>
Implementation of
FulfillmentService.getFulfillmentOptions
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:83
getIdentifier
▸ getIdentifier(): string
Return a unique identifier to retrieve the fulfillment plugin provider
Returns
string
Implementation of
FulfillmentService.getIdentifier
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:82
getReturnDocuments
▸ Abstract getReturnDocuments(data): Promise<any>
Used to retrieve documents related to a return order.
Parameters
| Name | Type |
|---|---|
data |
Record<string, unknown> |
Returns
Promise<any>
Implementation of
FulfillmentService.getReturnDocuments
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:92
getShipmentDocuments
▸ Abstract getShipmentDocuments(data): Promise<any>
Used to retrieve documents related to a shipment.
Parameters
| Name | Type |
|---|---|
data |
Record<string, unknown> |
Returns
Promise<any>
Implementation of
FulfillmentService.getShipmentDocuments
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:93
retrieveDocuments
▸ Abstract retrieveDocuments(fulfillmentData, documentType): Promise<any>
Parameters
| Name | Type |
|---|---|
fulfillmentData |
Record<string, unknown> |
documentType |
"label" | "invoice" |
Returns
Promise<any>
Implementation of
FulfillmentService.retrieveDocuments
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:94
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
| Name | Type |
|---|---|
optionData |
ShippingOptionData |
data |
FulfillmentProviderData |
cart |
Cart |
Returns
Promise<Record<string, unknown>>
the data to populate cart.shipping_methods.$.data this
is usually important for future actions like generating shipping labels
Implementation of
FulfillmentService.validateFulfillmentData
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:84
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
| Name | Type |
|---|---|
data |
ShippingOptionData |
Returns
Promise<boolean>
Implementation of
FulfillmentService.validateOption
Defined in
packages/medusa/dist/interfaces/fulfillment-service.d.ts:85