feat(core-flows, dashboard, fulfillment, fulfillment-manual, utils, types): create shipping options with calculated prices (#10495)
**What** - support creating SO with calculated price - support updating SO for both types of pricing - update `validateShippingOptionPricesStep` to handle both SO price_types - add the `validateShippingOptionsForPriceCalculation` method to `FulfillementModule` - add `canCalculate` and `calculatePrice` to fulfillment provider service service / interface / manual provider - disable SO pricing edit on Admin if SO price type is calculated --- CLOSES CMRC-776
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { AbstractFulfillmentProviderService } from "@medusajs/framework/utils"
|
||||
import { FulfillmentOption } from "@medusajs/types"
|
||||
import {
|
||||
CalculatedShippingOptionPrice,
|
||||
FulfillmentOption,
|
||||
} from "@medusajs/types"
|
||||
|
||||
// TODO rework type and DTO's
|
||||
|
||||
@@ -30,6 +33,18 @@ export class ManualFulfillmentService extends AbstractFulfillmentProviderService
|
||||
return data
|
||||
}
|
||||
|
||||
async calculatePrice(
|
||||
optionData: Record<string, unknown>,
|
||||
data: Record<string, unknown>,
|
||||
context: Record<string, unknown>
|
||||
): Promise<CalculatedShippingOptionPrice> {
|
||||
throw new Error("Manual fulfillment does not support price calculation")
|
||||
}
|
||||
|
||||
async canCalculate(): Promise<boolean> {
|
||||
return false
|
||||
}
|
||||
|
||||
async validateOption(data: Record<string, any>): Promise<boolean> {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user