Skip to main content
Skip to main content

PriceListService

internal.internal.PriceListService

Provides layer to manipulate product tags.

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
customerGroupService_CustomerGroupServiceRequired
featureFlagRouter_FlagRouterRequired
manager_EntityManagerRequired
moneyAmountRepo_Repository<MoneyAmount> & { addPriceListPrices: Method addPriceListPrices ; createProductVariantMoneyAmounts: Method createProductVariantMoneyAmounts ; deletePriceListPrices: Method deletePriceListPrices ; deleteVariantPricesNotIn: Method deleteVariantPricesNotIn ; findCurrencyMoneyAmounts: Method findCurrencyMoneyAmounts ; findManyForVariantInPriceList: Method findManyForVariantInPriceList ; findManyForVariantInRegion: Method findManyForVariantInRegion ; findManyForVariantsInRegion: Method findManyForVariantsInRegion ; findRegionMoneyAmounts: Method findRegionMoneyAmounts ; findVariantPricesNotIn: Method findVariantPricesNotIn ; getPricesForVariantInRegion: Method getPricesForVariantInRegion ; insertBulk: Method insertBulk ; updatePriceListPrices: Method updatePriceListPrices ; upsertVariantCurrencyPrice: Method upsertVariantCurrencyPrice }Required
priceListRepo_Repository<PriceList> & { listAndCount: Method listAndCount ; listPriceListsVariantIdsMap: Method listPriceListsVariantIdsMap }Required
productService_ProductServiceRequired
productVariantRepo_Repository<ProductVariant>Required
regionService_RegionServiceRequired
transactionManager_undefined | EntityManagerRequired
variantService_ProductVariantServiceRequired

Accessors

activeManager_

Protected get activeManager_(): EntityManager

Returns

EntityManager

EntityManagerEntityManagerRequired

Inherited from

TransactionBaseService.activeManager_

Methods

addCurrencyFromRegion

Protected addCurrencyFromRegion<T>(prices): Promise<T[]>

Add currency_code to an MA record if region_idis passed.

Parameters

pricesT[]Required
a list of PriceListPrice(Create/Update)Input records

Returns

Promise<T[]>

PromisePromise<T[]>Required
updated prices list

addPrices

addPrices(id, prices, replace?): Promise<PriceList>

Adds prices to a price list in bulk, optionally replacing all existing prices

Parameters

idstringRequired
id of the price list
prices to add
replaceboolean
whether to replace existing prices

Returns

Promise<PriceList>

PromisePromise<PriceList>Required
updated Price List

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_


clearPrices

clearPrices(id): Promise<void>

Removes all prices from a price list and deletes the removed prices in bulk

Parameters

idstringRequired
id of the price list

Returns

Promise<void>

PromisePromise<void>Required
updated Price List

create

create(priceListObject): Promise<PriceList>

Creates a Price List

Parameters

priceListObjectCreatePriceListInputRequired
the Price List to create

Returns

Promise<PriceList>

PromisePromise<PriceList>Required
created Price List

delete

delete(id): Promise<void>

Deletes a Price List Will never fail due to delete being idempotent.

Parameters

idstringRequired
id of the price list

Returns

Promise<void>

PromisePromise<void>Required
empty promise

deletePrices

deletePrices(id, priceIds): Promise<void>

Removes prices from a price list and deletes the removed prices in bulk

Parameters

idstringRequired
id of the price list
priceIdsstring[]Required
ids of the prices to delete

Returns

Promise<void>

PromisePromise<void>Required
updated Price List

deleteProductPrices

deleteProductPrices(priceListId, productIds): Promise<[string[], number]>

Parameters

priceListIdstringRequired
productIdsstring[]Required

Returns

Promise<[string[], number]>

PromisePromise<[string[], number]>Required

deleteVariantPrices

deleteVariantPrices(priceListId, variantIds): Promise<[string[], number]>

Parameters

priceListIdstringRequired
variantIdsstring[]Required

Returns

Promise<[string[], number]>

PromisePromise<[string[], number]>Required

list

list(selector?, config?): Promise<PriceList[]>

Lists Price Lists

Parameters

the query object for find
the config to be used for find

Returns

Promise<PriceList[]>

PromisePromise<PriceList[]>Required
the result of the find operation

listAndCount

listAndCount(selector?, config?): Promise<[PriceList[], number]>

Lists Price Lists and adds count

Parameters

the query object for find
the config to be used for find

Returns

Promise<[PriceList[], number]>

PromisePromise<[PriceList[], number]>Required
the result of the find operation

listPriceListsVariantIdsMap

listPriceListsVariantIdsMap(priceListIds): Promise<{ [priceListId: string]: string[]; }>

Parameters

priceListIdsstring | string[]Required

Returns

Promise<{ [priceListId: string]: string[]; }>

PromisePromise<{ [priceListId: string]: string[]; }>Required

listProducts

listProducts(priceListId, selector?, config?, requiresPriceList?): Promise<[Product[], number]>

Parameters

priceListIdstringRequired
requiresPriceListboolean

Returns

Promise<[Product[], number]>

PromisePromise<[Product[], number]>Required

listVariants

listVariants(priceListId, selector?, config?, requiresPriceList?): Promise<[ProductVariant[], number]>

Parameters

priceListIdstringRequired
requiresPriceListboolean

Returns

Promise<[ProductVariant[], number]>

PromisePromise<[ProductVariant[], number]>Required

retrieve

retrieve(priceListId, config?): Promise<PriceList>

Retrieves a product tag by id.

Parameters

priceListIdstringRequired
the id of the product tag to retrieve
the config to retrieve the tag by

Returns

Promise<PriceList>

PromisePromise<PriceList>Required
the collection.

shouldRetryTransaction_

Protected shouldRetryTransaction_(err): boolean

Parameters

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

Returns

boolean

booleanboolean

Inherited from

TransactionBaseService.shouldRetryTransaction_


update

update(id, update): Promise<PriceList>

Updates a Price List

Parameters

idstringRequired
the id of the Product List to update
updateUpdatePriceListInputRequired
the update to apply

Returns

Promise<PriceList>

PromisePromise<PriceList>Required
updated Price List

upsertCustomerGroups_

Protected upsertCustomerGroups_(priceListId, customerGroups): Promise<void>

Parameters

priceListIdstringRequired
customerGroups{ id: string }[]Required

Returns

Promise<void>

PromisePromise<void>Required

withTransaction

withTransaction(transactionManager?): PriceListService

Parameters

transactionManagerEntityManager

Returns

PriceListService

PriceListServicePriceListServiceRequired

Inherited from

TransactionBaseService.withTransaction

Was this section helpful?