PricingService
Allows retrieval of prices.
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__container__
anyRequiredfeatureFlagRouter
FlagRouterRequired__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredpricingModuleService
Returns
IPricingModuleService
objectRequiredThe 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
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
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
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Potential error handler
Returns
Promise
Promise<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
Promise
Promise<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
TaxedPricing
objectRequiredPricing fields related to taxes.
getProductVariantPricing_
Parameters
data
object[]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
variantId
stringRequiredthe 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
data
object[]Requiredthe price selection context to use
Returns
Promise
Promise<object>RequiredThe product variant prices
getProductPricing_
Parameters
data
object[]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
productId
stringRequiredthe 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.