diff --git a/packages/core/utils/src/fulfillment/provider.ts b/packages/core/utils/src/fulfillment/provider.ts index 1e5e326457..46c7ed4b93 100644 --- a/packages/core/utils/src/fulfillment/provider.ts +++ b/packages/core/utils/src/fulfillment/provider.ts @@ -229,13 +229,22 @@ export class AbstractFulfillmentProviderService * @returns The calculated price's details. * * @example + * import { CalculateShippingOptionPriceDTO } from "@medusajs/framework/types" * class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { * // ... - * async calculatePrice(optionData: any, data: any, context: any): Promise { + * async calculatePrice( + * optionData: CalculateShippingOptionPriceDTO["optionData"], + * data: CalculateShippingOptionPriceDTO["data"], + * context: CalculateShippingOptionPriceDTO["context"] + * ): Promise { * // assuming the client can calculate the price using * // the third-party service * const price = await this.client.calculate(data) - * return price + * return { + * calculated_amount: price, + * // Update this boolean value based on your logic + * is_calculated_price_tax_inclusive: true, + * } * } * } */ @@ -346,7 +355,7 @@ export class AbstractFulfillmentProviderService * `data` property, it's stored in the fulfillment's `data` property. * * The `data` property is useful when handling the fulfillment later, - * as you can access information useful for your integration. For example, you + * as you can access information useful for your integration. For example, you * can store an ID for the fulfillment in the third-party service. * * Use this method to perform actions necessary in the third-party fulfillment service, such as diff --git a/www/apps/resources/references/fulfillment_provider/classes/fulfillment_provider.AbstractFulfillmentProviderService/page.mdx b/www/apps/resources/references/fulfillment_provider/classes/fulfillment_provider.AbstractFulfillmentProviderService/page.mdx index 671e4df384..8b2e2fcd6b 100644 --- a/www/apps/resources/references/fulfillment_provider/classes/fulfillment_provider.AbstractFulfillmentProviderService/page.mdx +++ b/www/apps/resources/references/fulfillment_provider/classes/fulfillment_provider.AbstractFulfillmentProviderService/page.mdx @@ -241,11 +241,19 @@ you can retrieve the calculated price of the shipping method. ```ts class MyFulfillmentProviderService extends AbstractFulfillmentProviderService { // ... - async calculatePrice(optionData: any, data: any, context: any): Promise { + async calculatePrice( + optionData: CalculateShippingOptionPriceDTO["optionData"], + data: CalculateShippingOptionPriceDTO["data"], + context: CalculateShippingOptionPriceDTO["context"] + ): Promise { // assuming the client can calculate the price using // the third-party service const price = await this.client.calculate(data) - return price + return { + calculated_amount: price, + // update this boolean value based on your logic + is_calculated_price_tax_inclusive: true + } } } ```