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
EntityManager
EntityManagerRequiredInherited from
TransactionBaseService.activeManager_
Methods
addCurrencyFromRegion
Protected
addCurrencyFromRegion<T
>(prices
): Promise
<T
[]>
Add currency_code
to an MA record if region_id
is passed.
Parameters
prices
T[]RequiredReturns
Promise
<T
[]>
Promise
Promise<T[]>Requiredupdated prices
list
Promise
Promise<T[]>Requiredprices
listaddPrices
addPrices(id
, prices
, replace?
): Promise
<PriceList
>
Adds prices to a price list in bulk, optionally replacing all existing prices
Parameters
id
stringRequiredreplace
booleanReturns
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.
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
<TResult
>
Promise
Promise<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
id
stringRequiredReturns
Promise
<void
>
Promise
Promise<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
id
stringRequiredReturns
Promise
<void
>
Promise
Promise<void>RequireddeletePrices
deletePrices(id
, priceIds
): Promise
<void
>
Removes prices from a price list and deletes the removed prices in bulk
Parameters
id
stringRequiredpriceIds
string[]RequiredReturns
Promise
<void
>
Promise
Promise<void>RequireddeleteProductPrices
deleteProductPrices(priceListId
, productIds
): Promise
<[string
[], number
]>
Parameters
priceListId
stringRequiredproductIds
string[]RequiredReturns
Promise
<[string
[], number
]>
Promise
Promise<[string[], number]>Required
Promise
Promise<[string[], number]>RequireddeleteVariantPrices
deleteVariantPrices(priceListId
, variantIds
): Promise
<[string
[], number
]>
Parameters
priceListId
stringRequiredvariantIds
string[]RequiredReturns
Promise
<[string
[], number
]>
Promise
Promise<[string[], number]>Required
Promise
Promise<[string[], number]>Requiredlist
list(selector?
, config?
): Promise
<PriceList
[]>
Lists Price Lists
Parameters
selector
FilterablePriceListPropsconfig
FindConfig<PriceList>Returns
Promise
<PriceList
[]>
the result of the find operation
listAndCount
listAndCount(selector?
, config?
): Promise
<[PriceList
[], number
]>
Lists Price Lists and adds count
Parameters
selector
FilterablePriceListPropsconfig
FindConfig<PriceList>Returns
Promise
<[PriceList
[], number
]>
the result of the find operation
listPriceListsVariantIdsMap
listPriceListsVariantIdsMap(priceListIds
): Promise
<{ [priceListId: string]
: string
[]; }>
Parameters
priceListIds
string | string[]RequiredReturns
Promise
<{ [priceListId: string]
: string
[]; }>
Promise
Promise<{ [priceListId: string]: string[]; }>Required
Promise
Promise<{ [priceListId: string]: string[]; }>RequiredlistProducts
listProducts(priceListId
, selector?
, config?
, requiresPriceList?
): Promise
<[Product
[], number
]>
Parameters
priceListId
stringRequiredselector
FilterableProductProps | Selector<Product>config
FindConfig<Product>requiresPriceList
booleanReturns
Promise
<[Product
[], number
]>
listVariants
listVariants(priceListId
, selector?
, config?
, requiresPriceList?
): Promise
<[ProductVariant
[], number
]>
Parameters
priceListId
stringRequiredselector
FilterableProductVariantPropsconfig
FindConfig<ProductVariant>requiresPriceList
booleanReturns
Promise
<[ProductVariant
[], number
]>
retrieve
retrieve(priceListId
, config?
): Promise
<PriceList
>
Retrieves a product tag by id.
Parameters
priceListId
stringRequiredconfig
FindConfig<PriceList>Returns
Promise
<PriceList
>
the collection.
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanInherited from
TransactionBaseService.shouldRetryTransaction_
update
update(id
, update
): Promise
<PriceList
>
Updates a Price List
Parameters
id
stringRequiredReturns
Promise
<PriceList
>
updated Price List
upsertCustomerGroups_
Protected
upsertCustomerGroups_(priceListId
, customerGroups
): Promise
<void
>
Parameters
priceListId
stringRequiredcustomerGroups
{ id: string }[]RequiredReturns
Promise
<void
>
Promise
Promise<void>RequiredwithTransaction
withTransaction(transactionManager?
): PriceListService
Parameters
transactionManager
EntityManager