PriceListService
Provides layer to manipulate product tags.
Constructors
constructor
new PriceListService(«destructured»
)
Parameters
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
EntityManagerRequiredMethods
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[]>Requiredprices
listaddPrices
addPrices(id
, prices
, replace?
): Promise
<PriceList
>
Adds prices to a price list in bulk, optionally replacing all existing prices
Parameters
id
stringRequiredreplace
booleanRequiredDefault: false
Returns
Promise
<PriceList
>
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>RequiredclearPrices
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
>
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]>RequireddeleteVariantPrices
deleteVariantPrices(priceListId
, variantIds
): Promise
<[string
[], number
]>
Parameters
priceListId
stringRequiredvariantIds
string[]RequiredReturns
Promise
<[string
[], number
]>
Promise
Promise<[string[], number]>Requiredlist
list(selector?
, config?
): Promise
<PriceList
[]>
Lists Price Lists
Parameters
Default: {}
Returns
Promise
<PriceList
[]>
listAndCount
listAndCount(selector?
, config?
): Promise
<[PriceList
[], number
]>
Lists Price Lists and adds count
Parameters
Default: {}
Returns
Promise
<[PriceList
[], number
]>
listPriceListsVariantIdsMap
listPriceListsVariantIdsMap(priceListIds
): Promise
<{ [priceListId: string]
: string
[]; }>
Parameters
priceListIds
string | string[]RequiredReturns
Promise
<{ [priceListId: string]
: string
[]; }>
Promise
Promise<{ [priceListId: string]: string[]; }>RequiredlistProducts
listProducts(priceListId
, selector?
, config?
, requiresPriceList?
): Promise
<[Product
[], number
]>
Parameters
priceListId
stringRequiredDefault: {}
requiresPriceList
booleanRequiredDefault: false
Returns
Promise
<[Product
[], number
]>
listVariants
listVariants(priceListId
, selector?
, config?
, requiresPriceList?
): Promise
<[ProductVariant
[], number
]>
Parameters
priceListId
stringRequiredDefault: {}
requiresPriceList
booleanRequiredDefault: false
Returns
Promise
<[ProductVariant
[], number
]>
retrieve
retrieve(priceListId
, config?
): Promise
<PriceList
>
Retrieves a product tag by id.
Parameters
priceListId
stringRequiredDefault: {}
Returns
Promise
<PriceList
>
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanupdate
update(id
, update
): Promise
<PriceList
>
Updates a Price List
Parameters
id
stringRequiredReturns
Promise
<PriceList
>
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