PriceListService
Provides layer to manipulate product tags.
Hierarchy
TransactionBaseService
↳
PriceListService
Constructors
constructor
new PriceListService(«destructured»
)
Parameters
Name |
---|
«destructured» |
Overrides
TransactionBaseService.constructor
Defined in
medusa/src/services/price-list.ts:52
Properties
__configModule__
Protected
Optional
Readonly
__configModule__: Record<string
, unknown
>
Inherited from
TransactionBaseService.__configModule__
Defined in
medusa/src/interfaces/transaction-base-service.ts:14
__container__
Protected
Readonly
__container__: any
Inherited from
TransactionBaseService.__container__
Defined in
medusa/src/interfaces/transaction-base-service.ts:13
__moduleDeclaration__
Protected
Optional
Readonly
__moduleDeclaration__: Record<string
, unknown
>
Inherited from
TransactionBaseService.__moduleDeclaration__
Defined in
medusa/src/interfaces/transaction-base-service.ts:15
customerGroupService_
Protected
Readonly
customerGroupService_: CustomerGroupService
Defined in
medusa/src/services/price-list.ts:43
featureFlagRouter_
Protected
Readonly
featureFlagRouter_: FlagRouter
Defined in
medusa/src/services/price-list.ts:50
manager_
Protected
manager_: EntityManager
Inherited from
TransactionBaseService.manager_
Defined in
medusa/src/interfaces/transaction-base-service.ts:5
moneyAmountRepo_
Protected
Readonly
moneyAmountRepo_: Repository
<MoneyAmount
> & { addPriceListPrices
: Method addPriceListPrices ; createProductVariantMoneyAmounts
: Method createProductVariantMoneyAmounts ; deletePriceListPrices
: Method deletePriceListPrices ; deleteVariantPricesNotIn
: Method deleteVariantPricesNotIn ; findCurrencyMoneyAmounts
: Method findCurrencyMoneyAmounts ; findManyForVariantInPriceList
: Method findManyForVariantInPriceList ; findManyForVariantInRegion
: Method findManyForVariantInRegion ; findManyForVariantsInRegion
: Method findManyForVariantsInRegion ; findRegionMoneyAmounts
: Method findRegionMoneyAmounts ; findVariantPricesNotIn
: Method findVariantPricesNotIn ; getPricesForVariantInRegion
: Method getPricesForVariantInRegion ; insertBulk
: Method insertBulk ; updatePriceListPrices
: Method updatePriceListPrices ; upsertVariantCurrencyPrice
: Method upsertVariantCurrencyPrice }
Defined in
medusa/src/services/price-list.ts:48
priceListRepo_
Protected
Readonly
priceListRepo_: Repository
<PriceList
> & { listAndCount
: Method listAndCount ; listPriceListsVariantIdsMap
: Method listPriceListsVariantIdsMap }
Defined in
medusa/src/services/price-list.ts:47
productService_
Protected
Readonly
productService_: ProductService
Defined in
medusa/src/services/price-list.ts:45
productVariantRepo_
Protected
Readonly
productVariantRepo_: Repository
<ProductVariant
>
Defined in
medusa/src/services/price-list.ts:49
regionService_
Protected
Readonly
regionService_: RegionService
Defined in
medusa/src/services/price-list.ts:44
transactionManager_
Protected
transactionManager_: undefined
| EntityManager
Inherited from
TransactionBaseService.transactionManager_
Defined in
medusa/src/interfaces/transaction-base-service.ts:6
variantService_
Protected
Readonly
variantService_: ProductVariantService
Defined in
medusa/src/services/price-list.ts:46
Accessors
activeManager_
Protected
get
activeManager_(): EntityManager
Returns
EntityManager
-EntityManager
:
Inherited from
TransactionBaseService.activeManager_
Defined in
medusa/src/interfaces/transaction-base-service.ts:8
Methods
addCurrencyFromRegion
Protected
addCurrencyFromRegion<T
>(prices
): Promise
<T
[]>
Add currency_code
to an MA record if region_id
is passed.
Name | Type |
---|---|
T | PriceListPriceUpdateInput | PriceListPriceCreateInput |
Parameters
Name | Description |
---|---|
prices | T [] |
Returns
Promise
<T
[]>
-Promise
: updated prices
list
-T[]
:
Defined in
medusa/src/services/price-list.ts:524
addPrices
addPrices(id
, prices
, replace?
): Promise
<PriceList
>
Adds prices to a price list in bulk, optionally replacing all existing prices
Parameters
Name | Default value | Description |
---|---|---|
id | string | id of the price list |
prices | PriceListPriceCreateInput [] | prices to add |
replace | boolean | false |
Returns
Promise
<PriceList
>
-Promise
: updated Price List
-PriceList
:
Defined in
medusa/src/services/price-list.ts:242
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.
Name |
---|
TResult |
TError |
Parameters
Name | Description |
---|---|
work | (transactionManager : EntityManager ) => Promise <TResult > |
isolationOrErrorHandler? | IsolationLevel | (error : TError ) => Promise <void | TResult > |
maybeErrorHandlerOrDontFail? | (error : TError ) => Promise <void | TResult > |
Returns
Promise
<TResult
>
-Promise
: the result of the transactional work
Inherited from
TransactionBaseService.atomicPhase_
Defined in
medusa/src/interfaces/transaction-base-service.ts:56
clearPrices
clearPrices(id
): Promise
<void
>
Removes all prices from a price list and deletes the removed prices in bulk
Parameters
Name | Description |
---|---|
id | string |
Returns
Promise
<void
>
-Promise
: updated Price List
Defined in
medusa/src/services/price-list.ts:282
create
create(priceListObject
): Promise
<PriceList
>
Creates a Price List
Parameters
Name | Description |
---|---|
priceListObject | CreatePriceListInput |
Returns
Promise
<PriceList
>
-Promise
: created Price List
-PriceList
:
Defined in
medusa/src/services/price-list.ts:143
delete
delete(id
): Promise
<void
>
Deletes a Price List Will never fail due to delete being idempotent.
Parameters
Name | Description |
---|---|
id | string |
Returns
Promise
<void
>
-Promise
: empty promise
Defined in
medusa/src/services/price-list.ts:296
deletePrices
deletePrices(id
, priceIds
): Promise
<void
>
Removes prices from a price list and deletes the removed prices in bulk
Parameters
Name | Description |
---|---|
id | string |
priceIds | string [] |
Returns
Promise
<void
>
-Promise
: updated Price List
Defined in
medusa/src/services/price-list.ts:267
deleteProductPrices
deleteProductPrices(priceListId
, productIds
): Promise
<[string
[], number
]>
Parameters
Name |
---|
priceListId |
productIds |
Returns
Promise
<[string
[], number
]>
-Promise
:
-string[]
:
-number
: (optional)
Defined in
medusa/src/services/price-list.ts:451
deleteVariantPrices
deleteVariantPrices(priceListId
, variantIds
): Promise
<[string
[], number
]>
Parameters
Name |
---|
priceListId |
variantIds |
Returns
Promise
<[string
[], number
]>
-Promise
:
-string[]
:
-number
: (optional)
Defined in
medusa/src/services/price-list.ts:488
list
list(selector?
, config?
): Promise
<PriceList
[]>
Lists Price Lists
Parameters
Name | Description |
---|---|
selector | FilterablePriceListProps |
config | FindConfig <PriceList > |
Returns
Promise
<PriceList
[]>
-Promise
: the result of the find operation
-PriceList[]
:
-PriceList
:
Defined in
medusa/src/services/price-list.ts:316
listAndCount
listAndCount(selector?
, config?
): Promise
<[PriceList
[], number
]>
Lists Price Lists and adds count
Parameters
Name | Description |
---|---|
selector | FilterablePriceListProps |
config | FindConfig <PriceList > |
Returns
Promise
<[PriceList
[], number
]>
-Promise
: the result of the find operation
-PriceList[]
:
-number
: (optional)
Defined in
medusa/src/services/price-list.ts:330
listPriceListsVariantIdsMap
listPriceListsVariantIdsMap(priceListIds
): Promise
<{ [priceListId: string]
: string
[]; }>
Parameters
Name |
---|
priceListIds |
Returns
Promise
<{ [priceListId: string]
: string
[]; }>
-Promise
:
-object
: (optional)
Defined in
medusa/src/services/price-list.ts:109
listProducts
listProducts(priceListId
, selector?
, config?
, requiresPriceList?
): Promise
<[Product
[], number
]>
Parameters
Name | Default value |
---|---|
priceListId | string |
selector | FilterableProductProps | Selector <Product > |
config | FindConfig <Product > |
requiresPriceList | boolean |
Returns
Promise
<[Product
[], number
]>
-Promise
:
-Product[]
:
-number
: (optional)
Defined in
medusa/src/services/price-list.ts:367
listVariants
listVariants(priceListId
, selector?
, config?
, requiresPriceList?
): Promise
<[ProductVariant
[], number
]>
Parameters
Name | Default value |
---|---|
priceListId | string |
selector | FilterableProductVariantProps |
config | FindConfig <ProductVariant > |
requiresPriceList | boolean |
Returns
Promise
<[ProductVariant
[], number
]>
-Promise
:
-ProductVariant[]
:
-number
: (optional)
Defined in
medusa/src/services/price-list.ts:417
retrieve
retrieve(priceListId
, config?
): Promise
<PriceList
>
Retrieves a product tag by id.
Parameters
Name | Description |
---|---|
priceListId | string |
config | FindConfig <PriceList > |
Returns
Promise
<PriceList
>
-Promise
: the collection.
-PriceList
:
Defined in
medusa/src/services/price-list.ts:81
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
Name |
---|
err |
Returns
boolean
-boolean
: (optional)
Inherited from
TransactionBaseService.shouldRetryTransaction_
Defined in
medusa/src/interfaces/transaction-base-service.ts:37
update
update(id
, update
): Promise
<PriceList
>
Updates a Price List
Parameters
Name | Description |
---|---|
id | string |
update | UpdatePriceListInput |
Returns
Promise
<PriceList
>
-Promise
: updated Price List
-PriceList
:
Defined in
medusa/src/services/price-list.ts:191
upsertCustomerGroups_
Protected
upsertCustomerGroups_(priceListId
, customerGroups
): Promise
<void
>
Parameters
Name |
---|
priceListId |
customerGroups |
Returns
Promise
<void
>
-Promise
:
Defined in
medusa/src/services/price-list.ts:346
withTransaction
withTransaction(transactionManager?
): PriceListService
Parameters
Name |
---|
transactionManager? |
Returns
-PriceListService
:
Inherited from
TransactionBaseService.withTransaction