PricingService
Allows retrieval of prices.
Constructors
constructor
**new PricingService**(«destructured»)
Parameters
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Protected get**activeManager_**(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredpricingModuleService
Protected get**pricingModuleService**(): [IPricingModuleService](/references/services/interfaces/IPricingModuleService)
Returns
addPriceListPrices
(data: AddPriceListPricesDTO[], sharedContext?: Context) => Promise<PriceListDTO[]>RequiredaddPrices
(data: AddPricesDTO, sharedContext?: Context) => Promise<PriceSetDTO>(data: AddPricesDTO[], sharedContext?: Context) => Promise<PriceSetDTO[]>RequiredaddRules
(data: AddRulesDTO, sharedContext?: Context) => Promise<PriceSetDTO>(data: AddRulesDTO[], sharedContext?: Context) => Promise<PriceSetDTO[]>RequiredcalculatePrices
(filters: PricingFilters, context?: PricingContext, sharedContext?: Context) => Promise<CalculatedPriceSetDTO>Requiredcreate
(data: CreatePriceSetDTO, sharedContext?: Context) => Promise<PriceSetDTO>(data: CreatePriceSetDTO[], sharedContext?: Context) => Promise<PriceSetDTO[]>RequiredcreateCurrencies
(data: CreateCurrencyDTO[], sharedContext?: Context) => Promise<CurrencyDTO[]>RequiredcreateMoneyAmounts
(data: CreateMoneyAmountDTO[], sharedContext?: Context) => Promise<MoneyAmountDTO[]>RequiredcreatePriceListRules
(data: CreatePriceListRuleDTO[], sharedContext?: Context) => Promise<PriceListRuleDTO[]>RequiredcreatePriceLists
(data: CreatePriceListDTO[], sharedContext?: Context) => Promise<PriceListDTO[]>RequiredcreatePriceRules
(data: CreatePriceRuleDTO[], sharedContext?: Context) => Promise<PriceRuleDTO[]>RequiredcreatePriceSetMoneyAmountRules
(data: CreatePriceSetMoneyAmountRulesDTO[], sharedContext?: Context) => Promise<PriceSetMoneyAmountRulesDTO[]>RequiredcreateRuleTypes
(data: CreateRuleTypeDTO[], sharedContext?: Context) => Promise<RuleTypeDTO[]>Requiredlist
(filters?: FilterablePriceSetProps, config?: FindConfig<PriceSetDTO>, sharedContext?: Context) => Promise<PriceSetDTO[]>RequiredlistAndCount
(filters?: FilterablePriceSetProps, config?: FindConfig<PriceSetDTO>, sharedContext?: Context) => Promise<[PriceSetDTO[], number]>RequiredlistAndCountCurrencies
(filters?: FilterableCurrencyProps, config?: FindConfig<CurrencyDTO>, sharedContext?: Context) => Promise<[CurrencyDTO[], number]>RequiredlistAndCountMoneyAmounts
(filters?: FilterableMoneyAmountProps, config?: FindConfig<MoneyAmountDTO>, sharedContext?: Context) => Promise<[MoneyAmountDTO[], number]>RequiredlistAndCountPriceListRules
(filters?: FilterablePriceListRuleProps, config?: FindConfig<PriceListRuleDTO>, sharedContext?: Context) => Promise<[PriceListRuleDTO[], number]>RequiredlistAndCountPriceLists
(filters?: FilterablePriceListProps, config?: FindConfig<PriceListDTO>, sharedContext?: Context) => Promise<[PriceListDTO[], number]>RequiredlistAndCountPriceRules
(filters?: FilterablePriceRuleProps, config?: FindConfig<PriceRuleDTO>, sharedContext?: Context) => Promise<[PriceRuleDTO[], number]>RequiredlistAndCountPriceSetMoneyAmountRules
(filters?: FilterablePriceSetMoneyAmountRulesProps, config?: FindConfig<PriceSetMoneyAmountRulesDTO>, sharedContext?: Context) => Promise<[PriceSetMoneyAmountRulesDTO[], number]>RequiredlistAndCountPriceSetMoneyAmounts
(filters?: FilterablePriceSetMoneyAmountProps, config?: FindConfig<PriceSetMoneyAmountDTO>, sharedContext?: Context) => Promise<[PriceSetMoneyAmountDTO[], number]>RequiredlistAndCountRuleTypes
(filters?: FilterableRuleTypeProps, config?: FindConfig<RuleTypeDTO>, sharedContext?: Context) => Promise<[RuleTypeDTO[], number]>RequiredlistCurrencies
(filters?: FilterableCurrencyProps, config?: FindConfig<CurrencyDTO>, sharedContext?: Context) => Promise<CurrencyDTO[]>RequiredlistMoneyAmounts
(filters?: FilterableMoneyAmountProps, config?: FindConfig<MoneyAmountDTO>, sharedContext?: Context) => Promise<MoneyAmountDTO[]>RequiredlistPriceListRules
(filters?: FilterablePriceListRuleProps, config?: FindConfig<PriceListRuleDTO>, sharedContext?: Context) => Promise<PriceListRuleDTO[]>RequiredlistPriceLists
(filters?: FilterablePriceListProps, config?: FindConfig<PriceListDTO>, sharedContext?: Context) => Promise<PriceListDTO[]>RequiredlistPriceRules
(filters?: FilterablePriceRuleProps, config?: FindConfig<PriceRuleDTO>, sharedContext?: Context) => Promise<PriceRuleDTO[]>RequiredlistPriceSetMoneyAmountRules
(filters?: FilterablePriceSetMoneyAmountRulesProps, config?: FindConfig<PriceSetMoneyAmountRulesDTO>, sharedContext?: Context) => Promise<PriceSetMoneyAmountRulesDTO[]>RequiredlistPriceSetMoneyAmounts
(filters?: FilterablePriceSetMoneyAmountProps, config?: FindConfig<PriceSetMoneyAmountDTO>, sharedContext?: Context) => Promise<PriceSetMoneyAmountDTO[]>RequiredlistRuleTypes
(filters?: FilterableRuleTypeProps, config?: FindConfig<RuleTypeDTO>, sharedContext?: Context) => Promise<RuleTypeDTO[]>RequiredremovePriceListRules
(data: RemovePriceListRulesDTO, sharedContext?: Context) => Promise<PriceListDTO>Requiredretrieve
(id: string, config?: FindConfig<PriceSetDTO>, sharedContext?: Context) => Promise<PriceSetDTO>RequiredretrieveCurrency
(code: string, config?: FindConfig<CurrencyDTO>, sharedContext?: Context) => Promise<CurrencyDTO>RequiredretrieveMoneyAmount
(id: string, config?: FindConfig<MoneyAmountDTO>, sharedContext?: Context) => Promise<MoneyAmountDTO>RequiredretrievePriceList
(id: string, config?: FindConfig<PriceListDTO>, sharedContext?: Context) => Promise<PriceListDTO>RequiredretrievePriceListRule
(id: string, config?: FindConfig<PriceListRuleDTO>, sharedContext?: Context) => Promise<PriceListRuleDTO>RequiredretrievePriceRule
(id: string, config?: FindConfig<PriceRuleDTO>, sharedContext?: Context) => Promise<PriceRuleDTO>RequiredretrievePriceSetMoneyAmountRules
(id: string, config?: FindConfig<PriceSetMoneyAmountRulesDTO>, sharedContext?: Context) => Promise<PriceSetMoneyAmountRulesDTO>RequiredretrieveRuleType
(id: string, config?: FindConfig<RuleTypeDTO>, sharedContext?: Context) => Promise<RuleTypeDTO>RequiredsetPriceListRules
(data: SetPriceListRulesDTO, sharedContext?: Context) => Promise<PriceListDTO>RequiredupdateCurrencies
(data: UpdateCurrencyDTO[], sharedContext?: Context) => Promise<CurrencyDTO[]>RequiredupdateMoneyAmounts
(data: UpdateMoneyAmountDTO[], sharedContext?: Context) => Promise<MoneyAmountDTO[]>RequiredupdatePriceListRules
(data: UpdatePriceListRuleDTO[], sharedContext?: Context) => Promise<PriceListRuleDTO[]>RequiredupdatePriceLists
(data: UpdatePriceListDTO[], sharedContext?: Context) => Promise<PriceListDTO[]>RequiredupdatePriceRules
(data: UpdatePriceRuleDTO[], sharedContext?: Context) => Promise<PriceRuleDTO[]>RequiredupdatePriceSetMoneyAmountRules
(data: UpdatePriceSetMoneyAmountRulesDTO[], sharedContext?: Context) => Promise<PriceSetMoneyAmountRulesDTO[]>RequiredupdateRuleTypes
(data: UpdateRuleTypeDTO[], sharedContext?: Context) => Promise<RuleTypeDTO[]>RequiredremoteQuery
Protected get**remoteQuery**(): [RemoteQueryFunction](/references/services/types/RemoteQueryFunction)
Returns
RemoteQueryFunction
(query: string | RemoteJoinerQuery | object, variables?: Record<string, unknown>) => Promise<any> | nullRequiredMethods
atomicPhase_
Protected **atomicPhase_**<TypeParameter TResult, TypeParameter 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>RequiredcalculateTaxes
**calculateTaxes**(variantPricing, productRates): [TaxedPricing](/references/services/types/TaxedPricing)
Gets the prices for a product variant
Parameters
Returns
TaxedPricing
objectRequiredcollectPricingContext
**collectPricingContext**(context): Promise<[PricingContext](/references/services/types/PricingContext-1)>
Collects additional information necessary for completing the price selection.
Parameters
Returns
Promise<PricingContext>
getPricingModuleVariantMoneyAmounts
Private **getPricingModuleVariantMoneyAmounts**(variantIds): Promise<Map<string, [MoneyAmount](/references/services/classes/MoneyAmount)[]>>
Parameters
variantIds
string[]RequiredReturns
Promise<Map<string, MoneyAmount[]>>
getProductPricing
**getProductPricing**(product, context): Promise<Record<string, [ProductVariantPricing](/references/services/types/ProductVariantPricing)>>
Gets all the variant prices for a product. All the product's variants will be fetched.
Parameters
Returns
Promise<Record<string, ProductVariantPricing>>
getProductPricingById
**getProductPricingById**(productId, context): Promise<Record<string, [ProductVariantPricing](/references/services/types/ProductVariantPricing)>>
Gets all the variant prices for a product by the product id
Parameters
productId
stringRequiredReturns
Promise<Record<string, ProductVariantPricing>>
getProductPricing_
Private **getProductPricing_**(data, context): Promise<Map<string, Record<string, [ProductVariantPricing](/references/services/types/ProductVariantPricing)>>>
Parameters
data
{ productId: string ; variants: [ProductVariant](/references/services/classes/ProductVariant)[] }[]RequiredReturns
Promise<Map<string, Record<string, ProductVariantPricing>>>
getProductVariantPricing
**getProductVariantPricing**(variant, context): Promise<[ProductVariantPricing](/references/services/types/ProductVariantPricing)>
Gets the prices for a product variant.
Parameters
Returns
Promise<ProductVariantPricing>
getProductVariantPricingById
**getProductVariantPricingById**(variantId, context): Promise<[ProductVariantPricing](/references/services/types/ProductVariantPricing)>
Gets the prices for a product variant by a variant id.
Parameters
variantId
stringRequiredReturns
Promise<ProductVariantPricing>
Deprecated
Use getProductVariantsPricing instead.
getProductVariantPricingModulePricing_
Private **getProductVariantPricingModulePricing_**(variantPriceData, context): Promise<Map<any, any>>
Parameters
variantPriceData
{ quantity?: number ; variantId: string }[]RequiredReturns
Promise<Map<any, any>>
Promise
Promise<Map<any, any>>RequiredgetProductVariantPricing_
Private **getProductVariantPricing_**(data, context): Promise<Map<string, [ProductVariantPricing](/references/services/types/ProductVariantPricing)>>
Parameters
data
{ quantity?: number ; variantId: string }[]RequiredReturns
Promise<Map<string, ProductVariantPricing>>
getProductVariantsPricing
**getProductVariantsPricing**(data, context): Promise<{ [variant_id: string]: [ProductVariantPricing](/references/services/types/ProductVariantPricing); }>
Gets the prices for a collection of variants.
Parameters
data
{ quantity?: number ; variantId: string }[]RequiredReturns
Promise<{ [variant_id: string]: ProductVariantPricing; }>
getShippingOptionPricing
**getShippingOptionPricing**(shippingOption, context): Promise<[PricedShippingOption](/references/services/types/PricedShippingOption)>
Gets the prices for a shipping option.
Parameters
Returns
Promise<PricedShippingOption>
setAdminProductPricing
**setAdminProductPricing**(products): Promise<([Product](/references/services/classes/Product) \| [PricedProduct](/references/services/types/PricedProduct))[]>
Parameters
Returns
Promise<(Product | PricedProduct)[]>
setAdminVariantPricing
**setAdminVariantPricing**(variants, context?): Promise<[PricedVariant](/references/services/types/PricedVariant)[]>
Parameters
Default: {}
Returns
Promise<PricedVariant[]>
setProductPrices
**setProductPrices**(products, context?): Promise<([Product](/references/services/classes/Product) \| [PricedProduct](/references/services/types/PricedProduct))[]>
Set additional prices on a list of products.
Parameters
Default: {}
Returns
Promise<(Product | PricedProduct)[]>
setShippingOptionPrices
**setShippingOptionPrices**(shippingOptions, context?): Promise<[PricedShippingOption](/references/services/types/PricedShippingOption)[]>
Set additional prices on a list of shipping options.
Parameters
Default: {}
Returns
Promise<PricedShippingOption[]>
setVariantPrices
**setVariantPrices**(variants, context?): Promise<[PricedVariant](/references/services/types/PricedVariant)[]>
Set additional prices on a list of product variants.
Parameters
Default: {}
Returns
Promise<PricedVariant[]>
shouldRetryTransaction_
Protected **shouldRetryTransaction_**(err): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanwithTransaction
**withTransaction**(transactionManager?): [PricingService](/references/services/classes/PricingService)
Parameters
transactionManager
EntityManager