Skip to main content
Skip to main content

PricingService

Allows retrieval of prices.

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
featureFlagRouterFlagRouterRequired
getPricingModuleVariantMoneyAmountsanyRequired
getProductPricing_anyRequired
getProductVariantPricingModulePricing_anyRequired
getProductVariantPricing_anyRequired
manager_EntityManagerRequired
priceSelectionStrategyIPriceSelectionStrategyRequired
productVariantServiceProductVariantServiceRequired
regionServiceRegionServiceRequired
taxProviderServiceTaxProviderServiceRequired
transactionManager_undefined | EntityManagerRequired

Accessors

activeManager_

Returns

EntityManagerEntityManagerRequired

pricingModuleService

Returns

addPriceListPrices(data: AddPriceListPricesDTO[], sharedContext?: Context) => Promise<PriceListDTO[]>Required
addPrices(data: AddPricesDTO, sharedContext?: Context) => Promise<PriceSetDTO>(data: AddPricesDTO[], sharedContext?: Context) => Promise<PriceSetDTO[]>Required
addRules(data: AddRulesDTO, sharedContext?: Context) => Promise<PriceSetDTO>(data: AddRulesDTO[], sharedContext?: Context) => Promise<PriceSetDTO[]>Required
calculatePrices(filters: PricingFilters, context?: PricingContext, sharedContext?: Context) => Promise<CalculatedPriceSetDTO>Required
create(data: CreatePriceSetDTO, sharedContext?: Context) => Promise<PriceSetDTO>(data: CreatePriceSetDTO[], sharedContext?: Context) => Promise<PriceSetDTO[]>Required
createCurrencies(data: CreateCurrencyDTO[], sharedContext?: Context) => Promise<CurrencyDTO[]>Required
createMoneyAmounts(data: CreateMoneyAmountDTO[], sharedContext?: Context) => Promise<MoneyAmountDTO[]>Required
createPriceListRules(data: CreatePriceListRuleDTO[], sharedContext?: Context) => Promise<PriceListRuleDTO[]>Required
createPriceLists(data: CreatePriceListDTO[], sharedContext?: Context) => Promise<PriceListDTO[]>Required
createPriceRules(data: CreatePriceRuleDTO[], sharedContext?: Context) => Promise<PriceRuleDTO[]>Required
createPriceSetMoneyAmountRules(data: CreatePriceSetMoneyAmountRulesDTO[], sharedContext?: Context) => Promise<PriceSetMoneyAmountRulesDTO[]>Required
createRuleTypes(data: CreateRuleTypeDTO[], sharedContext?: Context) => Promise<RuleTypeDTO[]>Required
delete(ids: string[], sharedContext?: Context) => Promise<void>Required
deleteCurrencies(currencyCodes: string[], sharedContext?: Context) => Promise<void>Required
deleteMoneyAmounts(ids: string[], sharedContext?: Context) => Promise<void>Required
deletePriceListRules(priceListRuleIds: string[], sharedContext?: Context) => Promise<void>Required
deletePriceLists(priceListIds: string[], sharedContext?: Context) => Promise<void>Required
deletePriceRules(priceRuleIds: string[], sharedContext?: Context) => Promise<void>Required
deletePriceSetMoneyAmountRules(ids: string[], sharedContext?: Context) => Promise<void>Required
deleteRuleTypes(ruleTypeIds: string[], sharedContext?: Context) => Promise<void>Required
list(filters?: FilterablePriceSetProps, config?: FindConfig<PriceSetDTO>, sharedContext?: Context) => Promise<PriceSetDTO[]>Required
listAndCount(filters?: FilterablePriceSetProps, config?: FindConfig<PriceSetDTO>, sharedContext?: Context) => Promise<[PriceSetDTO[], number]>Required
listAndCountCurrencies(filters?: FilterableCurrencyProps, config?: FindConfig<CurrencyDTO>, sharedContext?: Context) => Promise<[CurrencyDTO[], number]>Required
listAndCountMoneyAmounts(filters?: FilterableMoneyAmountProps, config?: FindConfig<MoneyAmountDTO>, sharedContext?: Context) => Promise<[MoneyAmountDTO[], number]>Required
listAndCountPriceListRules(filters?: FilterablePriceListRuleProps, config?: FindConfig<PriceListRuleDTO>, sharedContext?: Context) => Promise<[PriceListRuleDTO[], number]>Required
listAndCountPriceLists(filters?: FilterablePriceListProps, config?: FindConfig<PriceListDTO>, sharedContext?: Context) => Promise<[PriceListDTO[], number]>Required
listAndCountPriceRules(filters?: FilterablePriceRuleProps, config?: FindConfig<PriceRuleDTO>, sharedContext?: Context) => Promise<[PriceRuleDTO[], number]>Required
listAndCountPriceSetMoneyAmountRules(filters?: FilterablePriceSetMoneyAmountRulesProps, config?: FindConfig<PriceSetMoneyAmountRulesDTO>, sharedContext?: Context) => Promise<[PriceSetMoneyAmountRulesDTO[], number]>Required
listAndCountPriceSetMoneyAmounts(filters?: FilterablePriceSetMoneyAmountProps, config?: FindConfig<PriceSetMoneyAmountDTO>, sharedContext?: Context) => Promise<[PriceSetMoneyAmountDTO[], number]>Required
listAndCountRuleTypes(filters?: FilterableRuleTypeProps, config?: FindConfig<RuleTypeDTO>, sharedContext?: Context) => Promise<[RuleTypeDTO[], number]>Required
listCurrencies(filters?: FilterableCurrencyProps, config?: FindConfig<CurrencyDTO>, sharedContext?: Context) => Promise<CurrencyDTO[]>Required
listMoneyAmounts(filters?: FilterableMoneyAmountProps, config?: FindConfig<MoneyAmountDTO>, sharedContext?: Context) => Promise<MoneyAmountDTO[]>Required
listPriceListRules(filters?: FilterablePriceListRuleProps, config?: FindConfig<PriceListRuleDTO>, sharedContext?: Context) => Promise<PriceListRuleDTO[]>Required
listPriceLists(filters?: FilterablePriceListProps, config?: FindConfig<PriceListDTO>, sharedContext?: Context) => Promise<PriceListDTO[]>Required
listPriceRules(filters?: FilterablePriceRuleProps, config?: FindConfig<PriceRuleDTO>, sharedContext?: Context) => Promise<PriceRuleDTO[]>Required
listPriceSetMoneyAmountRules(filters?: FilterablePriceSetMoneyAmountRulesProps, config?: FindConfig<PriceSetMoneyAmountRulesDTO>, sharedContext?: Context) => Promise<PriceSetMoneyAmountRulesDTO[]>Required
listPriceSetMoneyAmounts(filters?: FilterablePriceSetMoneyAmountProps, config?: FindConfig<PriceSetMoneyAmountDTO>, sharedContext?: Context) => Promise<PriceSetMoneyAmountDTO[]>Required
listRuleTypes(filters?: FilterableRuleTypeProps, config?: FindConfig<RuleTypeDTO>, sharedContext?: Context) => Promise<RuleTypeDTO[]>Required
removePriceListRules(data: RemovePriceListRulesDTO, sharedContext?: Context) => Promise<PriceListDTO>Required
removeRules(data: RemovePriceSetRulesDTO[], sharedContext?: Context) => Promise<void>Required
retrieve(id: string, config?: FindConfig<PriceSetDTO>, sharedContext?: Context) => Promise<PriceSetDTO>Required
retrieveCurrency(code: string, config?: FindConfig<CurrencyDTO>, sharedContext?: Context) => Promise<CurrencyDTO>Required
retrieveMoneyAmount(id: string, config?: FindConfig<MoneyAmountDTO>, sharedContext?: Context) => Promise<MoneyAmountDTO>Required
retrievePriceList(id: string, config?: FindConfig<PriceListDTO>, sharedContext?: Context) => Promise<PriceListDTO>Required
retrievePriceListRule(id: string, config?: FindConfig<PriceListRuleDTO>, sharedContext?: Context) => Promise<PriceListRuleDTO>Required
retrievePriceRule(id: string, config?: FindConfig<PriceRuleDTO>, sharedContext?: Context) => Promise<PriceRuleDTO>Required
retrievePriceSetMoneyAmountRules(id: string, config?: FindConfig<PriceSetMoneyAmountRulesDTO>, sharedContext?: Context) => Promise<PriceSetMoneyAmountRulesDTO>Required
retrieveRuleType(id: string, config?: FindConfig<RuleTypeDTO>, sharedContext?: Context) => Promise<RuleTypeDTO>Required
setPriceListRules(data: SetPriceListRulesDTO, sharedContext?: Context) => Promise<PriceListDTO>Required
updateCurrencies(data: UpdateCurrencyDTO[], sharedContext?: Context) => Promise<CurrencyDTO[]>Required
updateMoneyAmounts(data: UpdateMoneyAmountDTO[], sharedContext?: Context) => Promise<MoneyAmountDTO[]>Required
updatePriceListRules(data: UpdatePriceListRuleDTO[], sharedContext?: Context) => Promise<PriceListRuleDTO[]>Required
updatePriceLists(data: UpdatePriceListDTO[], sharedContext?: Context) => Promise<PriceListDTO[]>Required
updatePriceRules(data: UpdatePriceRuleDTO[], sharedContext?: Context) => Promise<PriceRuleDTO[]>Required
updatePriceSetMoneyAmountRules(data: UpdatePriceSetMoneyAmountRulesDTO[], sharedContext?: Context) => Promise<PriceSetMoneyAmountRulesDTO[]>Required
updateRuleTypes(data: UpdateRuleTypeDTO[], sharedContext?: Context) => Promise<RuleTypeDTO[]>Required

