Skip to main content

IMarketplaceModuleService Reference

This section of the documentation provides a reference to the IMarketplaceModuleService interface’s methods. This is the interface developers use to use the functionalities provided by the Marketplace Module.
You should only use the methods in this reference when implementing complex customizations. For common cases, check out available workflows instead.
The main service interface for the Marketplace Module.

Methods


createOrderSets

This section provides a reference to the createOrderSets method. This belongs to the Marketplace Module.

createOrderSets(data, sharedContext?): Promise<OrderSetDTO[]>

This method creates order sets.

Example

const orderSets = await marketplaceModuleService.createOrderSets([
  {
    cart_id: "cart_123",
    customer_id: "cus_123",
    sales_channel_id: "sc_123",
    payment_collection_id: "paycol_123",
  },
])

Parameters

data
CreateOrderSetDTO[]
required
The order sets to be created.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<OrderSetDTO[]>
The created order sets.

createOrderSets(data, sharedContext?): Promise<OrderSetDTO>

This method creates an order set.

Example

const orderSet = await marketplaceModuleService.createOrderSets({
  cart_id: "cart_123",
  customer_id: "cus_123",
  sales_channel_id: "sc_123",
  payment_collection_id: "paycol_123",
})

Parameters

data
CreateOrderSetDTO
required
The order set to be created.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<OrderSetDTO>
The created order set.

updateOrderSets

This section provides a reference to the updateOrderSets method. This belongs to the Marketplace Module.

updateOrderSets(id, data, sharedContext?): Promise<OrderSetDTO>

This method updates an existing order set.

Example

const orderSet = await marketplaceModuleService.updateOrderSets("ordset_123", {
  payment_collection_id: "paycol_456",
})

Parameters

id
string
required
The ID of the order set.
data
UpdateOrderSetDTO
required
The attributes to update in the order set.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<OrderSetDTO>
The updated order set.

deleteOrderSets

This section provides a reference to the deleteOrderSets method. This belongs to the Marketplace Module.

deleteOrderSets(ids, sharedContext?): Promise<void>

This method deletes order sets by their IDs.

Example

await marketplaceModuleService.deleteOrderSets(["ordset_123", "ordset_321"])

Parameters

ids
string[]
required
The IDs of the order sets.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the order sets are deleted successfully.

deleteOrderSets(id, sharedContext?): Promise<void>

This method deletes an order set by its ID.

Example

await marketplaceModuleService.deleteOrderSets("ordset_123")

Parameters

id
string
required
The ID of the order set.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the order set is deleted successfully.

retrieveOrderSet

This section provides a reference to the retrieveOrderSet method. This belongs to the Marketplace Module. This method retrieves an order set by its ID.

Example

const orderSet = await marketplaceModuleService.retrieveOrderSet("ordset_123")
To retrieve relationships:
const orderSet = await marketplaceModuleService.retrieveOrderSet(
  "ordset_123",
  {
    relations: ["customer", "cart", "sales_channel"],
  }
)

Parameters

id
string
required
The ID of the order set.
config
FindConfig<OrderSetDTO>
The configurations determining how the order set is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with an order set.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<OrderSetDTO>
The retrieved order set.

listOrderSets

This section provides a reference to the listOrderSets method. This belongs to the Marketplace Module. This method retrieves a paginated list of order sets based on optional filters and configuration.

Example

To retrieve a list of order sets using their IDs:
const orderSets = await marketplaceModuleService.listOrderSets({
  id: ["ordset_123", "ordset_321"],
})
To retrieve order sets for a specific customer:
const orderSets = await marketplaceModuleService.listOrderSets({
  customer_id: "cus_123",
})
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 orderSets = await marketplaceModuleService.listOrderSets(
  {
    customer_id: "cus_123",
  },
  {
    take: 20,
    skip: 2,
  }
)

Parameters

filters
FilterableOrderSetProps
The filters to apply on the retrieved order sets.
config
FindConfig<OrderSetDTO>
The configurations determining how the order set is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with an order set.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<OrderSetDTO[]>
The list of order sets.

listAndCountOrderSets

This section provides a reference to the listAndCountOrderSets method. This belongs to the Marketplace Module. This method retrieves a paginated list of order sets along with the total count of available order sets satisfying the provided filters.

Example

To retrieve a list of order sets using their IDs:
const [orderSets, count] = await marketplaceModuleService.listAndCountOrderSets({
  id: ["ordset_123", "ordset_321"],
})
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 [orderSets, count] = await marketplaceModuleService.listAndCountOrderSets(
  {
    customer_id: "cus_123",
  },
  {
    take: 20,
    skip: 2,
  }
)

Parameters

filters
FilterableOrderSetProps
The filters to apply on the retrieved order sets.
config
FindConfig<OrderSetDTO>
The configurations determining how the order set is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<[OrderSetDTO[], number]>
The list of order sets along with their total count.

softDeleteOrderSets

This section provides a reference to the softDeleteOrderSets method. This belongs to the Marketplace Module. This method soft deletes order sets by their IDs.

Example

await marketplaceModuleService.softDeleteOrderSets([
  "ordset_123",
  "ordset_321",
])

Parameters

orderSetIds
string[]
required
The IDs of the order sets.
config
SoftDeleteReturn<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.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

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

restoreOrderSets

This section provides a reference to the restoreOrderSets method. This belongs to the Marketplace Module. This method restores soft deleted order sets by their IDs.

Example

await marketplaceModuleService.restoreOrderSets(["ordset_123", "ordset_321"])

Parameters

orderSetIds
string[]
required
The IDs of the order sets.
config
RestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the order set.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

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