PricingService
Allows retrieval of prices.
constructor
Parameters
__namedParametersInjectedDependenciesRequiredProperties
manager_EntityManagerRequiredtransactionManager_undefined | EntityManagerRequired__container__anyRequiredfeatureFlagRouterFlagRouterRequired__configModule__Record<string, unknown>__moduleDeclaration__Record<string, unknown>Accessors
activeManager_
Returns
EntityManagerEntityManagerRequiredpricingModuleService
Returns
IPricingModuleServiceobjectRequiredThe main service interface for the Pricing Module.
remoteQuery
Returns
RemoteQueryFunction(query: string | RemoteJoinerQuery | object, variables?: Record<string, unknown>, options?: RemoteJoinerOptions) => Promise<any> | nullRequiredMethods
withTransaction
Parameters
transactionManagerEntityManagerReturns
thisthisRequiredshouldRetryTransaction_
Parameters
errRecord<string, unknown> | objectRequiredReturns
booleanbooleanRequiredatomicPhase_
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.
Type Parameters
TResultobjectRequiredTErrorobjectRequiredParameters
work(transactionManager: EntityManager) => Promise<TResult>Requiredthe 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>Requiredthe result of the transactional work
collectPricingContext
Collects additional information necessary for completing the price selection.
Parameters
the price selection context to use
Returns
PromisePromise<PricingContext>RequiredThe pricing context
calculateTaxes
Gets the prices for a product variant
Parameters
the prices retrieved from a variant
the tax rates that the product has applied
Returns
TaxedPricingobjectRequiredPricing fields related to taxes.
getProductVariantPricing_
Parameters
dataobject[]RequiredReturns
getProductVariantPricing
Gets the prices for a product variant.
Parameters
the price selection context to use
Returns
The product variant prices
getProductVariantPricingById
Gets the prices for a product variant by a variant id.
Parameters
variantIdstringRequiredthe id of the variant to get prices for
the price selection context to use
Returns
The product variant prices
Deprecated
Use getProductVariantsPricing instead.
getProductVariantsPricing
Gets the prices for a collection of variants.
Parameters
dataobject[]Requiredthe price selection context to use
Returns
PromisePromise<object>RequiredThe product variant prices
getProductPricing_
Parameters
dataobject[]RequiredReturns
getProductPricing
Gets all the variant prices for a product. All the product's variants will be fetched.
Parameters
the product to get pricing for.
the price selection context to use
Returns
A map of variant ids to their corresponding prices
getProductPricingById
Gets all the variant prices for a product by the product id
Parameters
productIdstringRequiredthe id of the product to get prices for
the price selection context to use
Returns
A map of variant ids to their corresponding prices
setVariantPrices
Set additional prices on a list of product variants.