remoteQuery

Returns

RemoteQueryFunction(query: string | RemoteJoinerQuery | object, variables?: Record<string, unknown>) => Promise<any> | nullRequired

Methods

atomicPhase_

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.

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

PromisePromise<TResult>Required
the result of the transactional work

calculateTaxes

Gets the prices for a product variant

Parameters

variantPricingProductVariantPricingRequired
the prices retrieved from a variant
productRatesTaxServiceRate[]Required
the tax rates that the product has applied

Returns

TaxedPricingobjectRequired
Pricing fields related to taxes.

collectPricingContext

Collects additional information necessary for completing the price selection.

Parameters

contextPriceSelectionContextRequired
the price selection context to use

Returns

PromisePromise<PricingContext>Required
The pricing context

getProductPricing

Gets all the variant prices for a product. All the product's variants will be fetched.

Parameters

productPick<Product, "id" | "variants">Required
the product to get pricing for.
contextPriceSelectionContextRequired
the price selection context to use

Returns

PromisePromise<Record<string, ProductVariantPricing>>Required
A map of variant ids to their corresponding prices

getProductPricingById

Gets all the variant prices for a product by the product id

Parameters

productIdstringRequired
the id of the product to get prices for
contextPriceSelectionContextRequired
the price selection context to use

Returns

