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
Returns
addPrices
(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[]>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]>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[]>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[]>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>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>RequiredupdateCurrencies
(data: UpdateCurrencyDTO[], sharedContext?: Context) => Promise<CurrencyDTO[]>RequiredupdateMoneyAmounts
(data: UpdateMoneyAmountDTO[], sharedContext?: Context) => Promise<MoneyAmountDTO[]>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
Returns
RemoteQueryFunction
(query: string | RemoteJoinerQuery | object, variables?: Record<string, unknown>) => Promise<any> | nullRequiredMethods
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>RequiredcalculateTaxes
calculateTaxes(variantPricing
, productRates
): TaxedPricing
Gets the prices for a product variant
Parameters
Returns
TaxedPricing
objectRequiredcollectPricingContext
collectPricingContext(context
): Promise
<PricingContext
>
Collects additional information necessary for completing the price selection.
Parameters
Returns
Promise
<PricingContext
>
getPricingModuleVariantMoneyAmounts
Private
getPricingModuleVariantMoneyAmounts(variantIds
): Promise
<Map
<string
, MoneyAmount
[]>>
Parameters
variantIds
string[]RequiredReturns
Promise
<Map
<string
, MoneyAmount
[]>>
getProductPricing
getProductPricing(product
, context
): Promise
<Record<string
, 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
>>
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
>>>
Parameters
Returns
Promise
<Map
<string
, Record<string
, ProductVariantPricing
>>>
getProductVariantPricing
getProductVariantPricing(variant
, context
): Promise
<ProductVariantPricing
>
Gets the prices for a product variant.
Parameters
Returns
Promise
<ProductVariantPricing
>
getProductVariantPricingById
getProductVariantPricingById(variantId
, context
): Promise
<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
>>
Parameters
data
{ quantity?: number ; variantId: string }[]RequiredReturns
Promise
<Map
<string
, ProductVariantPricing
>>
getProductVariantsPricing
getProductVariantsPricing(data
, context
): Promise
<{ [variant_id: string]
: 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
>
Gets the prices for a shipping option.
Parameters
Returns
Promise
<PricedShippingOption
>
setAdminProductPricing
setAdminProductPricing(products
): Promise
<(Product
| PricedProduct
)[]>
Parameters
Returns
Promise
<(Product
| PricedProduct
)[]>
setAdminVariantPricing
setAdminVariantPricing(variants
, context?
): Promise
<PricedVariant
[]>
Parameters
Default: {}
Returns
Promise
<PricedVariant
[]>
setProductPrices
setProductPrices(products
, context?
): Promise
<(Product
| PricedProduct
)[]>
Set additional prices on a list of products.
Parameters
Default: {}
Returns
Promise
<(Product
| PricedProduct
)[]>
setShippingOptionPrices
setShippingOptionPrices(shippingOptions
, context?
): Promise
<PricedShippingOption
[]>
Set additional prices on a list of shipping options.
Parameters
Default: {}
Returns
Promise
<PricedShippingOption
[]>
setVariantPrices
setVariantPrices(variants
, context?
): Promise
<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
Parameters
transactionManager
EntityManager