Skip to main content
Skip to main content

StoreService

Provides layer to manipulate store settings.

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
currencyRepository_Repository<Currency>Required
eventBus_EventBusServiceRequired
manager_EntityManagerRequired
storeRepository_Repository<Store>Required
transactionManager_undefined | EntityManagerRequired

Accessors

activeManager_

Inherited from

TransactionBaseService.activeManager_

Methods

addCurrency

Add a currency to the store

Parameters
codestringRequired
3 character ISO currency code
Returns
PromisePromise<Store>Required
result after update

atomicPhase_

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.

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
PromisePromise<TResult>Required
the result of the transactional work

create

Creates a store if it doesn't already exist.

Returns
PromisePromise<Store>Required
The store.

getDefaultCurrency_

Parameters
codestringRequired
Returns
PartialPartial<Currency>Required

removeCurrency

Removes a currency from the store

Parameters
codestringRequired
3 character ISO currency code
Returns
PromisePromise<any>Required
result after update

retrieve

Retrieve the store settings. There is always a maximum of one store.

Parameters
The config object from which the query will be built
Returns
PromisePromise<Store>Required
the store

shouldRetryTransaction_

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

update

Updates a store

Parameters
dataUpdateStoreInputRequired
an object with the update values.
Returns
PromisePromise<Store>Required
resolves to the update result.

withTransaction

Parameters
transactionManagerEntityManager
Returns
StoreServiceStoreServiceRequired
Was this section helpful?