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:
Frane Polić
2024-12-11 09:38:44 +01:00
committed by GitHub
parent fad85a9d29
commit d8a92dbb2d
13 changed files with 253 additions and 53 deletions

View File

@@ -1,4 +1,8 @@
import { FulfillmentOption, IFulfillmentProvider } from "@medusajs/types"
import {
CalculatedShippingOptionPrice,
FulfillmentOption,
IFulfillmentProvider,
} from "@medusajs/types"
/**
* ### constructor
@@ -221,7 +225,7 @@ export class AbstractFulfillmentProviderService
optionData: Record<string, unknown>,
data: Record<string, unknown>,
context: Record<string, unknown>
): Promise<number> {
): Promise<CalculatedShippingOptionPrice> {
throw Error("calculatePrice must be overridden by the child class")
}
@@ -345,7 +349,9 @@ export class AbstractFulfillmentProviderService
* }
* }
*/
async createReturnFulfillment(fulfillment: Record<string, unknown>): Promise<any> {
async createReturnFulfillment(
fulfillment: Record<string, unknown>
): Promise<any> {
throw Error("createReturn must be overridden by the child class")
}