feat(core-flows,fulfillment, fulfillment-manual, types): make fulfillment typings more specific (#10677)
**What** - attempt to add more specific type definitions around fulfillment provider APIs --- CLOSES CMRC-814 CLOSES CMRC-816 CLOSES CMRC-817
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { AbstractFulfillmentProviderService } from "@medusajs/framework/utils"
|
||||
import {
|
||||
CalculatedShippingOptionPrice,
|
||||
CalculateShippingOptionPriceContext,
|
||||
CreateFulfillmentResult,
|
||||
FulfillmentOption,
|
||||
ValidateFulfillmentDataContext,
|
||||
} from "@medusajs/types"
|
||||
|
||||
// TODO rework type and DTO's
|
||||
@@ -28,7 +31,7 @@ export class ManualFulfillmentService extends AbstractFulfillmentProviderService
|
||||
async validateFulfillmentData(
|
||||
optionData: Record<string, unknown>,
|
||||
data: Record<string, unknown>,
|
||||
context: Record<string, unknown>
|
||||
context: ValidateFulfillmentDataContext
|
||||
): Promise<any> {
|
||||
return data
|
||||
}
|
||||
@@ -36,7 +39,7 @@ export class ManualFulfillmentService extends AbstractFulfillmentProviderService
|
||||
async calculatePrice(
|
||||
optionData: Record<string, unknown>,
|
||||
data: Record<string, unknown>,
|
||||
context: Record<string, unknown>
|
||||
context: CalculateShippingOptionPriceContext
|
||||
): Promise<CalculatedShippingOptionPrice> {
|
||||
throw new Error("Manual fulfillment does not support price calculation")
|
||||
}
|
||||
@@ -49,16 +52,22 @@ export class ManualFulfillmentService extends AbstractFulfillmentProviderService
|
||||
return true
|
||||
}
|
||||
|
||||
async createFulfillment(): Promise<Record<string, any>> {
|
||||
async createFulfillment(): Promise<CreateFulfillmentResult> {
|
||||
// No data is being sent anywhere
|
||||
return {}
|
||||
return {
|
||||
data: {},
|
||||
labels: [],
|
||||
}
|
||||
}
|
||||
|
||||
async cancelFulfillment(): Promise<any> {
|
||||
return {}
|
||||
}
|
||||
|
||||
async createReturnFulfillment(): Promise<any> {
|
||||
return {}
|
||||
async createReturnFulfillment(): Promise<CreateFulfillmentResult> {
|
||||
return {
|
||||
data: {},
|
||||
labels: [],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user