feat(medusa, core-flows, fulfillment): calculate SO price endpoint (#10532)

**What**
- endpoint + flow for fetching calculated price for a shipping option

---

CLOSES CMRC-777
This commit is contained in:
Frane Polić
2024-12-12 08:03:56 +00:00
committed by GitHub
parent 52b494b62d
commit 472e92e400
18 changed files with 263 additions and 9 deletions
@@ -202,19 +202,18 @@ export class AbstractFulfillmentProviderService
* The Medusa application uses the {@link canCalculate} method first to check whether the shipping option's price is calculated.
* If it returns `true`, Medusa uses this method to retrieve the calculated price.
*
* @param optionData - The `data` property of a shipping option.
* @param data - If the price is calculated for a shipping option, it's the `data` of the shipping option. Otherwise, it's the `data of the shipping method.
* @param cart - The cart details.
* @param optionData - Shipping option data from the provider, the `data` property of a shipping option.
* @param data - Additional data passed when the price is calculated.
* @param context - The context details, such as the cart or customer.
* @returns The calculated price
*
* @example
* class MyFulfillmentProviderService extends AbstractFulfillmentProviderService {
* // ...
* async calculatePrice(optionData: any, data: any, cart: any): Promise<number> {
* async calculatePrice(optionData: any, data: any, context: any): Promise<number> {
* // assuming the client can calculate the price using
* // the third-party service
* const price = await this.client.calculate(data)
*
* return price
* }
* }