Skip to main content
Skip to main content

SalesChannelLocationService

internal.internal.SalesChannelLocationService

Service for managing the stock locations of sales channels

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
eventBusService_IEventBusServiceRequired
manager_EntityManagerRequired
salesChannelService_SalesChannelServiceRequired
stockLocationService_IStockLocationServiceRequired
transactionManager_undefined | EntityManagerRequired

Accessors

activeManager_

Protected get activeManager_(): EntityManager

Returns

EntityManager

EntityManagerEntityManagerRequired

Inherited from

TransactionBaseService.activeManager_

Methods

associateLocation

associateLocation(salesChannelId, locationId): Promise<void>

Associates a sales channel with a stock location.

Parameters

salesChannelIdstringRequired
The ID of the sales channel.
locationIdstringRequired
The ID of the stock location.

Returns

Promise<void>

PromisePromise<void>Required
A promise that resolves when the association has been created.

atomicPhase_

Protected atomicPhase_<TResult, TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise<TResult>

Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.

TResultobjectRequired
TErrorobjectRequired

Parameters

work(transactionManager: EntityManager) => Promise<TResult>Required
the transactional work to be done
isolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>
the isolation level to be used for the work.
maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>
Potential error handler

Returns

Promise<TResult>

PromisePromise<TResult>Required
the result of the transactional work

Inherited from

TransactionBaseService.atomicPhase_


listLocationIds

listLocationIds(salesChannelId): Promise<string[]>

Lists the stock locations associated with a sales channel.

Parameters

salesChannelIdstring | string[]Required
The ID of the sales channel.

Returns

Promise<string[]>

PromisePromise<string[]>Required
A promise that resolves with an array of location IDs.

listSalesChannelIds

listSalesChannelIds(locationId): Promise<string[]>

Lists the sales channels associated with a stock location.

Parameters

locationIdstringRequired

Returns

Promise<string[]>

PromisePromise<string[]>Required
A promise that resolves with an array of sales channel IDs.

removeLocation

removeLocation(locationId, salesChannelId?): Promise<void>

Removes an association between a sales channel and a stock location.

Parameters

locationIdstringRequired
The ID of the stock location.
salesChannelIdstring
The ID of the sales channel or undefined if all the sales channel will be affected.

Returns

Promise<void>

PromisePromise<void>Required
A promise that resolves when the association has been removed.

shouldRetryTransaction_

Protected shouldRetryTransaction_(err): boolean

Parameters

errRecord<string, unknown> | { code: string }Required

Returns

boolean

booleanboolean

Inherited from

TransactionBaseService.shouldRetryTransaction_


withTransaction

withTransaction(transactionManager?): SalesChannelLocationService

Parameters

transactionManagerEntityManager

Returns

SalesChannelLocationService

SalesChannelLocationServiceSalesChannelLocationServiceRequired

Inherited from

TransactionBaseService.withTransaction

Was this section helpful?