PromisePromise<Record<string, ProductVariantPricing>>Required
A map of variant ids to their corresponding prices

getProductVariantPricing

Gets the prices for a product variant.

Parameters

variantPick<ProductVariant, "product_id" | "id">Required
the price selection context to use

Returns

PromisePromise<ProductVariantPricing>Required
The product variant prices

getProductVariantPricingById

Gets the prices for a product variant by a variant id.

Parameters

variantIdstringRequired
the id of the variant to get prices for
the price selection context to use

Returns

PromisePromise<ProductVariantPricing>Required
The product variant prices

Deprecated

Use getProductVariantsPricing instead.


getProductVariantsPricing

Gets the prices for a collection of variants.

Parameters

data{ quantity?: number ; variantId: string }[]Required
the price selection context to use

Returns

PromisePromise<{ [variant_id: string]: ProductVariantPricing; }>Required
The product variant prices

getShippingOptionPricing

Gets the prices for a shipping option.

Parameters

shippingOptionShippingOptionRequired
the shipping option to get prices for
the price selection context to use

Returns

PromisePromise<PricedShippingOption>Required
The shipping option prices

setAdminProductPricing

Parameters

productsProduct[]Required

Returns

PromisePromise<(Product | PricedProduct)[]>Required

setAdminVariantPricing

Parameters

variantsProductVariant[]Required

Returns

PromisePromise<PricedVariant[]>Required

setProductPrices

Set additional prices on a list of products.

Parameters

productsProduct[]Required
list of products on which to set additional prices
the price selection context to use

Returns

PromisePromise<(Product | PricedProduct)[]>Required
A list of products with variants decorated with prices

setShippingOptionPrices

Set additional prices on a list of shipping options.

Parameters

shippingOptionsShippingOption[]Required
list of shipping options on which to set additional prices
contextOmit<PriceSelectionContext, "region_id">
the price selection context to use

Returns

PromisePromise<PricedShippingOption[]>Required
A list of shipping options with prices

setVariantPrices

Set additional prices on a list of product variants.

Parameters

variantsProductVariant[]Required
the price selection context to use

Returns

PromisePromise<PricedVariant[]>Required
A list of products with variants decorated with prices

shouldRetryTransaction_

Parameters

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

Returns

booleanboolean

withTransaction

Parameters

transactionManagerEntityManager

Returns

PricingServicePricingServiceRequired
Was this section helpful?