Skip to main content
Skip to main content
You're viewing the documentation for v1, which isn't the latest Medusa version.Latest documentation

IFulfillmentModuleService

The main service interface for the Fulfillment Module.

Methods

retrieve

This method retrieves a fulfillment set by its ID.

Example

A simple example that retrieves a fulfillment set by its ID:

const fulfillmentSet =
await fulfillmentModuleService.retrieve("fuset_123")

To specify relations that should be retrieved:

const fulfillmentSet = await fulfillmentModuleService.retrieve(
"fuset_123",
{
relations: ["service_zones"],
}
)

Parameters

idstringRequired
The ID of the fulfillment set.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentSetDTO>Required
The retrieved fulfillment set.

list

This method retrieves a paginated list of fulfillment sets based on optional filters and configuration.

Example

To retrieve a list of fulfillment sets using their IDs:

const fulfillmentSets = await fulfillmentModuleService.list({
id: ["fuset_123", "fuset_321"],
})

To specify relations that should be retrieved within the fulfillment set:

const fulfillmentSets = await fulfillmentModuleService.list(
{
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:

const fulfillmentSets = await fulfillmentModuleService.list(
{
id: ["fuset_123", "fuset_321"],
},
{
relations: ["search_zones"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved fulfillment sets.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentSetDTO[]>Required
The list of fulfillment sets.

listAndCount

This method retrieves a paginated list of fulfillment sets along with the total count of available fulfillment sets satisfying the provided filters.

Example

To retrieve a list of fulfillment sets using their IDs:

const [fulfillmentSets, count] =
await fulfillmentModuleService.listAndCount({
id: ["fuset_123", "fuset_321"],
})

To specify relations that should be retrieved within the fulfillment set:

const [fulfillmentSets, count] =
await fulfillmentModuleService.listAndCount(
{
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:

const [fulfillmentSets, count] =
await fulfillmentModuleService.listAndCount(
{
id: ["fuset_123", "fuset_321"],
},
{
relations: ["search_zones"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved fulfillment sets.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<[FulfillmentSetDTO[], number]>Required
The list of fulfillment sets along with their total count.

create

**create**(data, sharedContext?): Promise&#60;[FulfillmentSetDTO](types.FulfillmentTypes.FulfillmentSetDTO.mdx)[]&#62;

This method creates fulfillment sets.

Example

const fulfillmentSets = await fulfillmentModuleService.create(
[
{
name: "Shipping",
type: "default",
},
{
name: "Pickup",
type: "provider-controlled",
},
]
)

Parameters

The fulfillment sets to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentSetDTO[]>Required
The created fulfillment sets.

**create**(data, sharedContext?): Promise&#60;[FulfillmentSetDTO](types.FulfillmentTypes.FulfillmentSetDTO.mdx)&#62;

This method creates a fulfillment set.

Example

const fulfillmentSet = await fulfillmentModuleService.create({
name: "Shipping",
type: "default",
})

Parameters

The fulfillment set to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentSetDTO>Required
The created fulfillment set.

update

**update**(data, sharedContext?): Promise&#60;[FulfillmentSetDTO](types.FulfillmentTypes.FulfillmentSetDTO.mdx)[]&#62;

This method updates existing fulfillment sets.

Example

const fulfillmentSets = await fulfillmentModuleService.update(
[
{
id: "fuset_123",
name: "Shipping",
},
{
id: "fuset_321",
name: "Pickup",
},
]
)

Parameters

The attributes to update in the fulfillment sets.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentSetDTO[]>Required
The updated fulfillment sets.

**update**(data, sharedContext?): Promise&#60;[FulfillmentSetDTO](types.FulfillmentTypes.FulfillmentSetDTO.mdx)&#62;

This method updates an existing fulfillment set.

Example

const fulfillmentSet = await fulfillmentModuleService.update({
id: "fuset_123",
name: "Shipping",
})

Parameters

The attributes to update in the fulfillment set.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentSetDTO>Required
The updated fulfillment set.

delete

**delete**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes fulfillment sets by their IDs.

Example

await fulfillmentModuleService.delete([
"fuset_123",
"fuset_321",
])

Parameters

idsstring[]Required
The IDs of the fulfillment sets.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the fulfillment sets are deleted successfully.

**delete**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a fulfillment set by its ID.

Example

await fulfillmentModuleService.delete("fuset_123")

Parameters

idstringRequired
The ID of the fulfillment set.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the fulfillment set is deleted successfully.

softDelete

This method soft deletes fulfillment sets by their IDs.

Example

await fulfillmentModuleService.softDelete([
"fuset_123",
"fuset_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

fulfillmentIdsstring[]Required
The IDs of the fulfillment sets.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<string, string[]>>Required
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.

restore

This method restores a soft deleted fulfillment by its IDs.

Example

await fulfillmentModuleService.restore([
"fuset_123",
"fuset_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

fulfillmentIdsstring[]Required
The IDs of the fulfillment sets.
configRestoreReturn<TReturnableLinkableKeys>
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<string, string[]>>Required
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

retrieveServiceZone

This method retrieves a service zone by its ID.

Example

A simple example that retrieves a service zone by its ID:

const serviceZone =
await fulfillmentModuleService.retrieveServiceZone(
"serzo_123"
)

To specify relations that should be retrieved:

const serviceZone =
await fulfillmentModuleService.retrieveServiceZone(
"serzo_123",
{
relations: ["shipping_options"],
}
)

Parameters

idstringRequired
The ID of the service zone.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ServiceZoneDTO>Required
The retrieved service zone.

listServiceZones

This method retrieves a paginated list of service zones based on optional filters and configuration.

Example

To retrieve a list of service zones using their IDs:

const serviceZones =
await fulfillmentModuleService.listServiceZones({
id: ["serzo_123", "serzo_321"],
})

To specify relations that should be retrieved within the service zone:

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:

const serviceZones =
await fulfillmentModuleService.listServiceZones(
{
id: ["serzo_123", "serzo_321"],
},
{
relations: ["shipping_options"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved service zones.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ServiceZoneDTO[]>Required
The list of service zones.

listAndCountServiceZones

This method retrieves a paginated list of service zones along with the total count of available service zones satisfying the provided filters.

Example

To retrieve a list of service zones using their IDs:

const [serviceZones, count] =
await fulfillmentModuleService.listAndCountServiceZones({
id: ["serzo_123", "serzo_321"],
})

To specify relations that should be retrieved within the service zone:

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:

const [serviceZones, count] =
await fulfillmentModuleService.listAndCountServiceZones(
{
id: ["serzo_123", "serzo_321"],
},
{
relations: ["shipping_options"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved service zones.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<[ServiceZoneDTO[], number]>Required
The list of service zones along with their total count.

createServiceZones

**createServiceZones**(data, sharedContext?): Promise&#60;[ServiceZoneDTO](types.FulfillmentTypes.ServiceZoneDTO.mdx)[]&#62;

This method creates 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",
},
])

Parameters

dataCreateServiceZoneDTO[]Required
The service zones to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ServiceZoneDTO[]>Required
The created service zones.

**createServiceZones**(data, sharedContext?): Promise&#60;[ServiceZoneDTO](types.FulfillmentTypes.ServiceZoneDTO.mdx)&#62;

This method creates a service zone.

Example

const serviceZone =
await fulfillmentModuleService.createServiceZones({
name: "Nordic Shipping Methods",
fulfillment_set_id: "fuset_123",
})

Parameters

The service zone to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ServiceZoneDTO>Required
The created service zone.

updateServiceZones

**updateServiceZones**(id, data, sharedContext?): Promise&#60;[ServiceZoneDTO](types.FulfillmentTypes.ServiceZoneDTO.mdx)&#62;

This method updates an existing service zone.

Example

const serviceZone =
await fulfillmentModuleService.updateServiceZones(
"serzo_123",
{
name: "US",
}
)

Parameters

idstringRequired
The ID of the service zone.
The attributes to update in the service zone.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ServiceZoneDTO>Required
The updated service zone.

**updateServiceZones**(selector, data, sharedContext?): Promise&#60;[ServiceZoneDTO](types.FulfillmentTypes.ServiceZoneDTO.mdx)[]&#62;

This method updates existing service zones matching the specified filters.

Example

const serviceZones =
await fulfillmentModuleService.updateServiceZones(
{
id: ["serzo_123", "serzo_321"],
},
{
name: "US",
}
)

Parameters

The filters specifying which service zones to update.
The attributes to update in the service zone.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ServiceZoneDTO[]>Required
The updated service zones.

upsertServiceZones

**upsertServiceZones**(data, sharedContext?): Promise&#60;[ServiceZoneDTO](types.FulfillmentTypes.ServiceZoneDTO.mdx)&#62;

This method updates or creates a service zone if it doesn't exist.

Example

const serviceZone =
await fulfillmentModuleService.upsertServiceZones({
id: "serzo_123",
name: "US",
})

Parameters

The attributes in the service zone to be created or updated.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ServiceZoneDTO>Required
The created or updated service zone.

**upsertServiceZones**(data, sharedContext?): Promise&#60;[ServiceZoneDTO](types.FulfillmentTypes.ServiceZoneDTO.mdx)[]&#62;

This method updates or creates service zones if they don't exist.

Example

const serviceZones =
await fulfillmentModuleService.upsertServiceZones([
{
id: "serzo_123",
name: "US",
},
{
name: "US",
fulfillment_set_id: "fuset_123",
},
])

Parameters

dataUpsertServiceZoneDTO[]Required
The attributes in the service zones to be created or updated.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ServiceZoneDTO[]>Required
The created or updated service zones.

deleteServiceZones

**deleteServiceZones**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes service zones by their IDs.

Example

await fulfillmentModuleService.deleteServiceZones([
"serzo_123",
"serzo_321",
])

Parameters

idsstring[]Required
The IDs of the service zone.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the service zones are deleted.

**deleteServiceZones**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a service zone by its ID.

Example

await fulfillmentModuleService.deleteServiceZones("serzo_123")

Parameters

idstringRequired
The ID of the service zone.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the service zone is deleted.

softDeleteServiceZones

This method soft deletes service zones by their IDs.

Example

await fulfillmentModuleService.softDeleteServiceZones([
"serzo_123",
"serzo_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

serviceZoneIdsstring[]Required
The IDs of the service zones.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<string, string[]>>Required
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.

restoreServiceZones

This method restores a soft deleted service zones by their IDs.

Example

await fulfillmentModuleService.restoreServiceZones([
"serzo_123",
"serzo_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

serviceZoneIdsstring[]Required
The IDs of the service zones.
configRestoreReturn<TReturnableLinkableKeys>
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}.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<string, string[]>>Required
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

retrieveGeoZone

This method retrieves a geo zone by its ID.

Example

A simple example that retrieves a geo zone by its ID:

const geoZone =
await fulfillmentModuleService.retrieveGeoZone("fgz_123")

To specify relations that should be retrieved:

const geoZone =
await fulfillmentModuleService.retrieveGeoZone("fgz_123", {
relations: ["service_zone"],
})

Parameters

idstringRequired
The ID of the geo zone.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<GeoZoneDTO>Required
The retrieved geo zone.

listGeoZones

This method retrieves a paginated list of geo zones based on optional filters and configuration.

Example

To retrieve a list of geo zones using their IDs:

const geoZones = await fulfillmentModuleService.listGeoZones({
id: ["fgz_123", "fgz_321"],
})

To specify relations that should be retrieved within the geo zone:

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:

const geoZones = await fulfillmentModuleService.listGeoZones(
{
id: ["fgz_123", "fgz_321"],
},
{
relations: ["service_zone"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved geo zones.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<GeoZoneDTO[]>Required
The list of geo zones.

listAndCountGeoZones

This method retrieves a paginated list of geo zones along with the total count of available geo zones satisfying the provided filters.

Example

To retrieve a list of geo zones using their IDs:

const [geoZones, count] =
await fulfillmentModuleService.listAndCountGeoZones({
id: ["fgz_123", "fgz_321"],
})

To specify relations that should be retrieved within the geo zone:

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:

const [geoZones, count] =
await fulfillmentModuleService.listAndCountGeoZones(
{
id: ["fgz_123", "fgz_321"],
},
{
relations: ["service_zone"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved geo zones.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<[GeoZoneDTO[], number]>Required
The list of geo zones along with their total count.

createGeoZones

**createGeoZones**(data, sharedContext?): Promise&#60;[GeoZoneDTO](types.FulfillmentTypes.GeoZoneDTO.mdx)[]&#62;

This method creates 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: "VT",
city: "Vermont",
country_code: "us",
},
])

Parameters

dataCreateGeoZoneDTO[]Required
The geo zones to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<GeoZoneDTO[]>Required
The created geo zones.

**createGeoZones**(data, sharedContext?): Promise&#60;[GeoZoneDTO](types.FulfillmentTypes.GeoZoneDTO.mdx)&#62;

This method creates a geo zones.

Example

const geoZones =
await fulfillmentModuleService.createGeoZones({
type: "country",
service_zone_id: "serzo_123",
country_code: "us",
})

Parameters

dataCreateGeoZoneDTORequired
The geo zone to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<GeoZoneDTO>Required
The created geo zones.

updateGeoZones

**updateGeoZones**(data, sharedContext?): Promise&#60;[GeoZoneDTO](types.FulfillmentTypes.GeoZoneDTO.mdx)[]&#62;

This method updates existing geo zones.

Example

const geoZones =
await fulfillmentModuleService.updateGeoZones([
{
id: "fgz_123",
type: "country",
country_code: "us",
},
{
id: "fgz_321",
type: "city",
province_code: "VT",
},
])

Parameters

dataUpdateGeoZoneDTO[]Required
The attributes to update in the geo zones.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<GeoZoneDTO[]>Required
The updated geo zones.

**updateGeoZones**(data, sharedContext?): Promise&#60;[GeoZoneDTO](types.FulfillmentTypes.GeoZoneDTO.mdx)&#62;

This method updates an existing fulfillment.

Example

const geoZones =
await fulfillmentModuleService.updateGeoZones({
id: "fgz_123",
type: "country",
country_code: "us",
})

Parameters

dataUpdateGeoZoneDTORequired
The attributes to update in the geo zone.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<GeoZoneDTO>Required
The updated fulfillment.

deleteGeoZones

**deleteGeoZones**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes geo zones by their IDs.

Example

await fulfillmentModuleService.deleteGeoZones([
"fgz_123",
"fgz_321",
])

Parameters

idsstring[]Required
The IDs of the geo zones.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the geo zones are deleted.

**deleteGeoZones**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a geo zone by its ID.

Example

await fulfillmentModuleService.deleteGeoZones("fgz_123")

Parameters

idstringRequired
The ID of the geo zone.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the geo zone is deleted.

softDeleteGeoZones

This method soft deletes geo zones by their IDs.

Example

await fulfillmentModuleService.softDeleteGeoZones([
"fgz_123",
"fgz_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

geoZoneIdsstring[]Required
The IDs of the geo zones.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<string, string[]>>Required
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.

restoreGeoZones

This method restores soft deleted geo zones by their IDs.

Example

await fulfillmentModuleService.restoreGeoZones([
"fgz_123",
"fgz_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

geoZoneIdsstring[]Required
The IDs of the geo zones.
configRestoreReturn<TReturnableLinkableKeys>
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}.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<string, string[]>>Required
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

retrieveShippingOption

This method retrieves a shipping option by its ID.

Example

A simple example that retrieves a shipping option by its ID:

const shippingOption =
await fulfillmentModuleService.retrieveShippingOption(
"so_123"
)

To specify relations that should be retrieved:

const shippingOption =
await fulfillmentModuleService.retrieveShippingOption(
"so_123",
{
relations: ["fulfillments"],
}
)

Parameters

idstringRequired
The ID of the shipping option.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionDTO>Required
The retrieved shipping option.

listShippingOptions

This method retrieves a paginated list of shipping options based on optional filters and configuration.

Example

To retrieve a list of shipping options using their IDs:

const shippingOptions =
await fulfillmentModuleService.listShippingOptions({
id: ["so_123", "so_321"],
})

To specify relations that should be retrieved within the shipping option:

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:

const shippingOptions =
await fulfillmentModuleService.listShippingOptions(
{
id: ["so_123", "so_321"],
},
{
relations: ["fulfillments"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved shipping options.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionDTO[]>Required
The list of shipping options.

listShippingOptionsForContext

This method retrieves a paginated list of shipping options based on the provided context.

Example

To retrieve a list of shipping options matching a context:

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:

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:

const shippingOptions =
await fulfillmentModuleService.listShippingOptionsForContext(
{
fulfillment_set_id: ["fuset_123"],
address: {
country_code: "us",
},
},
{
relations: ["fulfillments"],
take: 20,
skip: 2,
}
)

Parameters

The context of the how the shipping option is being used. It acts as a filter for the retrieved shipping options.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionDTO[]>Required
The list of shipping options.

listAndCountShippingOptions

This method retrieves a paginated list of shipping options along with the total count of available shipping options satisfying the provided filters.

Example

To retrieve a list of shipping options using their IDs:

const [shippingOptions, count] =
await fulfillmentModuleService.listAndCountShippingOptions({
id: ["so_123", "so_321"],
})

To specify relations that should be retrieved within the shipping option:

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:

const [shippingOptions, count] =
await fulfillmentModuleService.listAndCountShippingOptions(
{
id: ["so_123", "so_321"],
},
{
relations: ["fulfillments"],
take: 20,
skip: 2,
}
)

Parameters

filtersOmit<FilterableShippingOptionProps, "context">
Construct a type with the properties of T except for those in type K.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<[ShippingOptionDTO[], number]>Required
The list of shipping options along with their total count.

createShippingOptions

**createShippingOptions**(data, sharedContext?): Promise&#60;[ShippingOptionDTO](types.FulfillmentTypes.ShippingOptionDTO.mdx)[]&#62;

This method creates 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",
},
},
])

Parameters

The shipping options to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionDTO[]>Required
The created shipping options.

**createShippingOptions**(data, sharedContext?): Promise&#60;[ShippingOptionDTO](types.FulfillmentTypes.ShippingOptionDTO.mdx)&#62;

This method creates a 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",
},
})

Parameters

The shipping option to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionDTO>Required
The created shipping option.

updateShippingOptions

**updateShippingOptions**(id, data, sharedContext?): Promise&#60;[ShippingOptionDTO](types.FulfillmentTypes.ShippingOptionDTO.mdx)&#62;

This method updates an existing shipping option.

Example

const shippingOption =
await fulfillmentModuleService.updateShippingOptions(
"so_123",
{
name: "Express shipping",
}
)

Parameters

idstringRequired
The ID of the shipping option.
The attributes to update in the shipping option.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionDTO>Required
The updated shipping option.

**updateShippingOptions**(selector, data, sharedContext?): Promise&#60;[ShippingOptionDTO](types.FulfillmentTypes.ShippingOptionDTO.mdx)[]&#62;

This method updates existing shipping options matching the specified filters.

Example

const shippingOptions =
await fulfillmentModuleService.updateShippingOptions(
{
id: ["so_123", "so_321"],
},
{
name: "Express Shipping",
}
)

Parameters

The filters specifying which shipping options to update.
The attributes to update in the shipping option.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionDTO[]>Required
The updated shipping options.

upsertShippingOptions

**upsertShippingOptions**(data, sharedContext?): Promise&#60;[ShippingOptionDTO](types.FulfillmentTypes.ShippingOptionDTO.mdx)&#62;

This method updates or creates a shipping option if it doesn't exist.

Example

const shippingOptions =
await fulfillmentModuleService.upsertShippingOptions({
id: "so_123",
name: "Express Shipping",
})

Parameters

The attributes in the shipping option to be created or updated.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionDTO>Required
The created or updated shipping option.

**upsertShippingOptions**(data, sharedContext?): Promise&#60;[ShippingOptionDTO](types.FulfillmentTypes.ShippingOptionDTO.mdx)[]&#62;

This method updates or creates shipping options if they don't exist.

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",
},
},
])

Parameters

The attributes in the shipping options to be created or updated.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionDTO[]>Required
The created or updated shipping options.

deleteShippingOptions

**deleteShippingOptions**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes shipping options by their IDs.

Example

await fulfillmentModuleService.deleteShippingOptions([
"so_123",
"so_321",
])

Parameters

idsstring[]Required
The IDs of the shipping options.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping options are deleted successfully.

**deleteShippingOptions**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a shipping option by its ID.

Example

await fulfillmentModuleService.deleteShippingOptions("so_123")

Parameters

idstringRequired
The ID of the shipping option.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping option is deleted successfully.

softDeleteShippingOptions

This method soft deletes shipping option by their IDs.

Example

await fulfillmentModuleService.softDeleteShippingOptions([
"so_123",
"so_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

shippingOptionIdsstring[]Required
The IDs of the shipping options.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<string, string[]>>Required
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.

restoreShippingOptions

This method restores soft deleted shipping options by their IDs.

Example

await fulfillmentModuleService.restoreShippingOptions([
"so_123",
"so_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

shippingOptionIdsstring[]Required
The list of {summary}
configRestoreReturn<TReturnableLinkableKeys>
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<string, string[]>>Required
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

retrieveShippingProfile

This method retrieves a shipping profile by its ID.

Example

A simple example that retrieves a shipping profile by its ID:

const shippingProfile =
await fulfillmentModuleService.retrieveShippingProfile(
"sp_123"
)

To specify relations that should be retrieved:

const shippingProfile =
await fulfillmentModuleService.retrieveShippingProfile(
"sp_123",
{
relations: ["options"],
}
)

Parameters

idstringRequired
The ID of the shipping profile.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingProfileDTO>Required
The retrieved shipping profile.

listShippingProfiles

This method retrieves a paginated list of shipping profiles based on optional filters and configuration.

Example

To retrieve a list of shipping profiles using their IDs:

const shippingProfiles =
await fulfillmentModuleService.listShippingProfiles({
id: ["sp_123", "sp_321"],
})

To specify relations that should be retrieved within the shipping profile:

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:

const shippingProfiles =
await fulfillmentModuleService.listShippingProfiles(
{
id: ["sp_123", "sp_321"],
},
{
relations: ["shipping_options"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved shipping profiles.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingProfileDTO[]>Required
The list of shipping profiles.

listAndCountShippingProfiles

This method retrieves a paginated list of shipping profiles along with the total count of available shipping profiles satisfying the provided filters.

Example

To retrieve a list of shipping profiles using their IDs:

const [shippingProfiles, count] =
await fulfillmentModuleService.listAndCountShippingProfiles(
{
id: ["sp_123", "sp_321"],
}
)

To specify relations that should be retrieved within the shipping profile:

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:

const [shippingProfiles, count] =
await fulfillmentModuleService.listAndCountShippingProfiles(
{
id: ["sp_123", "sp_321"],
},
{
relations: ["shipping_options"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved shipping profiles.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<[ShippingProfileDTO[], number]>Required
The list of shipping profiles along with their total count.

createShippingProfiles

**createShippingProfiles**(data, sharedContext?): Promise&#60;[ShippingProfileDTO](types.FulfillmentTypes.ShippingProfileDTO.mdx)[]&#62;

This method creates shipping profiles.

Example

const shippingProfiles =
await fulfillmentModuleService.createShippingProfiles([
{
name: "Default",
},
{
name: "Digital",
},
])

Parameters

The shipping profiles to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingProfileDTO[]>Required
The created shipping profiles.

**createShippingProfiles**(data, sharedContext?): Promise&#60;[ShippingProfileDTO](types.FulfillmentTypes.ShippingProfileDTO.mdx)&#62;

This method creates a shipping profile.

Example

const shippingProfile =
await fulfillmentModuleService.createShippingProfiles({
name: "Default",
})

Parameters

The shipping profile to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingProfileDTO>Required
The created shipping profile.

updateShippingProfiles

**updateShippingProfiles**(data, sharedContext?): Promise&#60;[ShippingProfileDTO](types.FulfillmentTypes.ShippingProfileDTO.mdx)[]&#62;

This method updates existing shipping profiles.

Example

const shippingProfiles =
await fulfillmentModuleService.updateShippingProfiles([
{
id: "sp_123",
name: "Default",
},
{
id: "sp_321",
name: "Digital",
},
])

Parameters

The shipping profiles to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingProfileDTO[]>Required
The updated shipping profiles.

**updateShippingProfiles**(data, sharedContext?): Promise&#60;[ShippingProfileDTO](types.FulfillmentTypes.ShippingProfileDTO.mdx)&#62;

This method updates an existing shipping profiles.

Example

const shippingProfiles =
await fulfillmentModuleService.updateShippingProfiles({
id: "sp_123",
name: "Default",
})

Parameters

The shipping profile to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingProfileDTO>Required
The updated shipping profiles.

deleteShippingProfiles

**deleteShippingProfiles**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes shipping profiles by their IDs.

Example

await fulfillmentModuleService.deleteShippingProfiles([
"sp_123",
"sp_321",
])

Parameters

idsstring[]Required
The IDs of the shipping profiles.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping profiles are deleted.

**deleteShippingProfiles**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a shipping profile by its ID.

Example

await fulfillmentModuleService.deleteShippingProfiles(
"sp_123"
)

Parameters

idstringRequired
The ID of the shipping profile.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping profile is deleted.

softDeleteShippingProfiles

This method soft deletes shipping profiles by their IDs.

Example

await fulfillmentModuleService.softDeleteShippingProfiles([
"sp_123",
"sp_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

shippingProfileIdsstring[]Required
The IDs of the shipping profiles.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<string, string[]>>Required
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.

restoreShippingProfiles

This method restores soft deleted shipping profiles by their IDs.

Example

await fulfillmentModuleService.restoreShippingProfiles([
"sp_123",
"sp_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

shippingProfileIdsstring[]Required
The IDs of the shipping profiles.
configRestoreReturn<TReturnableLinkableKeys>
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}.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<string, string[]>>Required
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

retrieveShippingOptionRule

This method retrieves a shipping option rule by its ID.

Example

A simple example that retrieves a shipping option rule by its ID:

const shippingOptionRule =
await fulfillmentModuleService.retrieveShippingOptionRule(
"sorul_123"
)

To specify relations that should be retrieved:

const shippingOptionRule =
await fulfillmentModuleService.retrieveShippingOptionRule(
"sorul_123",
{
relations: ["shipping_option"],
}
)

Parameters

idstringRequired
The ID of the shipping option rule.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionRuleDTO>Required
The retrieved shipping option rule.

listShippingOptionRules

This method retrieves a paginated list of shipping option rules based on optional filters and configuration.

Example

To retrieve a list of shipping option rules using their IDs:

const shippingOptionRules =
await fulfillmentModuleService.listShippingOptionRules({
id: ["sorul_123", "sorul_321"],
})

To specify relations that should be retrieved within the shipping option rule:

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:

const shippingOptionRules =
await fulfillmentModuleService.listShippingOptionRules(
{
id: ["sorul_123", "sorul_321"],
},
{
relations: ["shipping_option"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved shipping option rules.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionRuleDTO[]>Required
The list of shipping option rules.

listAndCountShippingOptionRules

This method retrieves a paginated list of shipping option rules along with the total count of available shipping option rules satisfying the provided filters.

Example

To retrieve a list of shipping option rules using their IDs:

const [shippingOptionRules, count] =
await fulfillmentModuleService.listAndCountShippingOptionRules(
{
id: ["sorul_123", "sorul_321"],
}
)

To specify relations that should be retrieved within the shipping option rule:

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:

const [shippingOptionRules, count] =
await fulfillmentModuleService.listAndCountShippingOptionRules(
{
id: ["sorul_123", "sorul_321"],
},
{
relations: ["shipping_option"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved shipping option rules.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<[ShippingOptionRuleDTO[], number]>Required
The list of shipping option rules along with their total count.

createShippingOptionRules

**createShippingOptionRules**(data, sharedContext?): Promise&#60;[ShippingOptionRuleDTO](types.FulfillmentTypes.ShippingOptionRuleDTO.mdx)[]&#62;

This method creates 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",
},
])

Parameters

The shipping option rules to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionRuleDTO[]>Required
The created shipping option rules.

**createShippingOptionRules**(data, sharedContext?): Promise&#60;[ShippingOptionRuleDTO](types.FulfillmentTypes.ShippingOptionRuleDTO.mdx)&#62;

This method creates a shipping option rule.

Example

const shippingOptionRule =
await fulfillmentModuleService.createShippingOptionRules({
attribute: "customer_group",
operator: "in",
value: "cg_vipgroup",
shipping_option_id: "so_123",
})

Parameters

The shipping option rule to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionRuleDTO>Required
The created shipping option rule.

updateShippingOptionRules

**updateShippingOptionRules**(data, sharedContext?): Promise&#60;[ShippingOptionRuleDTO](types.FulfillmentTypes.ShippingOptionRuleDTO.mdx)[]&#62;

This method updates existing shipping option rules.

Example

const shippingOptionRules =
await fulfillmentModuleService.updateShippingOptionRules([
{
id: "sorul_123",
operator: "in",
},
{
id: "sorul_321",
attribute: "customer_group",
value: "cp_vipgroup",
},
])

Parameters

The attributes to update in the shipping option rules.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionRuleDTO[]>Required
The updated shipping option rules.

**updateShippingOptionRules**(data, sharedContext?): Promise&#60;[ShippingOptionRuleDTO](types.FulfillmentTypes.ShippingOptionRuleDTO.mdx)&#62;

This method updates an existing shipping option rule.

Example

const shippingOptionRule =
await fulfillmentModuleService.updateShippingOptionRules({
id: "sorul_123",
operator: "in",
})

Parameters

The attributes to update in the shipping option rule.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionRuleDTO>Required
The updated shipping option rule.

deleteShippingOptionRules

**deleteShippingOptionRules**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes shipping option rules by their IDs.

Example

await fulfillmentModuleService.deleteShippingOptionRules([
"sorul_123",
"sorul_321",
])

Parameters

idsstring[]Required
The IDs of the shipping option rules.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping option rules are deleted successfully.

**deleteShippingOptionRules**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a shipping option by its ID.

Example

await fulfillmentModuleService.deleteShippingOptionRules(
"sorul_123"
)

Parameters

idstringRequired
The ID of the shipping option.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping option is deleted successfully.

retrieveShippingOptionType

This method retrieves a shipping option type by its ID.

Example

A simple example that retrieves a shipping option type by its ID:

const shippingOptionType =
await fulfillmentModuleService.retrieveShippingOptionType(
"sotype_123"
)

To specify relations that should be retrieved:

const shippingOptionType =
await fulfillmentModuleService.retrieveShippingOptionType(
"sotype_123",
{
relations: ["shipping_option"],
}
)

Parameters

idstringRequired
The ID of the shipping option type.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionTypeDTO>Required
The retrieved shipping option type.

listShippingOptionTypes

This method retrieves a paginated list of shipping option types based on optional filters and configuration.

Example

To retrieve a list of shipping option types using their IDs:

const shippingOptionTypes =
await fulfillmentModuleService.listShippingOptionTypes({
id: ["sotype_123", "sotype_321"],
})

To specify relations that should be retrieved within the shipping option type:

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:

const shippingOptionTypes =
await fulfillmentModuleService.listShippingOptionTypes(
{
id: ["sotype_123", "sotype_321"],
},
{
relations: ["shipping_option"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved shipping option types.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingOptionTypeDTO[]>Required
The list of shipping option types.

listAndCountShippingOptionTypes

This method retrieves a paginated list of shipping option types along with the total count of available shipping option types satisfying the provided filters.

Example

To retrieve a list of shipping option types using their IDs:

const [shippingOptionTypes, count] =
await fulfillmentModuleService.listAndCountShippingOptionTypes(
{
id: ["sotype_123", "sotype_321"],
}
)

To specify relations that should be retrieved within the shipping option type:

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:

const [shippingOptionTypes, count] =
await fulfillmentModuleService.listAndCountShippingOptionTypes(
{
id: ["sotype_123", "sotype_321"],
},
{
relations: ["shipping_option"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved shipping option types.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<[ShippingOptionTypeDTO[], number]>Required
The list of shipping option types along with their total count.

deleteShippingOptionTypes

**deleteShippingOptionTypes**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes shipping option types by their IDs.

Example

await fulfillmentModuleService.deleteShippingOptionTypes([
"sotype_123",
"sotype_321",
])

Parameters

idsstring[]Required
The IDs of the shipping option types.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping option types are deleted successfully.

**deleteShippingOptionTypes**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a shipping option type by its ID.

Example

await fulfillmentModuleService.deleteShippingOptionTypes(
"sotype_123"
)

Parameters

idstringRequired
The ID of the shipping option type.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping option type is deleted.

retrieveFulfillment

This method retrieves a fulfillment by its ID.

Example

A simple example that retrieves a fulfillment by its ID:

const fulfillment =
await fulfillmentModuleService.retrieveFulfillment(
"ful_123"
)

To specify relations that should be retrieved:

const fulfillment =
await fulfillmentModuleService.retrieveFulfillment(
"ful_123",
{
relations: ["shipping_option"],
}
)

Parameters

idstringRequired
The ID of the fulfillment.
The configurations determining how the fulfillment is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a fulfillment.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentDTO>Required
The retrieved fulfillment.

listFulfillments

This method retrieves a paginated list of fulfillments based on optional filters and configuration.

Example

To retrieve a list of fulfillments using their IDs:

const fulfillments =
await fulfillmentModuleService.listFulfillments({
id: ["ful_123", "ful_321"],
})

To specify relations that should be retrieved within the fulfillment:

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:

const fulfillments =
await fulfillmentModuleService.listFulfillments(
{
id: ["ful_123", "ful_321"],
},
{
relations: ["shipping_option"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved fulfillments.
The configurations determining how the fulfillment is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a fulfillment.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentDTO[]>Required
The list of fulfillments.

listAndCountFulfillments

This method retrieves a paginated list of fulfillments along with the total count of available fulfillments satisfying the provided filters.

Example

To retrieve a list of fulfillments using their IDs:

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:

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:

const [fulfillments, count] =
await fulfillmentModuleService.listAndCountFulfillments({
id: ["ful_123", "ful_321"],
})

Parameters

The filters to apply on the retrieved fulfillment sets.
The configurations determining how the fulfillment is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a fulfillment.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<[FulfillmentDTO[], number]>Required
The list of fulfillments along with their total count.

createFulfillment

This method creates a 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: {},
})

Parameters

The fulfillment to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentDTO>Required
The created fulfillment.

updateFulfillment

This method updates an existing fulfillment.

Example

const fulfillment =
await fulfillmentModuleService.updateFulfillment(
"ful_123",
{
location_id: "loc_123",
}
)

Parameters

idstringRequired
The ID of the fulfillment.
The attributes to update in the fulfillment.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentDTO>Required
The updated fulfillment.

cancelFulfillment

This method cancels a fulfillment.

Example

const fulfillment =
await fulfillmentModuleService.cancelFulfillment("ful_123")

Parameters

idstringRequired
The ID of the fulfillment.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentDTO>Required
cancels a fulfillment.

retrieveFulfillmentOptions

This method retrieves the fulfillment options of a fulfillment provider.

Example

const fulfillment =
await fulfillmentModuleService.retrieveFulfillmentOptions(
"ful_123"
)

Parameters

providerIdstringRequired
The fulfillment provider's ID.

Returns

PromisePromise<Record<string, unknown>[]>Required
The fulfillment provider's options.

validateFulfillmentOption

This method validates a fulfillment option with the provider it belongs to.

Example

const isValid =
await fulfillmentModuleService.validateFulfillmentOption(
"webshipper",
{
code: "express",
}
)

Parameters

providerIdstringRequired
The fulfillment provider's ID.
dataRecord<string, unknown>Required
The fulfillment option to validate.

Returns

PromisePromise<boolean>Required
Whether the fulfillment option is valid with the specified provider.

validateShippingOption

This method checks whether a shipping option can be used for a specified context.

Example

const isValid =
await fulfillmentModuleService.validateShippingOption(
"so_123",
{
customer_group: "cg_vipgroup",
}
)

Parameters

shippingOptionIdstringRequired
The shipping option's ID.
contextRecord<string, unknown>Required
The context to check.

Returns

PromisePromise<boolean>Required
Whether the shipping option is valid for the specified context.

listFulfillmentProviders

This method retrieves a paginated list of fulfillment providers based on optional filters and configuration.

Example

To retrieve a list of fulfillment providers using their IDs:

const providers = await fulfillmentModuleService.listFulfillmentProviders({
id: ["sepro_123", "sepro_321"],
})

Parameters

The filters to apply on the retrieved fulfillment providers.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<FulfillmentProviderDTO[]>Required
The list of fulfillment providers.
Was this section helpful?