import { FindConfig } from "../common"; import { RestoreReturn, SoftDeleteReturn } from "../dal"; import { IModuleService } from "../modules-sdk"; import { Context } from "../shared-context"; import { FilterableFulfillmentProps, FilterableFulfillmentProviderProps, FilterableFulfillmentSetProps, FilterableGeoZoneProps, FilterableServiceZoneProps, FilterableShippingOptionForContextProps, FilterableShippingOptionProps, FilterableShippingOptionRuleProps, FilterableShippingOptionTypeProps, FilterableShippingProfileProps, FulfillmentDTO, FulfillmentProviderDTO, FulfillmentSetDTO, GeoZoneDTO, ServiceZoneDTO, ShippingOptionDTO, ShippingOptionRuleDTO, ShippingOptionTypeDTO, ShippingProfileDTO } from "./common"; import { CalculateShippingOptionPriceDTO, CreateFulfillmentSetDTO, CreateGeoZoneDTO, CreateServiceZoneDTO, CreateShippingOptionDTO, CreateShippingOptionRuleDTO, UpdateFulfillmentDTO, UpdateFulfillmentSetDTO, UpdateGeoZoneDTO, UpdateServiceZoneDTO, UpdateShippingOptionDTO, UpdateShippingOptionRuleDTO, UpdateShippingProfileDTO, UpsertServiceZoneDTO, UpsertShippingOptionDTO } from "./mutations"; import { CreateFulfillmentDTO } from "./mutations/fulfillment"; import { CreateShippingProfileDTO, UpsertShippingProfileDTO } from "./mutations/shipping-profile"; import { CalculatedShippingOptionPrice, ValidateFulfillmentDataContext } from "./provider"; /** * The main service interface for the Fulfillment Module. */ export interface IFulfillmentModuleService extends IModuleService { /** * This method retrieves a fulfillment set by its ID. * * @param {string} id - The ID of the fulfillment set. * @param {FindConfig} config - The configurations determining how the fulfillment set is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a fulfillment set. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The retrieved fulfillment set. * * @example * A simple example that retrieves a fulfillment set by its ID: * * ```ts * const fulfillmentSet = * await fulfillmentModuleService.retrieveFulfillmentSet("fuset_123") * ``` * * To specify relations that should be retrieved: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const fulfillmentSet = await fulfillmentModuleService.retrieveFulfillmentSet( * "fuset_123", * { * relations: ["service_zones"], * } * ) * ``` */ retrieveFulfillmentSet(id: string, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of fulfillment sets based on optional filters and configuration. * * @param {FilterableFulfillmentSetProps} filters - The filters to apply on the retrieved fulfillment sets. * @param {FindConfig} config - The configurations determining how the fulfillment set is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a fulfillment set. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The list of fulfillment sets. * * @example * To retrieve a list of fulfillment sets using their IDs: * * ```ts * const fulfillmentSets = await fulfillmentModuleService.listFulfillmentSets({ * id: ["fuset_123", "fuset_321"], * }) * ``` * * To specify relations that should be retrieved within the fulfillment set: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const fulfillmentSets = await fulfillmentModuleService.listFulfillmentSets( * { * id: ["fuset_123", "fuset_321"], * }, * { * relations: ["search_zones"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const fulfillmentSets = await fulfillmentModuleService.listFulfillmentSets( * { * id: ["fuset_123", "fuset_321"], * }, * { * relations: ["search_zones"], * take: 20, * skip: 2, * } * ) * ``` */ listFulfillmentSets(filters?: FilterableFulfillmentSetProps, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of fulfillment sets along with the total count of available fulfillment sets satisfying the provided filters. * * @param {FilterableFulfillmentSetProps} filters - The filters to apply on the retrieved fulfillment sets. * @param {FindConfig} config - The configurations determining how the fulfillment set is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a fulfillment set. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise<[FulfillmentSetDTO[], number]>} The list of fulfillment sets along with their total count. * * @example * To retrieve a list of fulfillment sets using their IDs: * * ```ts * const [fulfillmentSets, count] = * await fulfillmentModuleService.listAndCountFulfillmentSets({ * id: ["fuset_123", "fuset_321"], * }) * ``` * * To specify relations that should be retrieved within the fulfillment set: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const [fulfillmentSets, count] = * await fulfillmentModuleService.listAndCountFulfillmentSets( * { * id: ["fuset_123", "fuset_321"], * }, * { * relations: ["search_zones"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const [fulfillmentSets, count] = * await fulfillmentModuleService.listAndCountFulfillmentSets( * { * id: ["fuset_123", "fuset_321"], * }, * { * relations: ["search_zones"], * take: 20, * skip: 2, * } * ) * ``` */ listAndCountFulfillmentSets(filters?: FilterableFulfillmentSetProps, config?: FindConfig, sharedContext?: Context): Promise<[FulfillmentSetDTO[], number]>; /** * This method creates fulfillment sets. * * @param {CreateFulfillmentSetDTO[]} data - The fulfillment sets to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created fulfillment sets. * * @example * const fulfillmentSets = await fulfillmentModuleService.createFulfillmentSets( * [ * { * name: "Shipping", * type: "default", * }, * { * name: "Pickup", * type: "provider-controlled", * }, * ] * ) */ createFulfillmentSets(data: CreateFulfillmentSetDTO[], sharedContext?: Context): Promise; /** * This method creates a fulfillment set. * * @param {CreateFulfillmentSetDTO} data - The fulfillment set to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created fulfillment set. * * @example * const fulfillmentSet = await fulfillmentModuleService.createFulfillmentSets({ * name: "Shipping", * type: "default", * }) */ createFulfillmentSets(data: CreateFulfillmentSetDTO, sharedContext?: Context): Promise; /** * This method updates existing fulfillment sets. * * @param {UpdateFulfillmentSetDTO[]} data - The attributes to update in the fulfillment sets. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated fulfillment sets. * * @example * const fulfillmentSets = await fulfillmentModuleService.updateFulfillmentSets( * [ * { * id: "fuset_123", * name: "Shipping", * }, * { * id: "fuset_321", * name: "Pickup", * }, * ] * ) */ updateFulfillmentSets(data: UpdateFulfillmentSetDTO[], sharedContext?: Context): Promise; /** * This method updates an existing fulfillment set. * * @param {UpdateFulfillmentSetDTO} data - The attributes to update in the fulfillment set. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated fulfillment set. * * @example * const fulfillmentSet = await fulfillmentModuleService.updateFulfillmentSets({ * id: "fuset_123", * name: "Shipping", * }) */ updateFulfillmentSets(data: UpdateFulfillmentSetDTO, sharedContext?: Context): Promise; /** * This method deletes fulfillment sets by their IDs. * * @param {string[]} ids - The IDs of the fulfillment sets. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the fulfillment sets are deleted successfully. * * @example * await fulfillmentModuleService.deleteFulfillmentSets([ * "fuset_123", * "fuset_321", * ]) */ deleteFulfillmentSets(ids: string[], sharedContext?: Context): Promise; /** * This method deletes a fulfillment set by its ID. * * @param {string} id - The ID of the fulfillment set. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the fulfillment set is deleted successfully. * * @example * await fulfillmentModuleService.deleteFulfillmentSets("fuset_123") */ deleteFulfillmentSets(id: string, sharedContext?: Context): Promise; /** * This method soft deletes fulfillment sets by their IDs. * * @param {string[]} fulfillmentIds - The IDs of the fulfillment sets. * @param {SoftDeleteReturn} config - An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise>} An object that includes the IDs of related records that were also soft deleted. * If there are no related records, the promise resolves to `void`. * * @example * await fulfillmentModuleService.softDeleteFulfillmentSets([ * "fuset_123", * "fuset_321", * ]) */ softDeleteFulfillmentSets(fulfillmentIds: string[], config?: SoftDeleteReturn, sharedContext?: Context): Promise | void>; /** * This method restores a soft deleted fulfillment by its IDs. * * @param {string[]} fulfillmentIds - The IDs of the fulfillment sets. * @param {RestoreReturn} config - Configurations determining which relations to restore along with each of the fulfillment sets. You can pass to its `returnLinkableKeys` * property any of the fulfillment set's relation attribute names. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise>} An object that includes the IDs of related records that were restored. * If there are no related records restored, the promise resolves to `void`. * * @example * await fulfillmentModuleService.restoreFulfillmentSets([ * "fuset_123", * "fuset_321", * ]) */ restoreFulfillmentSets(fulfillmentIds: string[], config?: RestoreReturn, sharedContext?: Context): Promise | void>; /** * This method retrieves a service zone by its ID. * * @param {string} id - The ID of the service zone. * @param {FindConfig} config - The configurations determining how the service zone is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a service zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The retrieved service zone. * * @example * A simple example that retrieves a service zone by its ID: * * ```ts * const serviceZone = * await fulfillmentModuleService.retrieveServiceZone( * "serzo_123" * ) * ``` * * To specify relations that should be retrieved: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const serviceZone = * await fulfillmentModuleService.retrieveServiceZone( * "serzo_123", * { * relations: ["shipping_options"], * } * ) * ``` */ retrieveServiceZone(id: string, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of service zones based on optional filters and configuration. * * @param {FilterableServiceZoneProps} filters - The filters to apply on the retrieved service zones. * @param {FindConfig} config - The configurations determining how the service zone is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a service zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The list of service zones. * * @example * To retrieve a list of service zones using their IDs: * * ```ts * const serviceZones = * await fulfillmentModuleService.listServiceZones({ * id: ["serzo_123", "serzo_321"], * }) * ``` * * To specify relations that should be retrieved within the service zone: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const serviceZones = * await fulfillmentModuleService.listServiceZones( * { * id: ["serzo_123", "serzo_321"], * }, * { * relations: ["shipping_options"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const serviceZones = * await fulfillmentModuleService.listServiceZones( * { * id: ["serzo_123", "serzo_321"], * }, * { * relations: ["shipping_options"], * take: 20, * skip: 2, * } * ) * ``` */ listServiceZones(filters?: FilterableServiceZoneProps, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of service zones along with the total count of available service zones satisfying the provided filters. * * @param {FilterableServiceZoneProps} filters - The filters to apply on the retrieved service zones. * @param {FindConfig} config - The configurations determining how the service zone is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a service zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise<[ServiceZoneDTO[], number]>} The list of service zones along with their total count. * * @example * To retrieve a list of service zones using their IDs: * * ```ts * const [serviceZones, count] = * await fulfillmentModuleService.listAndCountServiceZones({ * id: ["serzo_123", "serzo_321"], * }) * ``` * * To specify relations that should be retrieved within the service zone: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const [serviceZones, count] = * await fulfillmentModuleService.listAndCountServiceZones( * { * id: ["serzo_123", "serzo_321"], * }, * { * relations: ["shipping_options"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const [serviceZones, count] = * await fulfillmentModuleService.listAndCountServiceZones( * { * id: ["serzo_123", "serzo_321"], * }, * { * relations: ["shipping_options"], * take: 20, * skip: 2, * } * ) * ``` */ listAndCountServiceZones(filters?: FilterableServiceZoneProps, config?: FindConfig, sharedContext?: Context): Promise<[ServiceZoneDTO[], number]>; /** * This method creates service zones. * * @param {CreateServiceZoneDTO[]} data - The service zones to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created service zones. * * @example * const serviceZones = * await fulfillmentModuleService.createServiceZones([ * { * name: "Nordic Shipping Methods", * fulfillment_set_id: "fuset_123", * }, * { * name: "Pickup Service Area", * fulfillment_set_id: "fuset_321", * }, * ]) */ createServiceZones(data: CreateServiceZoneDTO[], sharedContext?: Context): Promise; /** * This method creates a service zone. * * @param {CreateServiceZoneDTO} data - The service zone to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created service zone. * * @example * const serviceZone = * await fulfillmentModuleService.createServiceZones({ * name: "Nordic Shipping Methods", * fulfillment_set_id: "fuset_123", * }) */ createServiceZones(data: CreateServiceZoneDTO, sharedContext?: Context): Promise; /** * This method updates an existing service zone. * * @param {string} id - The ID of the service zone. * @param {UpdateServiceZoneDTO} data - The attributes to update in the service zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated service zone. * * @example * const serviceZone = * await fulfillmentModuleService.updateServiceZones( * "serzo_123", * { * name: "US", * } * ) */ updateServiceZones(id: string, data: UpdateServiceZoneDTO, sharedContext?: Context): Promise; /** * This method updates existing service zones matching the specified filters. * * @param {FilterableServiceZoneProps} selector - The filters specifying which service zones to update. * @param {UpdateServiceZoneDTO} data - The attributes to update in the service zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated service zones. * * @example * const serviceZones = * await fulfillmentModuleService.updateServiceZones( * { * id: ["serzo_123", "serzo_321"], * }, * { * name: "US", * } * ) */ updateServiceZones(selector: FilterableServiceZoneProps, data: UpdateServiceZoneDTO, sharedContext?: Context): Promise; /** * This method updates or creates a service zone if it doesn't exist. * * @param {UpsertServiceZoneDTO} data - The attributes in the service zone to be created or updated. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created or updated service zone. * * @example * const serviceZone = * await fulfillmentModuleService.upsertServiceZones({ * id: "serzo_123", * name: "US", * }) */ upsertServiceZones(data: UpsertServiceZoneDTO, sharedContext?: Context): Promise; /** * This method updates or creates service zones if they don't exist. * * @param {UpsertServiceZoneDTO[]} data - The attributes in the service zones to be created or updated. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created or updated service zones. * * @example * const serviceZones = * await fulfillmentModuleService.upsertServiceZones([ * { * id: "serzo_123", * name: "US", * }, * { * name: "US", * fulfillment_set_id: "fuset_123", * }, * ]) */ upsertServiceZones(data: UpsertServiceZoneDTO[], sharedContext?: Context): Promise; /** * This method deletes service zones by their IDs. * * @param {string[]} ids - The IDs of the service zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the service zones are deleted. * * @example * await fulfillmentModuleService.deleteServiceZones([ * "serzo_123", * "serzo_321", * ]) */ deleteServiceZones(ids: string[], sharedContext?: Context): Promise; /** * This method deletes a service zone by its ID. * * @param {string} id - The ID of the service zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the service zone is deleted. * * @example * await fulfillmentModuleService.deleteServiceZones("serzo_123") */ deleteServiceZones(id: string, sharedContext?: Context): Promise; /** * This method soft deletes service zones by their IDs. * * @param {string[]} serviceZoneIds - The IDs of the service zones. * @param {SoftDeleteReturn} config - An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise>} An object that includes the IDs of related records that were also soft deleted. * If there are no related records, the promise resolves to `void`. * * @example * await fulfillmentModuleService.softDeleteServiceZones([ * "serzo_123", * "serzo_321", * ]) */ softDeleteServiceZones(serviceZoneIds: string[], config?: SoftDeleteReturn, sharedContext?: Context): Promise | void>; /** * This method restores a soft deleted service zones by their IDs. * * @param {string[]} serviceZoneIds - The IDs of the service zones. * @param {RestoreReturn} config - Configurations determining which relations to restore along with each of the service zones. You can pass to its `returnLinkableKeys` * property any of the service zone's relation attribute names, such as `{type relation name}`. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise>} An object that includes the IDs of related records that were restored. * If there are no related records restored, the promise resolves to `void`. * * @example * await fulfillmentModuleService.restoreServiceZones([ * "serzo_123", * "serzo_321", * ]) */ restoreServiceZones(serviceZoneIds: string[], config?: RestoreReturn, sharedContext?: Context): Promise | void>; /** * This method retrieves a geo zone by its ID. * * @param {string} id - The ID of the geo zone. * @param {FindConfig} config - The configurations determining how the geo zone is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a geo zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The retrieved geo zone. * * @example * A simple example that retrieves a geo zone by its ID: * * ```ts * const geoZone = * await fulfillmentModuleService.retrieveGeoZone("fgz_123") * ``` * * To specify relations that should be retrieved: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const geoZone = * await fulfillmentModuleService.retrieveGeoZone("fgz_123", { * relations: ["service_zone"], * }) * ``` */ retrieveGeoZone(id: string, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of geo zones based on optional filters and configuration. * * @param {FilterableGeoZoneProps} filters - The filters to apply on the retrieved geo zones. * @param {FindConfig} config - The configurations determining how the geo zone is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a geo zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The list of geo zones. * * @example * To retrieve a list of geo zones using their IDs: * * ```ts * const geoZones = await fulfillmentModuleService.listGeoZones({ * id: ["fgz_123", "fgz_321"], * }) * ``` * * To specify relations that should be retrieved within the geo zone: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const geoZones = await fulfillmentModuleService.listGeoZones( * { * id: ["fgz_123", "fgz_321"], * }, * { * relations: ["service_zone"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const geoZones = await fulfillmentModuleService.listGeoZones( * { * id: ["fgz_123", "fgz_321"], * }, * { * relations: ["service_zone"], * take: 20, * skip: 2, * } * ) * ``` */ listGeoZones(filters?: FilterableGeoZoneProps, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of geo zones along with the total count of available geo zones satisfying the provided filters. * * @param {FilterableGeoZoneProps} filters - The filters to apply on the retrieved geo zones. * @param {FindConfig} config - The configurations determining how the geo zone is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a geo zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise<[GeoZoneDTO[], number]>} The list of geo zones along with their total count. * * @example * To retrieve a list of geo zones using their IDs: * * ```ts * const [geoZones, count] = * await fulfillmentModuleService.listAndCountGeoZones({ * id: ["fgz_123", "fgz_321"], * }) * ``` * * To specify relations that should be retrieved within the geo zone: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const [geoZones, count] = * await fulfillmentModuleService.listAndCountGeoZones( * { * id: ["fgz_123", "fgz_321"], * }, * { * relations: ["service_zone"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const [geoZones, count] = * await fulfillmentModuleService.listAndCountGeoZones( * { * id: ["fgz_123", "fgz_321"], * }, * { * relations: ["service_zone"], * take: 20, * skip: 2, * } * ) * ``` */ listAndCountGeoZones(filters?: FilterableGeoZoneProps, config?: FindConfig, sharedContext?: Context): Promise<[GeoZoneDTO[], number]>; /** * This method creates geo zones. * * @param {CreateGeoZoneDTO[]} data - The geo zones to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created geo zones. * * @example * const geoZones = * await fulfillmentModuleService.createGeoZones([ * { * type: "country", * service_zone_id: "serzo_123", * country_code: "us", * }, * { * type: "city", * service_zone_id: "serzo_321", * province_code: "us-vt", * city: "Vermont", * country_code: "us", * }, * ]) */ createGeoZones(data: CreateGeoZoneDTO[], sharedContext?: Context): Promise; /** * This method creates a geo zones. * * @param {CreateGeoZoneDTO} data - The geo zone to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created geo zones. * * @example * const geoZones = * await fulfillmentModuleService.createGeoZones({ * type: "country", * service_zone_id: "serzo_123", * country_code: "us", * }) */ createGeoZones(data: CreateGeoZoneDTO, sharedContext?: Context): Promise; /** * This method updates existing geo zones. * * @param {UpdateGeoZoneDTO[]} data - The attributes to update in the geo zones. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated geo zones. * * @example * const geoZones = * await fulfillmentModuleService.updateGeoZones([ * { * id: "fgz_123", * type: "country", * country_code: "us", * }, * { * id: "fgz_321", * type: "city", * province_code: "us-vt", * }, * ]) */ updateGeoZones(data: UpdateGeoZoneDTO[], sharedContext?: Context): Promise; /** * This method updates an existing fulfillment. * * @param {UpdateGeoZoneDTO} data - The attributes to update in the geo zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated fulfillment. * * @example * const geoZones = * await fulfillmentModuleService.updateGeoZones({ * id: "fgz_123", * type: "country", * country_code: "us", * }) */ updateGeoZones(data: UpdateGeoZoneDTO, sharedContext?: Context): Promise; /** * This method deletes geo zones by their IDs. * * @param {string[]} ids - The IDs of the geo zones. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the geo zones are deleted. * * @example * await fulfillmentModuleService.deleteGeoZones([ * "fgz_123", * "fgz_321", * ]) */ deleteGeoZones(ids: string[], sharedContext?: Context): Promise; /** * This method deletes a geo zone by its ID. * * @param {string} id - The ID of the geo zone. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the geo zone is deleted. * * @example * await fulfillmentModuleService.deleteGeoZones("fgz_123") */ deleteGeoZones(id: string, sharedContext?: Context): Promise; /** * This method soft deletes geo zones by their IDs. * * @param {string[]} geoZoneIds - The IDs of the geo zones. * @param {SoftDeleteReturn} config - An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise>} An object that includes the IDs of related records that were also soft deleted. * If there are no related records, the promise resolves to `void`. * * @example * await fulfillmentModuleService.softDeleteGeoZones([ * "fgz_123", * "fgz_321", * ]) */ softDeleteGeoZones(geoZoneIds: string[], config?: SoftDeleteReturn, sharedContext?: Context): Promise | void>; /** * This method restores soft deleted geo zones by their IDs. * * @param {string[]} geoZoneIds - The IDs of the geo zones. * @param {RestoreReturn} config - Configurations determining which relations to restore along with each of the geo zones. You can pass to its `returnLinkableKeys` * property any of the geo zone's relation attribute names, such as `{type relation name}`. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise>} An object that includes the IDs of related records that were restored. * If there are no related records restored, the promise resolves to `void`. * * @example * await fulfillmentModuleService.restoreGeoZones([ * "fgz_123", * "fgz_321", * ]) */ restoreGeoZones(geoZoneIds: string[], config?: RestoreReturn, sharedContext?: Context): Promise | void>; /** * This method retrieves a shipping option by its ID. * * @param {string} id - The ID of the shipping option. * @param {FindConfig} config - The configurations determining how the shipping option is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping option. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The retrieved shipping option. * * @example * A simple example that retrieves a shipping option by its ID: * * ```ts * const shippingOption = * await fulfillmentModuleService.retrieveShippingOption( * "so_123" * ) * ``` * * To specify relations that should be retrieved: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const shippingOption = * await fulfillmentModuleService.retrieveShippingOption( * "so_123", * { * relations: ["fulfillments"], * } * ) * ``` */ retrieveShippingOption(id: string, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of shipping options based on optional filters and configuration. * * @param {FilterableShippingOptionProps} filters - The filters to apply on the retrieved shipping options. * @param {FindConfig} config - The configurations determining how the shipping option is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping option. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The list of shipping options. * * @example * To retrieve a list of shipping options using their IDs: * * ```ts * const shippingOptions = * await fulfillmentModuleService.listShippingOptions({ * id: ["so_123", "so_321"], * }) * ``` * * To specify relations that should be retrieved within the shipping option: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const shippingOptions = * await fulfillmentModuleService.listShippingOptions( * { * id: ["so_123", "so_321"], * }, * { * relations: ["fulfillments"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const shippingOptions = * await fulfillmentModuleService.listShippingOptions( * { * id: ["so_123", "so_321"], * }, * { * relations: ["fulfillments"], * take: 20, * skip: 2, * } * ) * ``` */ listShippingOptions(filters?: FilterableShippingOptionForContextProps, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of shipping options based on the provided context. * * @param {FilterableShippingOptionForContextProps} filters - The context of the how the shipping option is being used. It * acts as a filter for the retrieved shipping options. * @param {FindConfig} config - The configurations determining how the shipping option is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping option. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The list of shipping options. * * @example * To retrieve a list of shipping options matching a context: * * ```ts * const shippingOptions = * await fulfillmentModuleService.listShippingOptionsForContext( * { * fulfillment_set_id: ["fuset_123"], * address: { * country_code: "us", * }, * } * ) * ``` * * To specify relations that should be retrieved within the shipping option: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const shippingOptions = * await fulfillmentModuleService.listShippingOptionsForContext( * { * fulfillment_set_id: ["fuset_123"], * address: { * country_code: "us", * }, * }, * { * relations: ["fulfillments"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const shippingOptions = * await fulfillmentModuleService.listShippingOptionsForContext( * { * fulfillment_set_id: ["fuset_123"], * address: { * country_code: "us", * }, * }, * { * relations: ["fulfillments"], * take: 20, * skip: 2, * } * ) * ``` */ listShippingOptionsForContext(filters: FilterableShippingOptionForContextProps, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of shipping options along with the total count of available shipping options satisfying the provided filters. * * @param {Omit} filters - Construct a type with the properties of T except for those in type K. * @param {FindConfig} config - The configurations determining how the shipping option is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping option. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise<[ShippingOptionDTO[], number]>} The list of shipping options along with their total count. * * @example * To retrieve a list of shipping options using their IDs: * * ```ts * const [shippingOptions, count] = * await fulfillmentModuleService.listAndCountShippingOptions({ * id: ["so_123", "so_321"], * }) * ``` * * To specify relations that should be retrieved within the shipping option: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const [shippingOptions, count] = * await fulfillmentModuleService.listAndCountShippingOptions( * { * id: ["so_123", "so_321"], * }, * { * relations: ["fulfillments"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const [shippingOptions, count] = * await fulfillmentModuleService.listAndCountShippingOptions( * { * id: ["so_123", "so_321"], * }, * { * relations: ["fulfillments"], * take: 20, * skip: 2, * } * ) * ``` */ listAndCountShippingOptions(filters?: Omit, config?: FindConfig, sharedContext?: Context): Promise<[ShippingOptionDTO[], number]>; /** * This method creates shipping options. * * @param {CreateShippingOptionDTO[]} data - The shipping options to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created shipping options. * * @example * const shippingOptions = * await fulfillmentModuleService.createShippingOptions([ * { * name: "DHL Express Shipping", * price_type: "flat", * service_zone_id: "serzo_123", * shipping_profile_id: "sp_123", * provider_id: "dhl", * type: { * label: "Express", * description: "Ship in 24 hours", * code: "express", * }, * }, * { * name: "Webshipper Shipping", * price_type: "flat", * service_zone_id: "serzo_321", * shipping_profile_id: "sp_321", * provider_id: "webshipper", * type: { * label: "Express", * description: "Ship in 24 hours", * code: "express", * }, * }, * ]) */ createShippingOptions(data: CreateShippingOptionDTO[], sharedContext?: Context): Promise; /** * This method creates a shipping option. * * @param {CreateShippingOptionDTO} data - The shipping option to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created shipping option. * * @example * const shippingOption = * await fulfillmentModuleService.createShippingOptions({ * name: "DHL Express Shipping", * price_type: "flat", * service_zone_id: "serzo_123", * shipping_profile_id: "sp_123", * provider_id: "dhl", * type: { * label: "Express", * description: "Ship in 24 hours", * code: "express", * }, * }) */ createShippingOptions(data: CreateShippingOptionDTO, sharedContext?: Context): Promise; /** * This method updates an existing shipping option. * * @param {string} id - The ID of the shipping option. * @param {UpdateShippingOptionDTO} data - The attributes to update in the shipping option. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated shipping option. * * @example * const shippingOption = * await fulfillmentModuleService.updateShippingOptions( * "so_123", * { * name: "Express shipping", * } * ) */ updateShippingOptions(id: string, data: UpdateShippingOptionDTO, sharedContext?: Context): Promise; /** * This method updates existing shipping options matching the specified filters. * * @param {FilterableShippingOptionProps} selector - The filters specifying which shipping options to update. * @param {UpdateShippingOptionDTO} data - The attributes to update in the shipping option. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated shipping options. * * @example * const shippingOptions = * await fulfillmentModuleService.updateShippingOptions( * { * id: ["so_123", "so_321"], * }, * { * name: "Express Shipping", * } * ) */ updateShippingOptions(selector: FilterableShippingOptionProps, data: UpdateShippingOptionDTO, sharedContext?: Context): Promise; /** * This method updates or creates a shipping option if it doesn't exist. * * @param {UpsertShippingOptionDTO} data - The attributes in the shipping option to be created or updated. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created or updated shipping option. * * @example * const shippingOptions = * await fulfillmentModuleService.upsertShippingOptions({ * id: "so_123", * name: "Express Shipping", * }) */ upsertShippingOptions(data: UpsertShippingOptionDTO, sharedContext?: Context): Promise; /** * This method updates or creates shipping options if they don't exist. * * @param {UpsertShippingOptionDTO[]} data - The attributes in the shipping options to be created or updated. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created or updated shipping options. * * @example * const shippingOptions = * await fulfillmentModuleService.upsertShippingOptions([ * { * id: "so_123", * name: "Express Shipping", * }, * { * name: "Express Shipping", * price_type: "flat", * service_zone_id: "serzo_123", * shipping_profile_id: "sp_123", * provider_id: "webshipper", * type: { * label: "Express", * description: "express shipping", * code: "express", * }, * }, * ]) */ upsertShippingOptions(data: UpsertShippingOptionDTO[], sharedContext?: Context): Promise; /** * This method deletes shipping options by their IDs. * * @param {string[]} ids - The IDs of the shipping options. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the shipping options are deleted successfully. * * @example * await fulfillmentModuleService.deleteShippingOptions([ * "so_123", * "so_321", * ]) */ deleteShippingOptions(ids: string[], sharedContext?: Context): Promise; /** * This method deletes a shipping option by its ID. * * @param {string} id - The ID of the shipping option. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the shipping option is deleted successfully. * * @example * await fulfillmentModuleService.deleteShippingOptions("so_123") */ deleteShippingOptions(id: string, sharedContext?: Context): Promise; /** * This method soft deletes shipping option by their IDs. * * @param {string[]} shippingOptionIds - The IDs of the shipping options. * @param {SoftDeleteReturn} config - An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise>} An object that includes the IDs of related records that were also soft deleted. * If there are no related records, the promise resolves to `void`. * * @example * await fulfillmentModuleService.softDeleteShippingOptions([ * "so_123", * "so_321", * ]) */ softDeleteShippingOptions(shippingOptionIds: string[], config?: SoftDeleteReturn, sharedContext?: Context): Promise | void>; /** * This method restores soft deleted shipping options by their IDs. * * @param {string[]} shippingOptionIds - The list of {summary} * @param {RestoreReturn} config - Configurations determining which relations to restore along with each of the shipping options. You can pass to its `returnLinkableKeys` * property any of the shipping option's relation attribute names. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise>} An object that includes the IDs of related records that were restored. * If there are no related records restored, the promise resolves to `void`. * * @example * await fulfillmentModuleService.restoreShippingOptions([ * "so_123", * "so_321", * ]) */ restoreShippingOptions(shippingOptionIds: string[], config?: RestoreReturn, sharedContext?: Context): Promise | void>; /** * This method retrieves a shipping profile by its ID. * * @param {string} id - The ID of the shipping profile. * @param {FindConfig} config - The configurations determining how the shipping profile is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping profile. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The retrieved shipping profile. * * @example * A simple example that retrieves a shipping profile by its ID: * * ```ts * const shippingProfile = * await fulfillmentModuleService.retrieveShippingProfile( * "sp_123" * ) * ``` * * To specify relations that should be retrieved: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const shippingProfile = * await fulfillmentModuleService.retrieveShippingProfile( * "sp_123", * { * relations: ["options"], * } * ) * ``` */ retrieveShippingProfile(id: string, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of shipping profiles based on optional filters and configuration. * * @param {FilterableShippingProfileProps} filters - The filters to apply on the retrieved shipping profiles. * @param {FindConfig} config - The configurations determining how the shipping profile is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping profile. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The list of shipping profiles. * * @example * To retrieve a list of shipping profiles using their IDs: * * ```ts * const shippingProfiles = * await fulfillmentModuleService.listShippingProfiles({ * id: ["sp_123", "sp_321"], * }) * ``` * * To specify relations that should be retrieved within the shipping profile: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const shippingProfiles = * await fulfillmentModuleService.listShippingProfiles( * { * id: ["sp_123", "sp_321"], * }, * { * relations: ["shipping_options"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const shippingProfiles = * await fulfillmentModuleService.listShippingProfiles( * { * id: ["sp_123", "sp_321"], * }, * { * relations: ["shipping_options"], * take: 20, * skip: 2, * } * ) * ``` */ listShippingProfiles(filters?: FilterableShippingProfileProps, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of shipping profiles along with the total count of available shipping profiles satisfying the provided filters. * * @param {FilterableShippingProfileProps} filters - The filters to apply on the retrieved shipping profiles. * @param {FindConfig} config - The configurations determining how the shipping profile is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping profile. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise<[ShippingProfileDTO[], number]>} The list of shipping profiles along with their total count. * * @example * To retrieve a list of shipping profiles using their IDs: * * ```ts * const [shippingProfiles, count] = * await fulfillmentModuleService.listAndCountShippingProfiles( * { * id: ["sp_123", "sp_321"], * } * ) * ``` * * To specify relations that should be retrieved within the shipping profile: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const [shippingProfiles, count] = * await fulfillmentModuleService.listAndCountShippingProfiles( * { * id: ["sp_123", "sp_321"], * }, * { * relations: ["shipping_options"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const [shippingProfiles, count] = * await fulfillmentModuleService.listAndCountShippingProfiles( * { * id: ["sp_123", "sp_321"], * }, * { * relations: ["shipping_options"], * take: 20, * skip: 2, * } * ) * ``` */ listAndCountShippingProfiles(filters?: FilterableShippingProfileProps, config?: FindConfig, sharedContext?: Context): Promise<[ShippingProfileDTO[], number]>; /** * This method creates shipping profiles. * * @param {CreateShippingProfileDTO[]} data - The shipping profiles to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created shipping profiles. * * @example * const shippingProfiles = * await fulfillmentModuleService.createShippingProfiles([ * { * name: "Default", * type: "default" * }, * { * name: "Digital", * type: "digital" * }, * ]) */ createShippingProfiles(data: CreateShippingProfileDTO[], sharedContext?: Context): Promise; /** * This method creates a shipping profile. * * @param {CreateShippingProfileDTO} data - The shipping profile to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created shipping profile. * * @example * const shippingProfile = * await fulfillmentModuleService.createShippingProfiles({ * name: "Default", * type: "default" * }) */ createShippingProfiles(data: CreateShippingProfileDTO, sharedContext?: Context): Promise; /** * This method updates existing shipping profiles. * * @param {UpdateShippingProfileDTO} data - The shipping profiles update data. * @param {FilterableShippingProfileProps} selector - The selector of shipping profiles to update * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated shipping profiles. * * @example * const shippingProfiles = * await fulfillmentModuleService.updateShippingProfiles([ * { * id: "sp_123", * name: "Default", * }, * { * id: "sp_321", * name: "Digital", * }, * ]) */ updateShippingProfiles(selector: FilterableShippingProfileProps, data: UpdateShippingProfileDTO, sharedContext?: Context): Promise; /** * This method updates an existing shipping profiles. * * @param {string} id - The shipping profile to be updated. * @param {UpdateShippingProfileDTO} data - The shipping profile to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated shipping profiles. * * @example * const shippingProfiles = * await fulfillmentModuleService.updateShippingProfiles({ * id: "sp_123", * name: "Default", * }) */ updateShippingProfiles(id: string, data: UpdateShippingProfileDTO, sharedContext?: Context): Promise; /** * This method deletes shipping profiles by their IDs. * * @param {string[]} ids - The IDs of the shipping profiles. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the shipping profiles are deleted. * * @example * await fulfillmentModuleService.deleteShippingProfiles([ * "sp_123", * "sp_321", * ]) */ deleteShippingProfiles(ids: string[], sharedContext?: Context): Promise; /** * This method deletes a shipping profile by its ID. * * @param {string} id - The ID of the shipping profile. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the shipping profile is deleted. * * @example * await fulfillmentModuleService.deleteShippingProfiles( * "sp_123" * ) */ deleteShippingProfiles(id: string, sharedContext?: Context): Promise; /** * This method updates existing shipping profiles, or creates new ones if they don't exist. * * @param {UpdateShippingProfileDTO[]} data - The attributes to update or create for each profile. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated and created profiles. * * @example * const productTags = await productModuleService.upsertShippingProfiles([ * { * id: "id_1234", * metadata: { * test: true, * }, * }, * { * name: "Digital", * }, * ]) */ upsertShippingProfiles(data: UpsertShippingProfileDTO[], sharedContext?: Context): Promise; /** * This method updates an existing shipping profile, or creates a new one if it doesn't exist. * * @param {UpdateShippingProfileDTO} data - The attributes to update or create for the profile. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated or created profile. * * @example * const productTag = await productModuleService.upsertShippingProfiles({ * id: "id_1234", * metadata: { * test: true, * }, * }) */ upsertShippingProfiles(data: UpsertShippingProfileDTO, sharedContext?: Context): Promise; /** * This method soft deletes shipping profiles by their IDs. * * @param {string[]} shippingProfileIds - The IDs of the shipping profiles. * @param {SoftDeleteReturn} config - An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise>} An object that includes the IDs of related records that were also soft deleted. * If there are no related records, the promise resolves to `void`. * * @example * await fulfillmentModuleService.softDeleteShippingProfiles([ * "sp_123", * "sp_321", * ]) */ softDeleteShippingProfiles(shippingProfileIds: string[], config?: SoftDeleteReturn, sharedContext?: Context): Promise | void>; /** * This method restores soft deleted shipping profiles by their IDs. * * @param {string[]} shippingProfileIds - The IDs of the shipping profiles. * @param {RestoreReturn} config - Configurations determining which relations to restore along with each of the shipping profiles. You can pass to its `returnLinkableKeys` * property any of the shipping profile's relation attribute names, such as `{type relation name}`. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise>} An object that includes the IDs of related records that were restored. * If there are no related records restored, the promise resolves to `void`. * * @example * await fulfillmentModuleService.restoreShippingProfiles([ * "sp_123", * "sp_321", * ]) */ restoreShippingProfiles(shippingProfileIds: string[], config?: RestoreReturn, sharedContext?: Context): Promise | void>; /** * This method retrieves a shipping option rule by its ID. * * @param {string} id - The ID of the shipping option rule. * @param {FindConfig} config - The configurations determining how the shipping option rule is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping option rule. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The retrieved shipping option rule. * * @example * A simple example that retrieves a shipping option rule by its ID: * * ```ts * const shippingOptionRule = * await fulfillmentModuleService.retrieveShippingOptionRule( * "sorul_123" * ) * ``` * * To specify relations that should be retrieved: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const shippingOptionRule = * await fulfillmentModuleService.retrieveShippingOptionRule( * "sorul_123", * { * relations: ["shipping_option"], * } * ) * ``` */ retrieveShippingOptionRule(id: string, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of shipping option rules based on optional filters and configuration. * * @param {FilterableShippingOptionRuleProps} filters - The filters to apply on the retrieved shipping option rules. * @param {FindConfig} config - The configurations determining how the shipping option rule is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping option rule. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The list of shipping option rules. * * @example * To retrieve a list of shipping option rules using their IDs: * * ```ts * const shippingOptionRules = * await fulfillmentModuleService.listShippingOptionRules({ * id: ["sorul_123", "sorul_321"], * }) * ``` * * To specify relations that should be retrieved within the shipping option rule: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const shippingOptionRules = * await fulfillmentModuleService.listShippingOptionRules( * { * id: ["sorul_123", "sorul_321"], * }, * { * relations: ["shipping_option"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const shippingOptionRules = * await fulfillmentModuleService.listShippingOptionRules( * { * id: ["sorul_123", "sorul_321"], * }, * { * relations: ["shipping_option"], * take: 20, * skip: 2, * } * ) * ``` */ listShippingOptionRules(filters?: FilterableShippingOptionRuleProps, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of shipping option rules along with the total count of available shipping option rules satisfying the provided filters. * * @param {FilterableShippingOptionRuleProps} filters - The filters to apply on the retrieved shipping option rules. * @param {FindConfig} config - The configurations determining how the shipping option rule is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping option rule. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise<[ShippingOptionRuleDTO[], number]>} The list of shipping option rules along with their total count. * * @example * To retrieve a list of shipping option rules using their IDs: * * ```ts * const [shippingOptionRules, count] = * await fulfillmentModuleService.listAndCountShippingOptionRules( * { * id: ["sorul_123", "sorul_321"], * } * ) * ``` * * To specify relations that should be retrieved within the shipping option rule: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const [shippingOptionRules, count] = * await fulfillmentModuleService.listAndCountShippingOptionRules( * { * id: ["sorul_123", "sorul_321"], * }, * { * relations: ["shipping_option"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const [shippingOptionRules, count] = * await fulfillmentModuleService.listAndCountShippingOptionRules( * { * id: ["sorul_123", "sorul_321"], * }, * { * relations: ["shipping_option"], * take: 20, * skip: 2, * } * ) * ``` */ listAndCountShippingOptionRules(filters?: FilterableShippingOptionRuleProps, config?: FindConfig, sharedContext?: Context): Promise<[ShippingOptionRuleDTO[], number]>; /** * This method creates shipping option rules. * * @param {CreateShippingOptionRuleDTO[]} data - The shipping option rules to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created shipping option rules. * * @example * const shippingOptionRules = * await fulfillmentModuleService.createShippingOptionRules([ * { * attribute: "customer_group", * operator: "in", * value: "cg_vipgroup", * shipping_option_id: "so_123", * }, * { * attribute: "total_weight", * operator: "lt", * value: "2000", * shipping_option_id: "so_321", * }, * ]) */ createShippingOptionRules(data: CreateShippingOptionRuleDTO[], sharedContext?: Context): Promise; /** * This method creates a shipping option rule. * * @param {CreateShippingOptionRuleDTO} data - The shipping option rule to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created shipping option rule. * * @example * const shippingOptionRule = * await fulfillmentModuleService.createShippingOptionRules({ * attribute: "customer_group", * operator: "in", * value: "cg_vipgroup", * shipping_option_id: "so_123", * }) */ createShippingOptionRules(data: CreateShippingOptionRuleDTO, sharedContext?: Context): Promise; /** * This method updates existing shipping option rules. * * @param {UpdateShippingOptionRuleDTO[]} data - The attributes to update in the shipping option rules. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated shipping option rules. * * @example * const shippingOptionRules = * await fulfillmentModuleService.updateShippingOptionRules([ * { * id: "sorul_123", * operator: "in", * }, * { * id: "sorul_321", * attribute: "customer_group", * value: "cp_vipgroup", * }, * ]) */ updateShippingOptionRules(data: UpdateShippingOptionRuleDTO[], sharedContext?: Context): Promise; /** * This method updates an existing shipping option rule. * * @param {UpdateShippingOptionRuleDTO} data - The attributes to update in the shipping option rule. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated shipping option rule. * * @example * const shippingOptionRule = * await fulfillmentModuleService.updateShippingOptionRules({ * id: "sorul_123", * operator: "in", * }) */ updateShippingOptionRules(data: UpdateShippingOptionRuleDTO, sharedContext?: Context): Promise; /** * This method deletes shipping option rules by their IDs. * * @param {string[]} ids - The IDs of the shipping option rules. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the shipping option rules are deleted successfully. * * @example * await fulfillmentModuleService.deleteShippingOptionRules([ * "sorul_123", * "sorul_321", * ]) */ deleteShippingOptionRules(ids: string[], sharedContext?: Context): Promise; /** * This method deletes a shipping option by its ID. * * @param {string} id - The ID of the shipping option. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the shipping option is deleted successfully. * * @example * await fulfillmentModuleService.deleteShippingOptionRules( * "sorul_123" * ) */ deleteShippingOptionRules(id: string, sharedContext?: Context): Promise; /** * This method retrieves a shipping option type by its ID. * * @param {string} id - The ID of the shipping option type. * @param {FindConfig} config - The configurations determining how the shipping option type is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping option type. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The retrieved shipping option type. * * @example * A simple example that retrieves a shipping option type by its ID: * * ```ts * const shippingOptionType = * await fulfillmentModuleService.retrieveShippingOptionType( * "sotype_123" * ) * ``` * * To specify relations that should be retrieved: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const shippingOptionType = * await fulfillmentModuleService.retrieveShippingOptionType( * "sotype_123", * { * relations: ["shipping_option"], * } * ) * ``` */ retrieveShippingOptionType(id: string, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of shipping option types based on optional filters and configuration. * * @param {FilterableShippingOptionTypeProps} filters - The filters to apply on the retrieved shipping option types. * @param {FindConfig} config - The configurations determining how the shipping option type is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping option type. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The list of shipping option types. * * @example * To retrieve a list of shipping option types using their IDs: * * ```ts * const shippingOptionTypes = * await fulfillmentModuleService.listShippingOptionTypes({ * id: ["sotype_123", "sotype_321"], * }) * ``` * * To specify relations that should be retrieved within the shipping option type: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const shippingOptionTypes = * await fulfillmentModuleService.listShippingOptionTypes( * { * id: ["sotype_123", "sotype_321"], * }, * { * relations: ["shipping_option"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const shippingOptionTypes = * await fulfillmentModuleService.listShippingOptionTypes( * { * id: ["sotype_123", "sotype_321"], * }, * { * relations: ["shipping_option"], * take: 20, * skip: 2, * } * ) * ``` */ listShippingOptionTypes(filters?: FilterableShippingOptionTypeProps, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of shipping option types along with the total count of available shipping option types satisfying the provided filters. * * @param {FilterableShippingOptionTypeProps} filters - The filters to apply on the retrieved shipping option types. * @param {FindConfig} config - The configurations determining how the shipping option type is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a shipping option type. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise<[ShippingOptionTypeDTO[], number]>} The list of shipping option types along with their total count. * * @example * To retrieve a list of shipping option types using their IDs: * * ```ts * const [shippingOptionTypes, count] = * await fulfillmentModuleService.listAndCountShippingOptionTypes( * { * id: ["sotype_123", "sotype_321"], * } * ) * ``` * * To specify relations that should be retrieved within the shipping option type: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const [shippingOptionTypes, count] = * await fulfillmentModuleService.listAndCountShippingOptionTypes( * { * id: ["sotype_123", "sotype_321"], * }, * { * relations: ["shipping_option"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const [shippingOptionTypes, count] = * await fulfillmentModuleService.listAndCountShippingOptionTypes( * { * id: ["sotype_123", "sotype_321"], * }, * { * relations: ["shipping_option"], * take: 20, * skip: 2, * } * ) * ``` */ listAndCountShippingOptionTypes(filters?: FilterableShippingOptionTypeProps, config?: FindConfig, sharedContext?: Context): Promise<[ShippingOptionTypeDTO[], number]>; /** * This method deletes shipping option types by their IDs. * * @param {string[]} ids - The IDs of the shipping option types. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the shipping option types are deleted successfully. * * @example * await fulfillmentModuleService.deleteShippingOptionTypes([ * "sotype_123", * "sotype_321", * ]) */ deleteShippingOptionTypes(ids: string[], sharedContext?: Context): Promise; /** * This method deletes a shipping option type by its ID. * * @param {string} id - The ID of the shipping option type. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the shipping option type is deleted. * * @example * await fulfillmentModuleService.deleteShippingOptionTypes( * "sotype_123" * ) */ deleteShippingOptionTypes(id: string, sharedContext?: Context): Promise; /** * This method retrieves a fulfillment by its ID. * * @param {string} id - The ID of the fulfillment. * @param {FindConfig} config - The configurations determining how the fulfillment is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a fulfillment. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The retrieved fulfillment. * * @example * A simple example that retrieves a fulfillment by its ID: * * ```ts * const fulfillment = * await fulfillmentModuleService.retrieveFulfillment( * "ful_123" * ) * ``` * * To specify relations that should be retrieved: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const fulfillment = * await fulfillmentModuleService.retrieveFulfillment( * "ful_123", * { * relations: ["shipping_option"], * } * ) * ``` */ retrieveFulfillment(id: string, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of fulfillments based on optional filters and configuration. * * @param {FilterableFulfillmentSetProps} filters - The filters to apply on the retrieved fulfillments. * @param {FindConfig} config - The configurations determining how the fulfillment is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a fulfillment. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The list of fulfillments. * * @example * To retrieve a list of fulfillments using their IDs: * * ```ts * const fulfillments = * await fulfillmentModuleService.listFulfillments({ * id: ["ful_123", "ful_321"], * }) * ``` * * To specify relations that should be retrieved within the fulfillment: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const fulfillments = * await fulfillmentModuleService.listFulfillments( * { * id: ["ful_123", "ful_321"], * }, * { * relations: ["shipping_option"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const fulfillments = * await fulfillmentModuleService.listFulfillments( * { * id: ["ful_123", "ful_321"], * }, * { * relations: ["shipping_option"], * take: 20, * skip: 2, * } * ) * ``` */ listFulfillments(filters?: FilterableFulfillmentProps, config?: FindConfig, sharedContext?: Context): Promise; /** * This method retrieves a paginated list of fulfillments along with the total count of available fulfillments satisfying the provided filters. * * @param {FilterableFulfillmentSetProps} filters - The filters to apply on the retrieved fulfillment sets. * @param {FindConfig} config - The configurations determining how the fulfillment is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a fulfillment. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise<[FulfillmentDTO[], number]>} The list of fulfillments along with their total count. * * @example * To retrieve a list of fulfillments using their IDs: * * ```ts * const [fulfillments, count] = * await fulfillmentModuleService.listAndCountFulfillments( * { * id: ["ful_123", "ful_321"], * }, * { * relations: ["shipping_option"], * take: 20, * skip: 2, * } * ) * ``` * * To specify relations that should be retrieved within the fulfillment: * * :::note * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. * * ::: * * ```ts * const [fulfillments, count] = * await fulfillmentModuleService.listAndCountFulfillments( * { * id: ["ful_123", "ful_321"], * }, * { * relations: ["shipping_option"], * } * ) * ``` * * By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter: * * ```ts * const [fulfillments, count] = * await fulfillmentModuleService.listAndCountFulfillments({ * id: ["ful_123", "ful_321"], * }) * ``` */ listAndCountFulfillments(filters?: FilterableFulfillmentProps, config?: FindConfig, sharedContext?: Context): Promise<[FulfillmentDTO[], number]>; /** * This method creates a fulfillment and call the provider to create a fulfillment. * * @param {CreateFulfillmentDTO} data - The fulfillment to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created fulfillment. * * @example * const fulfillment = * await fulfillmentModuleService.createFulfillment({ * location_id: "loc_123", * provider_id: "webshipper", * delivery_address: { * address_1: "4120 Auto Park Cir", * country_code: "us", * }, * items: [ * { * title: "Shirt", * sku: "SHIRT", * quantity: 1, * barcode: "ABCED", * }, * ], * labels: [ * { * tracking_number: "1234567", * tracking_url: "https://example.com/tracking", * label_url: "https://example.com/label", * }, * ], * order: {}, * }) */ createFulfillment(data: CreateFulfillmentDTO, sharedContext?: Context): Promise; /** * This method deletes fulfillment by IDs after cancelation. * * @param {string} id - The ID of the fulfillment. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} Resolves when the fulfillment set is deleted successfully. * * @example * await fulfillmentModuleService.deleteFulfillment("ful_123") */ deleteFulfillment(id: string, sharedContext?: Context): Promise; /** * This method creates a fulfillment and call the provider to create a return. * * @param {CreateFulfillmentDTO} data - The fulfillment to be created. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The created fulfillment. * * @example * const fulfillment = * await fulfillmentModuleService.createReturnFulfillment({ * location_id: "loc_123", * provider_id: "webshipper", * delivery_address: { * address_1: "4120 Auto Park Cir", * country_code: "us", * }, * items: [ * { * title: "Shirt", * sku: "SHIRT", * quantity: 1, * barcode: "ABCED", * }, * ], * labels: [ * { * tracking_number: "1234567", * tracking_url: "https://example.com/tracking", * label_url: "https://example.com/label", * }, * ], * order: {}, * }) */ createReturnFulfillment(data: CreateFulfillmentDTO, sharedContext?: Context): Promise; /** * This method updates an existing fulfillment. * * @param {string} id - The ID of the fulfillment. * @param {UpdateFulfillmentDTO} data - The attributes to update in the fulfillment. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The updated fulfillment. * * @example * const fulfillment = * await fulfillmentModuleService.updateFulfillment( * "ful_123", * { * location_id: "loc_123", * } * ) */ updateFulfillment(id: string, data: UpdateFulfillmentDTO, sharedContext?: Context): Promise; /** * This method cancels a fulfillment. * * @param {string} id - The ID of the fulfillment. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} cancels a fulfillment. * * @example * const fulfillment = * await fulfillmentModuleService.cancelFulfillment("ful_123") */ cancelFulfillment(id: string, sharedContext?: Context): Promise; /** * This method retrieves the fulfillment options of a fulfillment provider. * * @param {string} providerId - The fulfillment provider's ID. * @returns {Promise[]>} The fulfillment provider's options. * * @example * const fulfillment = * await fulfillmentModuleService.retrieveFulfillmentOptions( * "ful_123" * ) */ retrieveFulfillmentOptions(providerId: string): Promise[]>; /** * This method validates a fulfillment option with the provider it belongs to. * * @param {string} providerId - The fulfillment provider's ID. * @param {Record} data - The fulfillment option to validate. * @returns {Promise} Whether the fulfillment option is valid with the specified provider. * * @example * const isValid = * await fulfillmentModuleService.validateFulfillmentOption( * "webshipper", * { * code: "express", * } * ) */ validateFulfillmentOption(providerId: string, data: Record): Promise; /** * This method validates fulfillment data with the provider it belongs to. * e.g. if the shipping option requires a drop point, the data you pass to create the * shipping method must contain a drop point ID. This method can be used to * validate that. * * @param {string} providerId - The fulfillment provider's ID. * @param {Record} optionData - The fulfillment option data to validate. * @param {Record} data - The fulfillment data to validate. * @param {ValidateFulfillmentDataContext} context - The context to validate the fulfillment option data in. * @returns {Promise} Whether the fulfillment option data is valid with the specified provider. * * @example * const isValid = * await fulfillmentModuleService.validateFulfillmentData( * "webshipper", * { * requires_drop_point: true, * }, * { * drop_point_id: "dp_123", * }, * {} * ) */ validateFulfillmentData(providerId: string, optionData: Record, data: Record, context: ValidateFulfillmentDataContext): Promise>; /** * This method checks whether a shipping option can be used for a specified context. * * @param {string} shippingOptionId - The shipping option's ID. * @param {Record} context - The context to check. * @returns {Promise} Whether the shipping option is valid for the specified context. * * @example * const isValid = * await fulfillmentModuleService.validateShippingOption( * "so_123", * { * customer_group: "cg_vipgroup", * } * ) */ validateShippingOption(shippingOptionId: string, context: Record): Promise; /** * This method checks whether a shipping option can have calculated price. * * @param {FulfillmentTypes.CreateShippingOptionDTO[]} shippingOptionsData - The shipping options data to check. * @returns {Promise} Whether the shipping options can have calculated price. * * @example * const isValid = * await fulfillmentModuleService.validateShippingOptionsForPriceCalculation( * [ * { * provider_id: "webshipper", * price_type: "calculated", * }, * ] * ) */ validateShippingOptionsForPriceCalculation(shippingOptionsData: CreateShippingOptionDTO[], sharedContext?: Context): Promise; /** * This method calculates the prices for one or more shipping options. * * @param {CalculateShippingOptionPriceDTO[]} shippingOptionsData - The shipping options data to calculate the prices for. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The calculated shipping option prices. * * @example * const prices = * await fulfillmentModuleService.calculateShippingOptionsPrices( * [ * { * provider_id: "webshipper", * data: { * cart: { * id: "cart_123", * }, * }, * }, * ] * ) */ calculateShippingOptionsPrices(shippingOptionsData: CalculateShippingOptionPriceDTO[], sharedContext?: Context): Promise; /** * This method retrieves a paginated list of fulfillment providers based on optional filters and configuration. * * @param {FilterableFulfillmentProviderProps} filters - The filters to apply on the retrieved fulfillment providers. * @param {FindConfig} config - The configurations determining how the fulfillment provider is retrieved. Its properties, such as `select` or `relations`, accept the * attributes or relations associated with a fulfillment provider. * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. * @returns {Promise} The list of fulfillment providers. * * @example * To retrieve a list of fulfillment providers using their IDs: * * ```ts * const providers = await fulfillmentModuleService.listFulfillmentProviders({ * id: ["sepro_123", "sepro_321"], * }) * ``` * */ listFulfillmentProviders(filters?: FilterableFulfillmentProviderProps, config?: FindConfig, sharedContext?: Context): Promise; } //# sourceMappingURL=service.d.ts.map