docs: update recipes following 2.2 release (#10868)
This commit is contained in:
@@ -453,9 +453,15 @@ This method accepts the shipping option's `data` field, which will hold the data
|
||||
Add the method to `ShipStationProviderService` in `src/modules/shipstation/service.ts`:
|
||||
|
||||
```ts title="src/modules/shipstation/service.ts"
|
||||
// other imports...
|
||||
import {
|
||||
// ...
|
||||
CreateShippingOptionDTO,
|
||||
} from "@medusajs/framework/types"
|
||||
|
||||
class ShipStationProviderService extends AbstractFulfillmentProviderService {
|
||||
// ...
|
||||
async canCalculate(data: Record<string, unknown>): Promise<boolean> {
|
||||
async canCalculate(data: CreateShippingOptionDTO): Promise<boolean> {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -820,7 +826,7 @@ class ShipStationProviderService extends AbstractFulfillmentProviderService {
|
||||
},
|
||||
to_address: context.shipping_address,
|
||||
items: context.items || [],
|
||||
currency_code: context.currency_code,
|
||||
currency_code: context.currency_code as string,
|
||||
})
|
||||
rate = shipment.rate_response.rates[0]
|
||||
} else {
|
||||
|
||||
@@ -1706,7 +1706,13 @@ Then, create the file `src/modules/digital-product-fulfillment/service.ts` with
|
||||
|
||||
```ts title="src/modules/digital-product-fulfillment/service.ts"
|
||||
import { AbstractFulfillmentProviderService } from "@medusajs/framework/utils"
|
||||
import { FulfillmentOption } from "@medusajs/framework/types"
|
||||
import {
|
||||
CreateFulfillmentResult,
|
||||
FulfillmentDTO,
|
||||
FulfillmentItemDTO,
|
||||
FulfillmentOption,
|
||||
FulfillmentOrderDTO
|
||||
} from "@medusajs/framework/types"
|
||||
|
||||
class DigitalProductFulfillmentService extends AbstractFulfillmentProviderService {
|
||||
static identifier = "digital"
|
||||
@@ -1735,9 +1741,17 @@ class DigitalProductFulfillmentService extends AbstractFulfillmentProviderServic
|
||||
return true
|
||||
}
|
||||
|
||||
async createFulfillment(): Promise<Record<string, any>> {
|
||||
async createFulfillment(
|
||||
data: Record<string, unknown>,
|
||||
items: Partial<Omit<FulfillmentItemDTO, "fulfillment">>[],
|
||||
order: Partial<FulfillmentOrderDTO> | undefined,
|
||||
fulfillment: Partial<Omit<FulfillmentDTO, "provider_id" | "data" | "items">>
|
||||
): Promise<CreateFulfillmentResult> {
|
||||
// No data is being sent anywhere
|
||||
return {}
|
||||
return {
|
||||
data,
|
||||
labels: []
|
||||
}
|
||||
}
|
||||
|
||||
async cancelFulfillment(): Promise<any> {
|
||||
|
||||
Reference in New Issue
Block a user