PriceListService
internal.internal.PriceListService
Provides layer to manipulate product tags.
Properties
__configModule__Record<string, unknown>__container__anyRequired__moduleDeclaration__Record<string, unknown>manager_EntityManagerRequiredmoneyAmountRepo_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 }RequiredpriceListRepo_Repository<PriceList> & { listAndCount: Method listAndCount ; listPriceListsVariantIdsMap: Method listPriceListsVariantIdsMap }RequiredtransactionManager_undefined | EntityManagerRequiredAccessors
activeManager_
Protected get activeManager_(): EntityManager
Returns
EntityManager
EntityManagerEntityManagerRequiredInherited from
TransactionBaseService.activeManager_
Methods
addCurrencyFromRegion
Protected addCurrencyFromRegion<T>(prices): Promise<T[]>
Add currency_code to an MA record if region_idis passed.
Parameters
pricesT[]RequiredReturns
Promise<T[]>
PromisePromise<T[]>Requiredupdated prices list
PromisePromise<T[]>Requiredprices listaddPrices
addPrices(id, prices, replace?): Promise<PriceList>
Adds prices to a price list in bulk, optionally replacing all existing prices
Parameters
idstringRequiredreplacebooleanReturns
Promise<PriceList>
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.
TResultobjectRequiredTErrorobjectRequiredParameters
work(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>Returns
Promise<TResult>
PromisePromise<TResult>RequiredInherited from
TransactionBaseService.atomicPhase_
clearPrices
clearPrices(id): Promise<void>
Removes all prices from a price list and deletes the removed prices in bulk
Parameters
idstringRequiredReturns
Promise<void>
PromisePromise<void>Requiredcreate
create(priceListObject): Promise<PriceList>
Creates a Price List
Parameters
Returns
Promise<PriceList>
created Price List
delete
delete(id): Promise<void>
Deletes a Price List Will never fail due to delete being idempotent.
Parameters
idstringRequiredReturns
Promise<void>
PromisePromise<void>RequireddeletePrices
deletePrices(id, priceIds): Promise<void>
Removes prices from a price list and deletes the removed prices in bulk
Parameters
idstringRequiredpriceIdsstring[]RequiredReturns
Promise<void>
PromisePromise<void>RequireddeleteProductPrices
deleteProductPrices(priceListId, productIds): Promise<[string[], number]>
Parameters
priceListIdstringRequiredproductIdsstring[]RequiredReturns
Promise<[string[], number]>
PromisePromise<[string[], number]>Required
PromisePromise<[string[], number]>RequireddeleteVariantPrices
deleteVariantPrices(priceListId, variantIds): Promise<[string[], number]>
Parameters
priceListIdstringRequiredvariantIdsstring[]RequiredReturns
Promise<[string[], number]>
PromisePromise<[string[], number]>Required
PromisePromise<[string[], number]>Requiredlist
list(selector?, config?): Promise<PriceList[]>
Lists Price Lists
Parameters
selectorFilterablePriceListPropsconfigFindConfig<PriceList>Returns
Promise<PriceList[]>
the result of the find operation
listAndCount
listAndCount(selector?, config?): Promise<[PriceList[], number]>
Lists Price Lists and adds count
Parameters
selectorFilterablePriceListPropsconfigFindConfig<PriceList>Returns
Promise<[PriceList[], number]>
the result of the find operation
listPriceListsVariantIdsMap
listPriceListsVariantIdsMap(priceListIds): Promise<{ [priceListId: string]: string[]; }>
Parameters
priceListIdsstring | string[]RequiredReturns
Promise<{ [priceListId: string]: string[]; }>
PromisePromise<{ [priceListId: string]: string[]; }>Required
PromisePromise<{ [priceListId: string]: string[]; }>RequiredlistProducts
listProducts(priceListId, selector?, config?, requiresPriceList?): Promise<[Product[], number]>
Parameters
priceListIdstringRequiredselectorFilterableProductProps | Selector<Product>configFindConfig<Product>requiresPriceListbooleanReturns
Promise<[Product[], number]>
listVariants
listVariants(priceListId, selector?, config?, requiresPriceList?): Promise<[ProductVariant[], number]>
Parameters
priceListIdstringRequiredselectorFilterableProductVariantPropsconfigFindConfig<ProductVariant>requiresPriceListbooleanReturns
Promise<[ProductVariant[], number]>
retrieve
retrieve(priceListId, config?): Promise<PriceList>
Retrieves a product tag by id.
Parameters
priceListIdstringRequiredconfigFindConfig<PriceList>Returns
Promise<PriceList>
the collection.
shouldRetryTransaction_
Protected shouldRetryTransaction_(err): boolean
Parameters
errRecord<string, unknown> | { code: string }RequiredReturns
boolean
booleanbooleanInherited from
TransactionBaseService.shouldRetryTransaction_
update
update(id, update): Promise<PriceList>
Updates a Price List
Parameters
idstringRequiredReturns
Promise<PriceList>
updated Price List
upsertCustomerGroups_
Protected upsertCustomerGroups_(priceListId, customerGroups): Promise<void>
Parameters
priceListIdstringRequiredcustomerGroups{ id: string }[]RequiredReturns
Promise<void>
PromisePromise<void>RequiredwithTransaction
withTransaction(transactionManager?): PriceListService
Parameters
transactionManagerEntityManager