docs: enhance how references are generated (#5805)
* adjusted configurations * enhancements to tool and configurations * change reference in docs * fixed issue in workflows reference * added project name * more optimizations * fix context error * added a types reference * resolved missing types * fix reference reflection types not having children * add an expand url parameter * added new option to the README * added details about new option
This commit is contained in:
@@ -0,0 +1,225 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/addPriceListPrices
|
||||
sidebar_label: addPriceListPrices
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# addPriceListPrices - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `addPriceListPrices` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to add prices to price lists.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function addPriceListPrices (items: {
|
||||
priceListId: string,
|
||||
prices: {
|
||||
currency_code: string,
|
||||
amount: number,
|
||||
price_set_id: string
|
||||
}[]
|
||||
}[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceLists = await pricingService.addPriceListPrices(items)
|
||||
|
||||
// do something with the price lists or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[AddPriceListPricesDTO](../../pricing/interfaces/pricing.AddPriceListPricesDTO.mdx)[]",
|
||||
"description": "The prices to add for each price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "priceListId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price list to add prices to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "prices",
|
||||
"type": "[PriceListPriceDTO](../../pricing/interfaces/pricing.PriceListPriceDTO.mdx)[]",
|
||||
"description": "The prices to add.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The amount of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CreateCurrencyDTO](../../pricing/interfaces/pricing.CreateCurrencyDTO.mdx)",
|
||||
"description": "The currency of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The updated price lists.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListDTO[]",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price list's details.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,645 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/addPrices
|
||||
sidebar_label: addPrices
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# addPrices - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `addPrices` method. This belongs to the Pricing Module.
|
||||
|
||||
`**addPrices**(data, sharedContext?): Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)>`
|
||||
|
||||
This method adds prices to a price set.
|
||||
|
||||
## Example
|
||||
|
||||
To add a default price to a price set, don't pass it any rules and make sure to pass it the `currency_code`:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function addPricesToPriceSet (priceSetId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSet = await pricingService.addPrices({
|
||||
priceSetId,
|
||||
prices: [
|
||||
{
|
||||
amount: 500,
|
||||
currency_code: "USD",
|
||||
rules: {},
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
// do something with the price set or return it
|
||||
}
|
||||
```
|
||||
|
||||
To add prices with rules:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function addPricesToPriceSet (priceSetId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSet = await pricingService.addPrices({
|
||||
priceSetId,
|
||||
prices: [
|
||||
{
|
||||
amount: 300,
|
||||
currency_code: "EUR",
|
||||
rules: {
|
||||
region_id: "PL",
|
||||
city: "krakow"
|
||||
},
|
||||
},
|
||||
{
|
||||
amount: 400,
|
||||
currency_code: "EUR",
|
||||
min_quantity: 0,
|
||||
max_quantity: 4,
|
||||
rules: {
|
||||
region_id: "PL"
|
||||
},
|
||||
},
|
||||
{
|
||||
amount: 450,
|
||||
currency_code: "EUR",
|
||||
rules: {
|
||||
city: "krakow"
|
||||
},
|
||||
}
|
||||
],
|
||||
})
|
||||
|
||||
// do something with the price set or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[AddPricesDTO](../../pricing/interfaces/pricing.AddPricesDTO.mdx)",
|
||||
"description": "The data defining the price set to add the prices to, along with the prices to add.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "priceSetId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set to add prices to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "prices",
|
||||
"type": "[CreatePricesDTO](../../pricing/interfaces/pricing.CreatePricesDTO.mdx)[]",
|
||||
"description": "The prices to add to the price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The amount of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CreateCurrencyDTO](../../pricing/interfaces/pricing.CreateCurrencyDTO.mdx)",
|
||||
"description": "The currency of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "`Record<string, string>`",
|
||||
"description": "The rules to add to the price. The object's keys are rule types' `rule_attribute` attribute, and values are the value of that rule associated with this price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The price set that the prices were added to.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amounts",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"description": "The prices that belong to this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The price of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)",
|
||||
"description": "The money amount's currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The maximum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The minimum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)",
|
||||
"description": "The details of the relation between the money amount and its associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule_types",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"description": "The rule types applied on this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
`**addPrices**(data, sharedContext?): Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]>`
|
||||
|
||||
This method adds prices to multiple price sets.
|
||||
|
||||
## Example
|
||||
|
||||
To add a default price to a price set, don't pass it any rules and make sure to pass it the `currency_code`:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function addPricesToPriceSet (priceSetId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSets = await pricingService.addPrices([{
|
||||
priceSetId,
|
||||
prices: [
|
||||
{
|
||||
amount: 500,
|
||||
currency_code: "USD",
|
||||
rules: {},
|
||||
},
|
||||
],
|
||||
}])
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
To add prices with rules:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function addPricesToPriceSet (priceSetId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSets = await pricingService.addPrices([{
|
||||
priceSetId,
|
||||
prices: [
|
||||
{
|
||||
amount: 300,
|
||||
currency_code: "EUR",
|
||||
rules: {
|
||||
region_id: "PL",
|
||||
city: "krakow"
|
||||
},
|
||||
},
|
||||
{
|
||||
amount: 400,
|
||||
currency_code: "EUR",
|
||||
min_quantity: 0,
|
||||
max_quantity: 4,
|
||||
rules: {
|
||||
region_id: "PL"
|
||||
},
|
||||
},
|
||||
{
|
||||
amount: 450,
|
||||
currency_code: "EUR",
|
||||
rules: {
|
||||
city: "krakow"
|
||||
},
|
||||
}
|
||||
],
|
||||
}])
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[AddPricesDTO](../../pricing/interfaces/pricing.AddPricesDTO.mdx)[]",
|
||||
"description": "The data defining the prices to add per price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "priceSetId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set to add prices to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "prices",
|
||||
"type": "[CreatePricesDTO](../../pricing/interfaces/pricing.CreatePricesDTO.mdx)[]",
|
||||
"description": "The prices to add to the price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The amount of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CreateCurrencyDTO](../../pricing/interfaces/pricing.CreateCurrencyDTO.mdx)",
|
||||
"description": "The currency of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "`Record<string, string>`",
|
||||
"description": "The rules to add to the price. The object's keys are rule types' `rule_attribute` attribute, and values are the value of that rule associated with this price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of the price sets that prices were added to.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetDTO[]",
|
||||
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price set's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,437 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/addRules
|
||||
sidebar_label: addRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# addRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `addRules` method. This belongs to the Pricing Module.
|
||||
|
||||
`**addRules**(data, sharedContext?): Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)>`
|
||||
|
||||
This method adds rules to a price set.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function addRulesToPriceSet (priceSetId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSet = await pricingService.addRules({
|
||||
priceSetId,
|
||||
rules: [{
|
||||
attribute: "region_id"
|
||||
}]
|
||||
})
|
||||
|
||||
// do something with the price set or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[AddRulesDTO](../../pricing/interfaces/pricing.AddRulesDTO.mdx)",
|
||||
"description": "The data defining the price set to add the rules to, along with the rules to add.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "priceSetId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set to add the rules to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "`object`[]",
|
||||
"description": "The rules to add to a price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "attribute",
|
||||
"type": "`string`",
|
||||
"description": "The value of the rule's `rule_attribute` attribute.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The price set that the rules were added to.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amounts",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"description": "The prices that belong to this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The price of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)",
|
||||
"description": "The money amount's currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The maximum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The minimum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)",
|
||||
"description": "The details of the relation between the money amount and its associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule_types",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"description": "The rule types applied on this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
`**addRules**(data, sharedContext?): Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]>`
|
||||
|
||||
This method adds rules to multiple price sets.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function addRulesToPriceSet (priceSetId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSets = await pricingService.addRules([{
|
||||
priceSetId,
|
||||
rules: [{
|
||||
attribute: "region_id"
|
||||
}]
|
||||
}])
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[AddRulesDTO](../../pricing/interfaces/pricing.AddRulesDTO.mdx)[]",
|
||||
"description": "The data defining the rules to add per price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "priceSetId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set to add the rules to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "`object`[]",
|
||||
"description": "The rules to add to a price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "attribute",
|
||||
"type": "`string`",
|
||||
"description": "The value of the rule's `rule_attribute` attribute.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of the price sets that the rules were added to.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetDTO[]",
|
||||
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price set's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,218 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/calculatePrices
|
||||
sidebar_label: calculatePrices
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# calculatePrices - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `calculatePrices` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to calculate prices based on the provided filters and context.
|
||||
|
||||
## Example
|
||||
|
||||
When you calculate prices, you must at least specify the currency code:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
async function calculatePrice (priceSetId: string, currencyCode: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const price = await pricingService.calculatePrices(
|
||||
{ id: [priceSetId] },
|
||||
{
|
||||
context: {
|
||||
currency_code: currencyCode
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price or return it
|
||||
}
|
||||
```
|
||||
|
||||
To calculate prices for specific minimum and/or maximum quantity:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
async function calculatePrice (priceSetId: string, currencyCode: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const price = await pricingService.calculatePrices(
|
||||
{ id: [priceSetId] },
|
||||
{
|
||||
context: {
|
||||
currency_code: currencyCode,
|
||||
min_quantity: 4
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price or return it
|
||||
}
|
||||
```
|
||||
|
||||
To calculate prices for custom rule types:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
async function calculatePrice (priceSetId: string, currencyCode: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const price = await pricingService.calculatePrices(
|
||||
{ id: [priceSetId] },
|
||||
{
|
||||
context: {
|
||||
currency_code: currencyCode,
|
||||
region_id: "US"
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[PricingFilters](../../pricing/interfaces/pricing.PricingFilters.mdx)",
|
||||
"description": "The filters to apply on prices.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "IDs to filter prices.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[PricingContext](../../pricing/interfaces/pricing.PricingContext.mdx)",
|
||||
"description": "The context used to select the prices. For example, you can specify the region ID in this context, and only prices having the same value\nwill be retrieved.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "context",
|
||||
"type": "`Record<string, string \\| number>`",
|
||||
"description": "an object whose keys are the name of the context attribute. Its value can be a string or a number. For example, you can pass the `currency_code` property with its value being the currency code to calculate the price in.\nAnother example is passing the `quantity` property to calculate the price for that specified quantity, which finds a price set whose `min_quantity` and `max_quantity` conditions match the specified quantity.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[CalculatedPriceSet](../../pricing/interfaces/pricing.CalculatedPriceSet.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The calculated prices matching the context and filters provided.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "CalculatedPriceSet[]",
|
||||
"type": "[CalculatedPriceSet](../../pricing/interfaces/pricing.CalculatedPriceSet.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "CalculatedPriceSet",
|
||||
"type": "`object`",
|
||||
"description": "The calculated price for a specific price set and context.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,680 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/create
|
||||
sidebar_label: create
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# create - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `create` method. This belongs to the Pricing Module.
|
||||
|
||||
`**create**(data, sharedContext?): Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)>`
|
||||
|
||||
This method is used to create a new price set.
|
||||
|
||||
## Example
|
||||
|
||||
To create a default price set, don't pass any rules. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function createPriceSet () {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSet = await pricingService.create(
|
||||
{
|
||||
rules: [],
|
||||
prices: [
|
||||
{
|
||||
amount: 500,
|
||||
currency_code: "USD",
|
||||
min_quantity: 0,
|
||||
max_quantity: 4,
|
||||
rules: {},
|
||||
},
|
||||
{
|
||||
amount: 400,
|
||||
currency_code: "USD",
|
||||
min_quantity: 5,
|
||||
max_quantity: 10,
|
||||
rules: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
// do something with the price set or return it
|
||||
}
|
||||
```
|
||||
|
||||
To create a price set and associate it with rule types:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function createPriceSet () {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSet = await pricingService.create(
|
||||
{
|
||||
rules: [{ rule_attribute: "region_id" }, { rule_attribute: "city" }],
|
||||
prices: [
|
||||
{
|
||||
amount: 300,
|
||||
currency_code: "EUR",
|
||||
rules: {
|
||||
region_id: "PL",
|
||||
city: "krakow"
|
||||
},
|
||||
},
|
||||
{
|
||||
amount: 400,
|
||||
currency_code: "EUR",
|
||||
rules: {
|
||||
region_id: "PL"
|
||||
},
|
||||
},
|
||||
{
|
||||
amount: 450,
|
||||
currency_code: "EUR",
|
||||
rules: {
|
||||
city: "krakow"
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
// do something with the price set or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[CreatePriceSetDTO](../../pricing/interfaces/pricing.CreatePriceSetDTO.mdx)",
|
||||
"description": "The attributes of the price set to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "prices",
|
||||
"type": "[CreatePricesDTO](../../pricing/interfaces/pricing.CreatePricesDTO.mdx)[]",
|
||||
"description": "The prices to create and add to this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The amount of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CreateCurrencyDTO](../../pricing/interfaces/pricing.CreateCurrencyDTO.mdx)",
|
||||
"description": "The currency of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "`Record<string, string>`",
|
||||
"description": "The rules to add to the price. The object's keys are rule types' `rule_attribute` attribute, and values are the value of that rule associated with this price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "`object`[]",
|
||||
"description": "The rules to associate with the price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "the value of the rule's `rule_attribute` attribute.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The created price set.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amounts",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"description": "The prices that belong to this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The price of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)",
|
||||
"description": "The money amount's currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The maximum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The minimum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)",
|
||||
"description": "The details of the relation between the money amount and its associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule_types",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"description": "The rule types applied on this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
`**create**(data, sharedContext?): Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]>`
|
||||
|
||||
This method is used to create multiple price sets.
|
||||
|
||||
## Example
|
||||
|
||||
To create price sets with a default price, don't pass any rules and make sure to pass the `currency_code` of the price. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function createPriceSets () {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSets = await pricingService.create([
|
||||
{
|
||||
rules: [],
|
||||
prices: [
|
||||
{
|
||||
amount: 500,
|
||||
currency_code: "USD",
|
||||
rules: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
To create price sets and associate them with rule types:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function createPriceSets () {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSets = await pricingService.create([
|
||||
{
|
||||
rules: [{ rule_attribute: "region_id" }, { rule_attribute: "city" }],
|
||||
prices: [
|
||||
{
|
||||
amount: 300,
|
||||
currency_code: "EUR",
|
||||
rules: {
|
||||
region_id: "PL",
|
||||
city: "krakow"
|
||||
},
|
||||
},
|
||||
{
|
||||
amount: 400,
|
||||
currency_code: "EUR",
|
||||
min_quantity: 0,
|
||||
max_quantity: 4,
|
||||
rules: {
|
||||
region_id: "PL"
|
||||
},
|
||||
},
|
||||
{
|
||||
amount: 450,
|
||||
currency_code: "EUR",
|
||||
rules: {
|
||||
city: "krakow"
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
])
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[CreatePriceSetDTO](../../pricing/interfaces/pricing.CreatePriceSetDTO.mdx)[]",
|
||||
"description": "The price sets to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "prices",
|
||||
"type": "[CreatePricesDTO](../../pricing/interfaces/pricing.CreatePricesDTO.mdx)[]",
|
||||
"description": "The prices to create and add to this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The amount of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CreateCurrencyDTO](../../pricing/interfaces/pricing.CreateCurrencyDTO.mdx)",
|
||||
"description": "The currency of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "`Record<string, string>`",
|
||||
"description": "The rules to add to the price. The object's keys are rule types' `rule_attribute` attribute, and values are the value of that rule associated with this price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "`object`[]",
|
||||
"description": "The rules to associate with the price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "the value of the rule's `rule_attribute` attribute.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of created price sets.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetDTO[]",
|
||||
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price set's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,179 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/createCurrencies
|
||||
sidebar_label: createCurrencies
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createCurrencies - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `createCurrencies` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to create new currencies.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function createCurrencies () {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const currencies = await pricingService.createCurrencies([
|
||||
{
|
||||
code: "USD",
|
||||
symbol: "$",
|
||||
symbol_native: "$",
|
||||
name: "US Dollar",
|
||||
}
|
||||
])
|
||||
|
||||
// do something with the currencies or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[CreateCurrencyDTO](../../pricing/interfaces/pricing.CreateCurrencyDTO.mdx)[]",
|
||||
"description": "The currencies to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "The code of the currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The name of the currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol",
|
||||
"type": "`string`",
|
||||
"description": "The symbol of the currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol_native",
|
||||
"type": "`string`",
|
||||
"description": "The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of created currencies.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "CurrencyDTO[]",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "CurrencyDTO",
|
||||
"type": "`object`",
|
||||
"description": "A currency's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,238 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/createMoneyAmounts
|
||||
sidebar_label: createMoneyAmounts
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createMoneyAmounts - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `createMoneyAmounts` method. This belongs to the Pricing Module.
|
||||
|
||||
This method creates money amounts.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveMoneyAmounts () {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const moneyAmounts = await pricingService.createMoneyAmounts([
|
||||
{
|
||||
amount: 500,
|
||||
currency_code: "USD",
|
||||
},
|
||||
{
|
||||
amount: 400,
|
||||
currency_code: "USD",
|
||||
min_quantity: 0,
|
||||
max_quantity: 4
|
||||
}
|
||||
])
|
||||
|
||||
// do something with the money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[CreateMoneyAmountDTO](../../pricing/interfaces/pricing.CreateMoneyAmountDTO.mdx)[]",
|
||||
"description": "The money amounts to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The amount of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CreateCurrencyDTO](../../pricing/interfaces/pricing.CreateCurrencyDTO.mdx)",
|
||||
"description": "The currency of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "The code of the currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The name of the currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol",
|
||||
"type": "`string`",
|
||||
"description": "The symbol of the currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol_native",
|
||||
"type": "`string`",
|
||||
"description": "The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of created money amounts.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "MoneyAmountDTO[]",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "MoneyAmountDTO",
|
||||
"type": "`object`",
|
||||
"description": "A money amount's data. A money amount represents a price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,175 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/createPriceListRules
|
||||
sidebar_label: createPriceListRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createPriceListRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `createPriceListRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to create price list rules.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function createPriceListRules (items: {
|
||||
rule_type_id: string
|
||||
price_list_id: string
|
||||
}[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceListRules = await pricingService.createPriceListRules(items)
|
||||
|
||||
// do something with the price list rule or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[CreatePriceListRuleDTO](../../pricing/interfaces/pricing.CreatePriceListRuleDTO.mdx)[]",
|
||||
"description": "The price list rules to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "`string` \\| [PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The ID of a price list or the details of an existing price list to be associated with the price list rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a price list to be associated with the price list rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "`string` \\| [RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)",
|
||||
"description": "The ID of a rule type or the details of an existing rule type to be associated with the price list rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a rule type to be associated with the price list rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The created price list rules.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListRuleDTO[]",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListRuleDTO",
|
||||
"type": "`object`",
|
||||
"description": "The price list rule's details.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,324 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/createPriceLists
|
||||
sidebar_label: createPriceLists
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createPriceLists - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `createPriceLists` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to create price lists.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function createPriceList (items: {
|
||||
title: string
|
||||
description: string
|
||||
starts_at?: string
|
||||
ends_at?: string
|
||||
}[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceList = await pricingService.createPriceLists(items)
|
||||
|
||||
// do something with the price lists or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[CreatePriceListDTO](../../pricing/interfaces/pricing.CreatePriceListDTO.mdx)[]",
|
||||
"description": "The details of each price list to be created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string`",
|
||||
"description": "The price list's description.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "ends_at",
|
||||
"type": "`string`",
|
||||
"description": "The price list expires after this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number_rules",
|
||||
"type": "`number`",
|
||||
"description": "The number of rules associated with the price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "prices",
|
||||
"type": "[PriceListPriceDTO](../../pricing/interfaces/pricing.PriceListPriceDTO.mdx)[]",
|
||||
"description": "The prices associated with the price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The amount of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CreateCurrencyDTO](../../pricing/interfaces/pricing.CreateCurrencyDTO.mdx)",
|
||||
"description": "The currency of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "[CreatePriceListRules](../../pricing/interfaces/pricing.CreatePriceListRules.mdx)",
|
||||
"description": "The rules to be created and associated with the price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "starts_at",
|
||||
"type": "`string`",
|
||||
"description": "The price list is enabled starting from this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[PriceListStatus](../../pricing/enums/pricing.PriceListStatus.mdx)",
|
||||
"description": "The price list's status.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ACTIVE",
|
||||
"type": "`\"active\"`",
|
||||
"description": "The price list is enabled and its prices can be used.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "DRAFT",
|
||||
"type": "`\"draft\"`",
|
||||
"description": "The price list is disabled, meaning its prices can't be used yet.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The price list's title.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"type": "[PriceListType](../../pricing/enums/pricing.PriceListType.mdx)",
|
||||
"description": "The price list's type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "OVERRIDE",
|
||||
"type": "`\"override\"`",
|
||||
"description": "The price list's prices override original prices. This affects the calculated price of associated price sets.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "SALE",
|
||||
"type": "`\"sale\"`",
|
||||
"description": "The price list's prices are used for a sale.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The created price lists.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListDTO[]",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price list's details.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,206 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/createPriceRules
|
||||
sidebar_label: createPriceRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createPriceRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `createPriceRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to create new price rules based on the provided data.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function createPriceRules (
|
||||
id: string,
|
||||
priceSetId: string,
|
||||
ruleTypeId: string,
|
||||
value: string,
|
||||
priceSetMoneyAmountId: string,
|
||||
priceListId: string
|
||||
) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceRules = await pricingService.createPriceRules([
|
||||
{
|
||||
id,
|
||||
price_set_id: priceSetId,
|
||||
rule_type_id: ruleTypeId,
|
||||
value,
|
||||
price_set_money_amount_id: priceSetMoneyAmountId,
|
||||
price_list_id: priceListId
|
||||
}
|
||||
])
|
||||
|
||||
// do something with the price rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[CreatePriceRuleDTO](../../pricing/interfaces/pricing.CreatePriceRuleDTO.mdx)[]",
|
||||
"description": "The price rules to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "priority",
|
||||
"type": "`number`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the price rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of created price rules.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceRuleDTO[]",
|
||||
"type": "[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceRuleDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price rule's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,170 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/createPriceSetMoneyAmountRules
|
||||
sidebar_label: createPriceSetMoneyAmountRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createPriceSetMoneyAmountRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `createPriceSetMoneyAmountRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to create new price set money amount rules. A price set money amount rule creates an association between a price set money amount and
|
||||
a rule type.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function createPriceSetMoneyAmountRules (priceSetMoneyAmountId: string, ruleTypeId: string, value: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmountRules = await pricingService.createPriceSetMoneyAmountRules([
|
||||
{
|
||||
price_set_money_amount: priceSetMoneyAmountId,
|
||||
rule_type: ruleTypeId,
|
||||
value
|
||||
}
|
||||
])
|
||||
|
||||
// do something with the price set money amount rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[CreatePriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.CreatePriceSetMoneyAmountRulesDTO.mdx)[]",
|
||||
"description": "The price set money amount rules to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "price_set_money_amount",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a price set money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the price set money amount rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of created price set money amount rules.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetMoneyAmountRulesDTO[]",
|
||||
"type": "[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetMoneyAmountRulesDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price set money amount rule's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,177 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/createRuleTypes
|
||||
sidebar_label: createRuleTypes
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createRuleTypes - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `createRuleTypes` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to create new rule types.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function createRuleTypes () {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const ruleTypes = await pricingService.createRuleTypes([
|
||||
{
|
||||
name: "Region",
|
||||
rule_attribute: "region_id"
|
||||
}
|
||||
])
|
||||
|
||||
// do something with the rule types or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[CreateRuleTypeDTO](../../pricing/interfaces/pricing.CreateRuleTypeDTO.mdx)[]",
|
||||
"description": "The rule types to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy the provided context. \nThe higher the value, the higher the priority of the rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of the `calculatePrices` \nmethod to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of created rule types.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "RuleTypeDTO[]",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "RuleTypeDTO",
|
||||
"type": "`object`",
|
||||
"description": "A rule type's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,113 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/delete
|
||||
sidebar_label: delete
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# delete - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `delete` method. This belongs to the Pricing Module.
|
||||
|
||||
This method deletes price sets by their IDs.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function removePriceSetRule (priceSetIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
await pricingService.delete(priceSetIds)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "ids",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs of the price sets to delete.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when the price sets are successfully deleted.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,114 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/deleteCurrencies
|
||||
sidebar_label: deleteCurrencies
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deleteCurrencies - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `deleteCurrencies` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to delete currencies based on their currency code.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function deleteCurrencies () {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
await pricingService.deleteCurrencies(["USD"])
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "currencyCodes",
|
||||
"type": "`string`[]",
|
||||
"description": "Currency codes of the currencies to delete.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves once the currencies are deleted.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,115 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/deleteMoneyAmounts
|
||||
sidebar_label: deleteMoneyAmounts
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deleteMoneyAmounts - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `deleteMoneyAmounts` method. This belongs to the Pricing Module.
|
||||
|
||||
This method deletes money amounts by their IDs.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function deleteMoneyAmounts (moneyAmountIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
await pricingService.deleteMoneyAmounts(
|
||||
moneyAmountIds
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "ids",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs of the money amounts to delete.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when the money amounts are successfully deleted.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,113 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/deletePriceListRules
|
||||
sidebar_label: deletePriceListRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deletePriceListRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `deletePriceListRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to delete price list rules.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function deletePriceListRules (priceListRuleIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
await pricingService.deletePriceListRules(priceListRuleIds)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "priceListRuleIds",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs of the price list rules to delete.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves successfully when the price list rules are deleted.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,113 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/deletePriceLists
|
||||
sidebar_label: deletePriceLists
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deletePriceLists - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `deletePriceLists` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to delete price lists.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function deletePriceLists (ids: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
await pricingService.deletePriceLists(ids)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "priceListIds",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs of the price lists to delete.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when the price lists are deleted successfully.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,115 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/deletePriceRules
|
||||
sidebar_label: deletePriceRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deletePriceRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `deletePriceRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to delete price rules based on the specified IDs.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function deletePriceRules (
|
||||
id: string,
|
||||
) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
await pricingService.deletePriceRules([id])
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "priceRuleIds",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs of the price rules to delete.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves once the price rules are deleted.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,113 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/deletePriceSetMoneyAmountRules
|
||||
sidebar_label: deletePriceSetMoneyAmountRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deletePriceSetMoneyAmountRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `deletePriceSetMoneyAmountRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to delete price set money amount rules based on the specified IDs.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function deletePriceSetMoneyAmountRule (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
await pricingService.deletePriceSetMoneyAmountRules([id])
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "ids",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs of the price set money amount rules to delete.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves once the price set money amount rules are deleted.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,113 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/deleteRuleTypes
|
||||
sidebar_label: deleteRuleTypes
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deleteRuleTypes - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `deleteRuleTypes` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to delete rule types based on the provided IDs.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function deleteRuleTypes (ruleTypeId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
await pricingService.deleteRuleTypes([ruleTypeId])
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "ruleTypeIds",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs of the rule types to delete.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves once the rule types are deleted.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,361 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/list
|
||||
sidebar_label: list
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# list - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `list` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price sets based on optional filters and configuration.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of price sets using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSets (priceSetIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSets = await pricingService.list(
|
||||
{
|
||||
id: priceSetIds
|
||||
},
|
||||
)
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price sets:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSets (priceSetIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSets = await pricingService.list(
|
||||
{
|
||||
id: priceSetIds
|
||||
},
|
||||
{
|
||||
relations: ["money_amounts"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSets (priceSetIds: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSets = await pricingService.list(
|
||||
{
|
||||
id: priceSetIds
|
||||
},
|
||||
{
|
||||
relations: ["money_amounts"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSets (priceSetIds: string[], moneyAmountIds: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSets = await pricingService.list(
|
||||
{
|
||||
$and: [
|
||||
{
|
||||
id: priceSetIds
|
||||
},
|
||||
{
|
||||
money_amounts: {
|
||||
id: moneyAmountIds
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
relations: ["money_amounts"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceSetProps](../../pricing/interfaces/pricing.FilterablePriceSetProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price lists.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceSetProps](../../pricing/interfaces/pricing.FilterablePriceSetProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetProps](../../pricing/interfaces/pricing.FilterablePriceSetProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceSetProps](../../pricing/interfaces/pricing.FilterablePriceSetProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetProps](../../pricing/interfaces/pricing.FilterablePriceSetProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "IDs to filter price sets by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amounts",
|
||||
"type": "[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)",
|
||||
"description": "Filters to apply on a price set's associated money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "Currency codes to filter money amounts by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "IDs to filter money amounts by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)>",
|
||||
"description": "The configurations determining how the price sets are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price sets.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetDTO[]",
|
||||
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price set's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,360 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listAndCount
|
||||
sidebar_label: listAndCount
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listAndCount - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listAndCount` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price sets along with the total count of available price sets satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of prices sets using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSets (priceSetIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSets, count] = await pricingService.listAndCount(
|
||||
{
|
||||
id: priceSetIds
|
||||
},
|
||||
)
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price sets:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSets (priceSetIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSets, count] = await pricingService.listAndCount(
|
||||
{
|
||||
id: priceSetIds
|
||||
},
|
||||
{
|
||||
relations: ["money_amounts"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSets (priceSetIds: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSets, count] = await pricingService.listAndCount(
|
||||
{
|
||||
id: priceSetIds
|
||||
},
|
||||
{
|
||||
relations: ["money_amounts"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSets (priceSetIds: string[], moneyAmountIds: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSets, count] = await pricingService.listAndCount(
|
||||
{
|
||||
$and: [
|
||||
{
|
||||
id: priceSetIds
|
||||
},
|
||||
{
|
||||
money_amounts: {
|
||||
id: moneyAmountIds
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
relations: ["money_amounts"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price sets or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceSetProps](../../pricing/interfaces/pricing.FilterablePriceSetProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price lists.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceSetProps](../../pricing/interfaces/pricing.FilterablePriceSetProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetProps](../../pricing/interfaces/pricing.FilterablePriceSetProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceSetProps](../../pricing/interfaces/pricing.FilterablePriceSetProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetProps](../../pricing/interfaces/pricing.FilterablePriceSetProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "IDs to filter price sets by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amounts",
|
||||
"type": "[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)",
|
||||
"description": "Filters to apply on a price set's associated money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "Currency codes to filter money amounts by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "IDs to filter money amounts by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)>",
|
||||
"description": "The configurations determining how the price sets are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price sets along with their total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetDTO[]",
|
||||
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,280 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listAndCountCurrencies
|
||||
sidebar_label: listAndCountCurrencies
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listAndCountCurrencies - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listAndCountCurrencies` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of currencies along with the total count of available currencies satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of currencies using their codes:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveCurrencies (codes: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [currencies, count] = await pricingService.listAndCountCurrencies(
|
||||
{
|
||||
code: codes
|
||||
},
|
||||
)
|
||||
|
||||
// do something with the currencies or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify attributes that should be retrieved within the money amounts:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveCurrencies (codes: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [currencies, count] = await pricingService.listAndCountCurrencies(
|
||||
{
|
||||
code: codes
|
||||
},
|
||||
{
|
||||
select: ["symbol_native"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the currencies or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveCurrencies (codes: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [currencies, count] = await pricingService.listAndCountCurrencies(
|
||||
{
|
||||
code: codes
|
||||
},
|
||||
{
|
||||
select: ["symbol_native"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the currencies or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterableCurrencyProps](../../pricing/interfaces/pricing.FilterableCurrencyProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved currencies.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterableCurrencyProps](../../pricing/interfaces/pricing.FilterableCurrencyProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableCurrencyProps](../../pricing/interfaces/pricing.FilterableCurrencyProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterableCurrencyProps](../../pricing/interfaces/pricing.FilterableCurrencyProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableCurrencyProps](../../pricing/interfaces/pricing.FilterableCurrencyProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`[]",
|
||||
"description": "The codes to filter the currencies by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)>",
|
||||
"description": "The configurations determining how the currencies are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of currencies along with the total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "CurrencyDTO[]",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,321 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listAndCountMoneyAmounts
|
||||
sidebar_label: listAndCountMoneyAmounts
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listAndCountMoneyAmounts - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listAndCountMoneyAmounts` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of money amounts along with the total count of available money amounts satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of money amounts using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [moneyAmounts, count] = await pricingService.listAndCountMoneyAmounts(
|
||||
{
|
||||
id: moneyAmountIds
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the money amounts:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [moneyAmounts, count] = await pricingService.listAndCountMoneyAmounts(
|
||||
{
|
||||
id: moneyAmountIds
|
||||
},
|
||||
{
|
||||
relations: ["currency"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveMoneyAmounts (moneyAmountIds: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [moneyAmounts, count] = await pricingService.listAndCountMoneyAmounts(
|
||||
{
|
||||
id: moneyAmountIds
|
||||
},
|
||||
{
|
||||
relations: ["currency"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveMoneyAmounts (moneyAmountIds: string[], currencyCode: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [moneyAmounts, count] = await pricingService.listAndCountMoneyAmounts(
|
||||
{
|
||||
$and: [
|
||||
{
|
||||
id: moneyAmountIds
|
||||
},
|
||||
{
|
||||
currency_code: currencyCode
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
relations: ["currency"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "Currency codes to filter money amounts by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "IDs to filter money amounts by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)>",
|
||||
"description": "The configurations determining how the money amounts are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of money amounts along with their total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "MoneyAmountDTO[]",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,339 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listAndCountPriceListRules
|
||||
sidebar_label: listAndCountPriceListRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listAndCountPriceListRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listAndCountPriceListRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price list ruless along with the total count of available price list ruless satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of price list vs using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listAndCountPriceListRules (priceListRuleIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceListRules, count] = await pricingService.listAndCountPriceListRules(
|
||||
{
|
||||
id: priceListRuleIds
|
||||
},
|
||||
)
|
||||
|
||||
// do something with the price list rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price list rules:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listAndCountPriceListRules (priceListRuleIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceListRules, count] = await pricingService.listAndCountPriceListRules(
|
||||
{
|
||||
id: priceListRuleIds
|
||||
},
|
||||
{
|
||||
relations: ["price_list_rule_values"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price list rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listAndCountPriceListRules (priceListRuleIds: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceListRules, count] = await pricingService.listAndCountPriceListRules(
|
||||
{
|
||||
id: priceListRuleIds
|
||||
},
|
||||
{
|
||||
relations: ["price_list_rule_values"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price list rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listAndCountPriceListRules (priceListRuleIds: string[], ruleTypeIDs: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceListRules, count] = await pricingService.listAndCountPriceListRules(
|
||||
{
|
||||
$and: [
|
||||
{
|
||||
id: priceListRuleIds
|
||||
},
|
||||
{
|
||||
rule_types: ruleTypeIDs
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
relations: ["price_list_rule_values"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price list rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceListRuleProps](../../pricing/interfaces/pricing.FilterablePriceListRuleProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price list rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceListRuleProps](../../pricing/interfaces/pricing.FilterablePriceListRuleProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceListRuleProps](../../pricing/interfaces/pricing.FilterablePriceListRuleProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceListRuleProps](../../pricing/interfaces/pricing.FilterablePriceListRuleProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceListRuleProps](../../pricing/interfaces/pricing.FilterablePriceListRuleProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter price list rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_id",
|
||||
"type": "`string`[]",
|
||||
"description": "Filter price list rules by the ID of their associated price lists.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "`string`[]",
|
||||
"description": "Filter price list rules by the ID of their associated rule types.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`[]",
|
||||
"description": "The values to filter price list rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)>",
|
||||
"description": "The configurations determining how the price list rules are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price list rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price list rules along with their total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListRuleDTO[]",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,367 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listAndCountPriceLists
|
||||
sidebar_label: listAndCountPriceLists
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listAndCountPriceLists - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listAndCountPriceLists` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price lists along with the total count of available price lists satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of price lists using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceLists (priceListIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceLists, count] = await pricingService.listPriceLists(
|
||||
{
|
||||
id: priceListIds
|
||||
},
|
||||
)
|
||||
|
||||
// do something with the price lists or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price lists:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceLists (priceListIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceLists, count] = await pricingService.listPriceLists(
|
||||
{
|
||||
id: priceListIds
|
||||
},
|
||||
{
|
||||
relations: ["price_set_money_amounts"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price lists or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceLists (priceListIds: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceLists, count] = await pricingService.listPriceLists(
|
||||
{
|
||||
id: priceListIds
|
||||
},
|
||||
{
|
||||
relations: ["price_set_money_amounts"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price lists or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceLists (priceListIds: string[], titles: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceLists, count] = await pricingService.listPriceLists(
|
||||
{
|
||||
$and: [
|
||||
{
|
||||
id: priceListIds
|
||||
},
|
||||
{
|
||||
title: titles
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
relations: ["price_set_money_amounts"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price lists or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceListProps](../../pricing/interfaces/pricing.FilterablePriceListProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price lists.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceListProps](../../pricing/interfaces/pricing.FilterablePriceListProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceListProps](../../pricing/interfaces/pricing.FilterablePriceListProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceListProps](../../pricing/interfaces/pricing.FilterablePriceListProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceListProps](../../pricing/interfaces/pricing.FilterablePriceListProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "ends_at",
|
||||
"type": "`string`[]",
|
||||
"description": "The end dates to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter price lists by",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number_rules",
|
||||
"type": "`number`[]",
|
||||
"description": "The number of rules to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "starts_at",
|
||||
"type": "`string`[]",
|
||||
"description": "The start dates to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[PriceListStatus](../../pricing/enums/pricing.PriceListStatus.mdx)[]",
|
||||
"description": "The statuses to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ACTIVE",
|
||||
"type": "`\"active\"`",
|
||||
"description": "The price list is enabled and its prices can be used.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "DRAFT",
|
||||
"type": "`\"draft\"`",
|
||||
"description": "The price list is disabled, meaning its prices can't be used yet.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)>",
|
||||
"description": "The configurations determining how the price lists are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price lists along with their total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListDTO[]",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,328 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listAndCountPriceRules
|
||||
sidebar_label: listAndCountPriceRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listAndCountPriceRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listAndCountPriceRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price rules along with the total count of available price rules satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of price rules using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceRules (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceRules, count] = await pricingService.listAndCountPriceRules({
|
||||
id: [id]
|
||||
})
|
||||
|
||||
// do something with the price rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price rules:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceRules (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceRules, count] = await pricingService.listAndCountPriceRules({
|
||||
id: [id],
|
||||
}, {
|
||||
relations: ["price_set"]
|
||||
})
|
||||
|
||||
// do something with the price rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceRules (id: string, skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceRules, count] = await pricingService.listAndCountPriceRules({
|
||||
id: [id],
|
||||
}, {
|
||||
relations: ["price_set"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceRules (ids: string[], name: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceRules, count] = await pricingService.listAndCountPriceRules({
|
||||
$and: [
|
||||
{
|
||||
id: ids
|
||||
},
|
||||
{
|
||||
name
|
||||
}
|
||||
]
|
||||
}, {
|
||||
relations: ["price_set"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceRuleProps](../../pricing/interfaces/pricing.FilterablePriceRuleProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceRuleProps](../../pricing/interfaces/pricing.FilterablePriceRuleProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceRuleProps](../../pricing/interfaces/pricing.FilterablePriceRuleProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceRuleProps](../../pricing/interfaces/pricing.FilterablePriceRuleProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceRuleProps](../../pricing/interfaces/pricing.FilterablePriceRuleProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter price rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`[]",
|
||||
"description": "The names to filter price rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price rule's associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price rule's associated rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)>",
|
||||
"description": "The configurations determining how the price rule is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price rules along with their total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceRuleDTO[]",
|
||||
"type": "[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,329 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listAndCountPriceSetMoneyAmountRules
|
||||
sidebar_label: listAndCountPriceSetMoneyAmountRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listAndCountPriceSetMoneyAmountRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listAndCountPriceSetMoneyAmountRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price set money amount rules along with the total count of
|
||||
available price set money amount rules satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of price set money amounts using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmountRules (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSetMoneyAmountRules, count] = await pricingService.listAndCountPriceSetMoneyAmountRules({
|
||||
id: [id]
|
||||
})
|
||||
|
||||
// do something with the price set money amount rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price set money amount rules:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmountRules (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSetMoneyAmountRules, count] = await pricingService.listAndCountPriceSetMoneyAmountRules({
|
||||
id: [id]
|
||||
}, {
|
||||
relations: ["price_set_money_amount"],
|
||||
})
|
||||
|
||||
// do something with the price set money amount rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmountRules (id: string, skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSetMoneyAmountRules, count] = await pricingService.listAndCountPriceSetMoneyAmountRules({
|
||||
id: [id]
|
||||
}, {
|
||||
relations: ["price_set_money_amount"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price set money amount rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmountRules (ids: string[], ruleTypeId: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSetMoneyAmountRules, count] = await pricingService.listAndCountPriceSetMoneyAmountRules({
|
||||
$and: [
|
||||
{
|
||||
id: ids
|
||||
},
|
||||
{
|
||||
rule_type_id: ruleTypeId
|
||||
}
|
||||
]
|
||||
}, {
|
||||
relations: ["price_set_money_amount"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price set money amount rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceSetMoneyAmountRulesProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountRulesProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price set money amount rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceSetMoneyAmountRulesProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountRulesProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetMoneyAmountRulesProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountRulesProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceSetMoneyAmountRulesProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountRulesProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetMoneyAmountRulesProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountRulesProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The ID to filter price set money amount rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price set money amount rule's associated price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price set money amount rule's associated rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`[]",
|
||||
"description": "The value to filter price set money amount rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)>",
|
||||
"description": "The configurations determining how the price set money amount rules are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price set money amount rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price set money amount rules and their total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetMoneyAmountRulesDTO[]",
|
||||
"type": "[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,320 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listAndCountPriceSetMoneyAmounts
|
||||
sidebar_label: listAndCountPriceSetMoneyAmounts
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listAndCountPriceSetMoneyAmounts - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listAndCountPriceSetMoneyAmounts` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price set money amounts along with the total count of
|
||||
available price set money amounts satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of price set money amounts using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmounts (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSetMoneyAmounts, count] = await pricingService.listAndCountPriceSetMoneyAmounts({
|
||||
id: [id]
|
||||
})
|
||||
|
||||
// do something with the price set money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price set money amounts:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmounts (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSetMoneyAmounts, count] = await pricingService.listAndCountPriceSetMoneyAmounts({
|
||||
id: [id]
|
||||
}, {
|
||||
relations: ["price_rules"],
|
||||
})
|
||||
|
||||
// do something with the price set money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmounts (id: string, skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSetMoneyAmounts, count] = await pricingService.listAndCountPriceSetMoneyAmounts({
|
||||
id: [id]
|
||||
}, {
|
||||
relations: ["price_rules"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price set money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmounts (ids: string[], titles: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [priceSetMoneyAmounts, count] = await pricingService.listAndCountPriceSetMoneyAmounts({
|
||||
$and: [
|
||||
{
|
||||
id: ids
|
||||
},
|
||||
{
|
||||
title: titles
|
||||
}
|
||||
]
|
||||
}, {
|
||||
relations: ["price_rules"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price set money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceSetMoneyAmountProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price set money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceSetMoneyAmountProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetMoneyAmountProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceSetMoneyAmountProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetMoneyAmountProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price set money amounts by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price set money amount's associated price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price set money amount's associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)>",
|
||||
"description": "The configurations determining how the price set money amounts are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price set money amounts and their total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetMoneyAmountDTO[]",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,325 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listAndCountRuleTypes
|
||||
sidebar_label: listAndCountRuleTypes
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listAndCountRuleTypes - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listAndCountRuleTypes` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of rule types along with the total count of available rule types satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of rule types using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveRuleTypes (ruleTypeId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [ruleTypes, count] = await pricingService.listAndCountRuleTypes({
|
||||
id: [
|
||||
ruleTypeId
|
||||
]
|
||||
})
|
||||
|
||||
// do something with the rule types or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify attributes that should be retrieved within the rule types:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveRuleTypes (ruleTypeId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [ruleTypes, count] = await pricingService.listAndCountRuleTypes({
|
||||
id: [
|
||||
ruleTypeId
|
||||
]
|
||||
}, {
|
||||
select: ["name"]
|
||||
})
|
||||
|
||||
// do something with the rule types or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveRuleTypes (ruleTypeId: string, skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [ruleTypes, count] = await pricingService.listAndCountRuleTypes({
|
||||
id: [
|
||||
ruleTypeId
|
||||
]
|
||||
}, {
|
||||
select: ["name"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the rule types or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveRuleTypes (ruleTypeId: string[], name: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const [ruleTypes, count] = await pricingService.listAndCountRuleTypes({
|
||||
$and: [
|
||||
{
|
||||
id: ruleTypeId
|
||||
},
|
||||
{
|
||||
name
|
||||
}
|
||||
]
|
||||
}, {
|
||||
select: ["name"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the rule types or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterableRuleTypeProps](../../pricing/interfaces/pricing.FilterableRuleTypeProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved rule types.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterableRuleTypeProps](../../pricing/interfaces/pricing.FilterableRuleTypeProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableRuleTypeProps](../../pricing/interfaces/pricing.FilterableRuleTypeProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterableRuleTypeProps](../../pricing/interfaces/pricing.FilterableRuleTypeProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableRuleTypeProps](../../pricing/interfaces/pricing.FilterableRuleTypeProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter rule types by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`[]",
|
||||
"description": "The names to filter rule types by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`[]",
|
||||
"description": "The rule attributes to filter rule types by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)>",
|
||||
"description": "The configurations determining how the rule types are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of rule types along with their total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "RuleTypeDTO[]",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,281 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listCurrencies
|
||||
sidebar_label: listCurrencies
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listCurrencies - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listCurrencies` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of currencies based on optional filters and configuration.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of currencies using their codes:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveCurrencies (codes: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const currencies = await pricingService.listCurrencies(
|
||||
{
|
||||
code: codes
|
||||
},
|
||||
)
|
||||
|
||||
// do something with the currencies or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify attributes that should be retrieved within the money amounts:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveCurrencies (codes: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const currencies = await pricingService.listCurrencies(
|
||||
{
|
||||
code: codes
|
||||
},
|
||||
{
|
||||
select: ["symbol_native"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the currencies or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveCurrencies (codes: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const currencies = await pricingService.listCurrencies(
|
||||
{
|
||||
code: codes
|
||||
},
|
||||
{
|
||||
select: ["symbol_native"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the currencies or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterableCurrencyProps](../../pricing/interfaces/pricing.FilterableCurrencyProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved currencies.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterableCurrencyProps](../../pricing/interfaces/pricing.FilterableCurrencyProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableCurrencyProps](../../pricing/interfaces/pricing.FilterableCurrencyProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterableCurrencyProps](../../pricing/interfaces/pricing.FilterableCurrencyProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableCurrencyProps](../../pricing/interfaces/pricing.FilterableCurrencyProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`[]",
|
||||
"description": "The codes to filter the currencies by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)>",
|
||||
"description": "The configurations determining how the currencies are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of currencies.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "CurrencyDTO[]",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "CurrencyDTO",
|
||||
"type": "`object`",
|
||||
"description": "A currency's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,322 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listMoneyAmounts
|
||||
sidebar_label: listMoneyAmounts
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listMoneyAmounts - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listMoneyAmounts` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of money amounts based on optional filters and configuration.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of money amounts using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const moneyAmounts = await pricingService.listMoneyAmounts(
|
||||
{
|
||||
id: moneyAmountIds
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the money amounts:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const moneyAmounts = await pricingService.listMoneyAmounts(
|
||||
{
|
||||
id: moneyAmountIds
|
||||
},
|
||||
{
|
||||
relations: ["currency"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveMoneyAmounts (moneyAmountIds: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const moneyAmounts = await pricingService.listMoneyAmounts(
|
||||
{
|
||||
id: moneyAmountIds
|
||||
},
|
||||
{
|
||||
relations: ["currency"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveMoneyAmounts (moneyAmountIds: string[], currencyCode: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const moneyAmounts = await pricingService.listMoneyAmounts(
|
||||
{
|
||||
$and: [
|
||||
{
|
||||
id: moneyAmountIds
|
||||
},
|
||||
{
|
||||
currency_code: currencyCode
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
relations: ["currency"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)",
|
||||
"description": "The filtes to apply on the retrieved money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableMoneyAmountProps](../../pricing/interfaces/pricing.FilterableMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "Currency codes to filter money amounts by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "IDs to filter money amounts by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)>",
|
||||
"description": "The configurations determining how the money amounts are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of money amounts.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "MoneyAmountDTO[]",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "MoneyAmountDTO",
|
||||
"type": "`object`",
|
||||
"description": "A money amount's data. A money amount represents a price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,340 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listPriceListRules
|
||||
sidebar_label: listPriceListRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listPriceListRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listPriceListRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price list rules based on optional filters and configuration.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of price list vs using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listPriceListRules (priceListRuleIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceListRules = await pricingService.listPriceListRules(
|
||||
{
|
||||
id: priceListRuleIds
|
||||
},
|
||||
)
|
||||
|
||||
// do something with the price list rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price list rules:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listPriceListRules (priceListRuleIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceListRules = await pricingService.listPriceListRules(
|
||||
{
|
||||
id: priceListRuleIds
|
||||
},
|
||||
{
|
||||
relations: ["price_list_rule_values"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price list rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listPriceListRules (priceListRuleIds: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceListRules = await pricingService.listPriceListRules(
|
||||
{
|
||||
id: priceListRuleIds
|
||||
},
|
||||
{
|
||||
relations: ["price_list_rule_values"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price list rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listPriceListRules (priceListRuleIds: string[], ruleTypeIDs: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceListRules = await pricingService.listPriceListRules(
|
||||
{
|
||||
$and: [
|
||||
{
|
||||
id: priceListRuleIds
|
||||
},
|
||||
{
|
||||
rule_types: ruleTypeIDs
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
relations: ["price_list_rule_values"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price list rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceListRuleProps](../../pricing/interfaces/pricing.FilterablePriceListRuleProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price list rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceListRuleProps](../../pricing/interfaces/pricing.FilterablePriceListRuleProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceListRuleProps](../../pricing/interfaces/pricing.FilterablePriceListRuleProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceListRuleProps](../../pricing/interfaces/pricing.FilterablePriceListRuleProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceListRuleProps](../../pricing/interfaces/pricing.FilterablePriceListRuleProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter price list rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_id",
|
||||
"type": "`string`[]",
|
||||
"description": "Filter price list rules by the ID of their associated price lists.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "`string`[]",
|
||||
"description": "Filter price list rules by the ID of their associated rule types.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`[]",
|
||||
"description": "The values to filter price list rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)>",
|
||||
"description": "The configurations determining how the price list rules are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price list rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price list rules.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListRuleDTO[]",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListRuleDTO",
|
||||
"type": "`object`",
|
||||
"description": "The price list rule's details.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,368 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listPriceLists
|
||||
sidebar_label: listPriceLists
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listPriceLists - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listPriceLists` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price lists based on optional filters and configuration.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of price lists using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listPriceLists (priceListIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceLists = await pricingService.listPriceLists(
|
||||
{
|
||||
id: priceListIds
|
||||
},
|
||||
)
|
||||
|
||||
// do something with the price lists or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price lists:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listPriceLists (priceListIds: string[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceLists = await pricingService.listPriceLists(
|
||||
{
|
||||
id: priceListIds
|
||||
},
|
||||
{
|
||||
relations: ["price_set_money_amounts"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price lists or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listPriceLists (priceListIds: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceLists = await pricingService.listPriceLists(
|
||||
{
|
||||
id: priceListIds
|
||||
},
|
||||
{
|
||||
relations: ["price_set_money_amounts"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price lists or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function listPriceLists (priceListIds: string[], titles: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceLists = await pricingService.listPriceLists(
|
||||
{
|
||||
$and: [
|
||||
{
|
||||
id: priceListIds
|
||||
},
|
||||
{
|
||||
title: titles
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
relations: ["price_set_money_amounts"],
|
||||
skip,
|
||||
take
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price lists or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceListProps](../../pricing/interfaces/pricing.FilterablePriceListProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price lists.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceListProps](../../pricing/interfaces/pricing.FilterablePriceListProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceListProps](../../pricing/interfaces/pricing.FilterablePriceListProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceListProps](../../pricing/interfaces/pricing.FilterablePriceListProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceListProps](../../pricing/interfaces/pricing.FilterablePriceListProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "ends_at",
|
||||
"type": "`string`[]",
|
||||
"description": "The end dates to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter price lists by",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number_rules",
|
||||
"type": "`number`[]",
|
||||
"description": "The number of rules to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "starts_at",
|
||||
"type": "`string`[]",
|
||||
"description": "The start dates to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[PriceListStatus](../../pricing/enums/pricing.PriceListStatus.mdx)[]",
|
||||
"description": "The statuses to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ACTIVE",
|
||||
"type": "`\"active\"`",
|
||||
"description": "The price list is enabled and its prices can be used.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "DRAFT",
|
||||
"type": "`\"draft\"`",
|
||||
"description": "The price list is disabled, meaning its prices can't be used yet.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)>",
|
||||
"description": "The configurations determining how the price lists are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price lists.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListDTO[]",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price list's details.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,329 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listPriceRules
|
||||
sidebar_label: listPriceRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listPriceRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listPriceRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price rules based on optional filters and configuration.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of price rules using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceRules (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceRules = await pricingService.listPriceRules({
|
||||
id: [id]
|
||||
})
|
||||
|
||||
// do something with the price rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price rules:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceRules (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceRules = await pricingService.listPriceRules({
|
||||
id: [id],
|
||||
}, {
|
||||
relations: ["price_set"]
|
||||
})
|
||||
|
||||
// do something with the price rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceRules (id: string, skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceRules = await pricingService.listPriceRules({
|
||||
id: [id],
|
||||
}, {
|
||||
relations: ["price_set"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceRules (ids: string[], name: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceRules = await pricingService.listPriceRules({
|
||||
$and: [
|
||||
{
|
||||
id: ids
|
||||
},
|
||||
{
|
||||
name
|
||||
}
|
||||
]
|
||||
}, {
|
||||
relations: ["price_set"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceRuleProps](../../pricing/interfaces/pricing.FilterablePriceRuleProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceRuleProps](../../pricing/interfaces/pricing.FilterablePriceRuleProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceRuleProps](../../pricing/interfaces/pricing.FilterablePriceRuleProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceRuleProps](../../pricing/interfaces/pricing.FilterablePriceRuleProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceRuleProps](../../pricing/interfaces/pricing.FilterablePriceRuleProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter price rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`[]",
|
||||
"description": "The names to filter price rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price rule's associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price rule's associated rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)>",
|
||||
"description": "The configurations determining how the price rule is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price rules.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceRuleDTO[]",
|
||||
"type": "[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceRuleDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price rule's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,329 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listPriceSetMoneyAmountRules
|
||||
sidebar_label: listPriceSetMoneyAmountRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listPriceSetMoneyAmountRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listPriceSetMoneyAmountRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price set money amount rules based on optional filters and configuration.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of price set money amount rules using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmountRules (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmountRules = await pricingService.listPriceSetMoneyAmountRules({
|
||||
id: [id]
|
||||
})
|
||||
|
||||
// do something with the price set money amount rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price set money amount rules:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmountRules (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmountRules = await pricingService.listPriceSetMoneyAmountRules({
|
||||
id: [id]
|
||||
}, {
|
||||
relations: ["price_set_money_amount"]
|
||||
})
|
||||
|
||||
// do something with the price set money amount rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmountRules (id: string, skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmountRules = await pricingService.listPriceSetMoneyAmountRules({
|
||||
id: [id]
|
||||
}, {
|
||||
relations: ["price_set_money_amount"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price set money amount rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmountRules (ids: string[], ruleTypeId: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmountRules = await pricingService.listPriceSetMoneyAmountRules({
|
||||
$and: [
|
||||
{
|
||||
id: ids
|
||||
},
|
||||
{
|
||||
rule_type_id: ruleTypeId
|
||||
}
|
||||
]
|
||||
}, {
|
||||
relations: ["price_set_money_amount"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price set money amount rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceSetMoneyAmountRulesProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountRulesProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price set money amount rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceSetMoneyAmountRulesProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountRulesProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetMoneyAmountRulesProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountRulesProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceSetMoneyAmountRulesProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountRulesProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetMoneyAmountRulesProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountRulesProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The ID to filter price set money amount rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price set money amount rule's associated price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price set money amount rule's associated rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`[]",
|
||||
"description": "The value to filter price set money amount rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)>",
|
||||
"description": "The configurations determining how the price set money amount rules are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price set money amount rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price set money amount rules.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetMoneyAmountRulesDTO[]",
|
||||
"type": "[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetMoneyAmountRulesDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price set money amount rule's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,320 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listPriceSetMoneyAmounts
|
||||
sidebar_label: listPriceSetMoneyAmounts
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listPriceSetMoneyAmounts - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listPriceSetMoneyAmounts` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of price set money amounts based on optional filters and configuration.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of price set money amounts using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmounts (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmounts = await pricingService.listPriceSetMoneyAmounts({
|
||||
id: [id]
|
||||
})
|
||||
|
||||
// do something with the price set money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the price set money amounts:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmounts (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmounts = await pricingService.listPriceSetMoneyAmounts({
|
||||
id: [id]
|
||||
}, {
|
||||
relations: ["price_rules"]
|
||||
})
|
||||
|
||||
// do something with the price set money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmounts (id: string, skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmounts = await pricingService.listPriceSetMoneyAmounts({
|
||||
id: [id]
|
||||
}, {
|
||||
relations: ["price_rules"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price set money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmounts (ids: string[], titles: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmounts = await pricingService.listPriceSetMoneyAmounts({
|
||||
$and: [
|
||||
{
|
||||
id: ids
|
||||
},
|
||||
{
|
||||
title: titles
|
||||
}
|
||||
]
|
||||
}, {
|
||||
relations: ["price_rules"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the price set money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterablePriceSetMoneyAmountProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved price set money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterablePriceSetMoneyAmountProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetMoneyAmountProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterablePriceSetMoneyAmountProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterablePriceSetMoneyAmountProps](../../pricing/interfaces/pricing.FilterablePriceSetMoneyAmountProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price set money amounts by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price set money amount's associated price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter the price set money amount's associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)>",
|
||||
"description": "The configurations determining how the price set money amounts are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of price set money amounts.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetMoneyAmountDTO[]",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetMoneyAmountDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price set money amount's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,326 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/listRuleTypes
|
||||
sidebar_label: listRuleTypes
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listRuleTypes - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `listRuleTypes` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a paginated list of rule types based on optional filters and configuration.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of rule types using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveRuleTypes (ruleTypeId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const ruleTypes = await pricingService.listRuleTypes({
|
||||
id: [
|
||||
ruleTypeId
|
||||
]
|
||||
})
|
||||
|
||||
// do something with the rule types or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify attributes that should be retrieved within the rule types:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveRuleTypes (ruleTypeId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const ruleTypes = await pricingService.listRuleTypes({
|
||||
id: [
|
||||
ruleTypeId
|
||||
]
|
||||
}, {
|
||||
select: ["name"]
|
||||
})
|
||||
|
||||
// do something with the rule types or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveRuleTypes (ruleTypeId: string, skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const ruleTypes = await pricingService.listRuleTypes({
|
||||
id: [
|
||||
ruleTypeId
|
||||
]
|
||||
}, {
|
||||
select: ["name"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the rule types or return them
|
||||
}
|
||||
```
|
||||
|
||||
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveRuleTypes (ruleTypeId: string[], name: string[], skip: number, take: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const ruleTypes = await pricingService.listRuleTypes({
|
||||
$and: [
|
||||
{
|
||||
id: ruleTypeId
|
||||
},
|
||||
{
|
||||
name
|
||||
}
|
||||
]
|
||||
}, {
|
||||
select: ["name"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the rule types or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "filters",
|
||||
"type": "[FilterableRuleTypeProps](../../pricing/interfaces/pricing.FilterableRuleTypeProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved rule types.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "$and",
|
||||
"type": "([FilterableRuleTypeProps](../../pricing/interfaces/pricing.FilterableRuleTypeProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableRuleTypeProps](../../pricing/interfaces/pricing.FilterableRuleTypeProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "$or",
|
||||
"type": "([FilterableRuleTypeProps](../../pricing/interfaces/pricing.FilterableRuleTypeProps.mdx) \\| [BaseFilterable](../../pricing/interfaces/pricing.BaseFilterable.mdx)<[FilterableRuleTypeProps](../../pricing/interfaces/pricing.FilterableRuleTypeProps.mdx)>)[]",
|
||||
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs to filter rule types by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`[]",
|
||||
"description": "The names to filter rule types by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`[]",
|
||||
"description": "The rule attributes to filter rule types by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)>",
|
||||
"description": "The configurations determining how the rule types are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of rule types.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "RuleTypeDTO[]",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "RuleTypeDTO",
|
||||
"type": "`object`",
|
||||
"description": "A rule type's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,513 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/removePriceListRules
|
||||
sidebar_label: removePriceListRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# removePriceListRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `removePriceListRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to remove rules from a price list.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function setPriceListRules (priceListId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceList = await pricingService.removePriceListRules({
|
||||
priceListId,
|
||||
rules: ["region_id"]
|
||||
})
|
||||
|
||||
// do something with the price list or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[RemovePriceListRulesDTO](../../pricing/interfaces/pricing.RemovePriceListRulesDTO.mdx)",
|
||||
"description": "The rules to remove from a price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "priceListId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price list to remove rules from.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "`string`[]",
|
||||
"description": "The rules to remove from the price list. Each item being a rule type's `rule_attribute`.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The updated price lists.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ends_at",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The price list expires after this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amounts",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"description": "The associated money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The price of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)",
|
||||
"description": "The money amount's currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The maximum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The minimum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)",
|
||||
"description": "The details of the relation between the money amount and its associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "number_rules",
|
||||
"type": "`number`",
|
||||
"description": "The number of rules associated with this price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_rules",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"description": "The price set's rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list rule's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The associated price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_rule_values",
|
||||
"type": "[PriceListRuleValueDTO](../../pricing/interfaces/pricing.PriceListRuleValueDTO.mdx)[]",
|
||||
"description": "The associated rule values.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)",
|
||||
"description": "The associated rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amounts",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)[]",
|
||||
"description": "The associated price set money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a price set money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amount",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)",
|
||||
"description": "The money amount associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The price list associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_rules",
|
||||
"type": "[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]",
|
||||
"description": "The price rules associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set",
|
||||
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)",
|
||||
"description": "The price set associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The title of the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule_types",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"description": "The associated rule types.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"description": "The price set's rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list rule's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The associated price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_rule_values",
|
||||
"type": "[PriceListRuleValueDTO](../../pricing/interfaces/pricing.PriceListRuleValueDTO.mdx)[]",
|
||||
"description": "The associated rule values.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)",
|
||||
"description": "The associated rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "starts_at",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The price list is enabled starting from this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[PriceListStatus](../../pricing/enums/pricing.PriceListStatus.mdx)",
|
||||
"description": "The price list's status.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ACTIVE",
|
||||
"type": "`\"active\"`",
|
||||
"description": "The price list is enabled and its prices can be used.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "DRAFT",
|
||||
"type": "`\"draft\"`",
|
||||
"description": "The price list is disabled, meaning its prices can't be used yet.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The price list's title.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,137 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/removeRules
|
||||
sidebar_label: removeRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# removeRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `removeRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method remove rules from a price set.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function removePriceSetRule (priceSetId: string, ruleAttributes: []) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
await pricingService.removeRules([
|
||||
{
|
||||
id: priceSetId,
|
||||
rules: ruleAttributes
|
||||
},
|
||||
])
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[RemovePriceSetRulesDTO](../../pricing/interfaces/pricing.RemovePriceSetRulesDTO.mdx)[]",
|
||||
"description": "The rules to remove per price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "`string`[]",
|
||||
"description": "The rules to remove. Each string is the `rule_attribute` of a rule to remove.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when rules are successfully removed.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,333 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/retrieve
|
||||
sidebar_label: retrieve
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrieve - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrieve` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a price set by its ID.
|
||||
|
||||
## Example
|
||||
|
||||
A simple example that retrieves a price set by its ID:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSet (priceSetId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSet = await pricingService.retrieve(
|
||||
priceSetId
|
||||
)
|
||||
|
||||
// do something with the price set or return it
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSet (priceSetId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSet = await pricingService.retrieve(
|
||||
priceSetId,
|
||||
{
|
||||
relations: ["money_amounts"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price set or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set to retrieve.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)>",
|
||||
"description": "The configurations determining how the price set is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The retrieved price set.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amounts",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"description": "The prices that belong to this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The price of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)",
|
||||
"description": "The money amount's currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The maximum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The minimum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)",
|
||||
"description": "The details of the relation between the money amount and its associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule_types",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"description": "The rule types applied on this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,241 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/retrieveCurrency
|
||||
sidebar_label: retrieveCurrency
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrieveCurrency - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrieveCurrency` method. This belongs to the Pricing Module.
|
||||
|
||||
This method retrieves a currency by its code and and optionally based on the provided configurations.
|
||||
|
||||
## Example
|
||||
|
||||
A simple example that retrieves a currency by its code:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveCurrency (code: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const currency = await pricingService.retrieveCurrency(
|
||||
code
|
||||
)
|
||||
|
||||
// do something with the currency or return it
|
||||
}
|
||||
```
|
||||
|
||||
To specify attributes that should be retrieved:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveCurrency (code: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const currency = await pricingService.retrieveCurrency(
|
||||
code,
|
||||
{
|
||||
select: ["symbol_native"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the currency or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "The code of the currency to retrieve.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)>",
|
||||
"description": "The configurations determining how the currency is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The retrieved currency.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "The code of the currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The name of the currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol",
|
||||
"type": "`string`",
|
||||
"description": "The symbol of the currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol_native",
|
||||
"type": "`string`",
|
||||
"description": "The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,369 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/retrieveMoneyAmount
|
||||
sidebar_label: retrieveMoneyAmount
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrieveMoneyAmount - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrieveMoneyAmount` method. This belongs to the Pricing Module.
|
||||
|
||||
This method retrieves a money amount by its ID.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a money amount by its ID:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveMoneyAmount (moneyAmountId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const moneyAmount = await pricingService.retrieveMoneyAmount(
|
||||
moneyAmountId,
|
||||
)
|
||||
|
||||
// do something with the money amount or return it
|
||||
}
|
||||
```
|
||||
|
||||
To retrieve relations along with the money amount:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveMoneyAmount (moneyAmountId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const moneyAmount = await pricingService.retrieveMoneyAmount(
|
||||
moneyAmountId,
|
||||
{
|
||||
relations: ["currency"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the money amount or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount to retrieve.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)>",
|
||||
"description": "The configurations determining how a money amount is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The retrieved money amount.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The price of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)",
|
||||
"description": "The money amount's currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "The code of the currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The name of the currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol",
|
||||
"type": "`string`",
|
||||
"description": "The symbol of the currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol_native",
|
||||
"type": "`string`",
|
||||
"description": "The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The maximum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The minimum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)",
|
||||
"description": "The details of the relation between the money amount and its associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a price set money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amount",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)",
|
||||
"description": "The money amount associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The price list associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_rules",
|
||||
"type": "[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]",
|
||||
"description": "The price rules associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set",
|
||||
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)",
|
||||
"description": "The price set associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The title of the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,580 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/retrievePriceList
|
||||
sidebar_label: retrievePriceList
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrievePriceList - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrievePriceList` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a price list by its ID.
|
||||
|
||||
## Example
|
||||
|
||||
A simple example that retrieves a price list by its ID:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceList (priceListId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceList = await pricingService.retrievePriceList(
|
||||
priceListId
|
||||
)
|
||||
|
||||
// do something with the price list or return it
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceList (priceListId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceList = await pricingService.retrievePriceList(
|
||||
priceListId,
|
||||
{
|
||||
relations: ["price_set_money_amounts"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price list or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price list to retrieve.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)>",
|
||||
"description": "The configurations determining how the price list is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The retrieved price list.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ends_at",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The price list expires after this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amounts",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"description": "The associated money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The price of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)",
|
||||
"description": "The money amount's currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The maximum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The minimum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)",
|
||||
"description": "The details of the relation between the money amount and its associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "number_rules",
|
||||
"type": "`number`",
|
||||
"description": "The number of rules associated with this price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_rules",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"description": "The price set's rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list rule's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The associated price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_rule_values",
|
||||
"type": "[PriceListRuleValueDTO](../../pricing/interfaces/pricing.PriceListRuleValueDTO.mdx)[]",
|
||||
"description": "The associated rule values.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)",
|
||||
"description": "The associated rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amounts",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)[]",
|
||||
"description": "The associated price set money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a price set money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amount",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)",
|
||||
"description": "The money amount associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The price list associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_rules",
|
||||
"type": "[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]",
|
||||
"description": "The price rules associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set",
|
||||
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)",
|
||||
"description": "The price set associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The title of the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule_types",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"description": "The associated rule types.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"description": "The price set's rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list rule's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The associated price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_rule_values",
|
||||
"type": "[PriceListRuleValueDTO](../../pricing/interfaces/pricing.PriceListRuleValueDTO.mdx)[]",
|
||||
"description": "The associated rule values.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)",
|
||||
"description": "The associated rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "starts_at",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The price list is enabled starting from this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[PriceListStatus](../../pricing/enums/pricing.PriceListStatus.mdx)",
|
||||
"description": "The price list's status.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ACTIVE",
|
||||
"type": "`\"active\"`",
|
||||
"description": "The price list is enabled and its prices can be used.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "DRAFT",
|
||||
"type": "`\"draft\"`",
|
||||
"description": "The price list is disabled, meaning its prices can't be used yet.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The price list's title.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,415 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/retrievePriceListRule
|
||||
sidebar_label: retrievePriceListRule
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrievePriceListRule - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrievePriceListRule` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a price list rule by its ID.
|
||||
|
||||
## Example
|
||||
|
||||
A simple example that retrieves a price list rule by its ID:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceListRule (priceListRuleId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceListRule = await pricingService.retrievePriceListRule(
|
||||
priceListRuleId
|
||||
)
|
||||
|
||||
// do something with the price list rule or return it
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceListRule (priceListRuleId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceListRule = await pricingService.retrievePriceListRule(
|
||||
priceListRuleId,
|
||||
{
|
||||
relations: ["price_list"]
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the price list rule or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price list rule to retrieve.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)>",
|
||||
"description": "The configurations determining how the price list rule is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price list rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The retrieved price list rule.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list rule's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The associated price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "ends_at",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The price list expires after this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amounts",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"description": "The associated money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number_rules",
|
||||
"type": "`number`",
|
||||
"description": "The number of rules associated with this price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_rules",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"description": "The price set's rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amounts",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)[]",
|
||||
"description": "The associated price set money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_types",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"description": "The associated rule types.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"description": "The price set's rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "starts_at",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The price list is enabled starting from this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[PriceListStatus](../../pricing/enums/pricing.PriceListStatus.mdx)",
|
||||
"description": "The price list's status.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The price list's title.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "price_list_rule_values",
|
||||
"type": "[PriceListRuleValueDTO](../../pricing/interfaces/pricing.PriceListRuleValueDTO.mdx)[]",
|
||||
"description": "The associated rule values.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list rule value's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_rule",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)",
|
||||
"description": "The associated price list rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The rule's value.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)",
|
||||
"description": "The associated rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,346 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/retrievePriceRule
|
||||
sidebar_label: retrievePriceRule
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrievePriceRule - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrievePriceRule` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a price rule by its ID.
|
||||
|
||||
## Example
|
||||
|
||||
A simple example that retrieves a price rule by its ID:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceRule (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceRule = await pricingService.retrievePriceRule(id)
|
||||
|
||||
// do something with the price rule or return it
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceRule (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceRule = await pricingService.retrievePriceRule(id, {
|
||||
relations: ["price_set"]
|
||||
})
|
||||
|
||||
// do something with the price rule or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price rule to retrieve.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)>",
|
||||
"description": "The configurations determining how the price rule is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The retrieved price rule.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set",
|
||||
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)",
|
||||
"description": "The associated price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amounts",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"description": "The prices that belong to this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_types",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"description": "The rule types applied on this price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price set money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the price rule in comparison to other applicable price rules.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)",
|
||||
"description": "The associated rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule_type_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the price rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,337 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/retrievePriceSetMoneyAmountRules
|
||||
sidebar_label: retrievePriceSetMoneyAmountRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrievePriceSetMoneyAmountRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrievePriceSetMoneyAmountRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to a price set money amount rule by its ID based on the provided configuration.
|
||||
|
||||
## Example
|
||||
|
||||
A simple example that retrieves a price set money amount rule by its ID:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmountRule (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmountRule = await pricingService.retrievePriceSetMoneyAmountRules(id)
|
||||
|
||||
// do something with the price set money amount rule or return it
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrievePriceSetMoneyAmountRule (id: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmountRule = await pricingService.retrievePriceSetMoneyAmountRules(id, {
|
||||
relations: ["price_set_money_amount"]
|
||||
})
|
||||
|
||||
// do something with the price set money amount rule or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set money amount rule to retrieve.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)>",
|
||||
"description": "The configurations determining how the price set money amount rule is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price set money amount rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The retrieved price set money amount rule.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)",
|
||||
"description": "The associated price set money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a price set money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amount",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)",
|
||||
"description": "The money amount associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The price list associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_rules",
|
||||
"type": "[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]",
|
||||
"description": "The price rules associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set",
|
||||
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)",
|
||||
"description": "The price set associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The title of the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)",
|
||||
"description": "The associated rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the price set money amount rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,236 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/retrieveRuleType
|
||||
sidebar_label: retrieveRuleType
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrieveRuleType - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrieveRuleType` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to retrieve a rule type by its ID and and optionally based on the provided configurations.
|
||||
|
||||
## Example
|
||||
|
||||
A simple example that retrieves a rule type by its code:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveRuleType (ruleTypeId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const ruleType = await pricingService.retrieveRuleType(ruleTypeId)
|
||||
|
||||
// do something with the rule type or return it
|
||||
}
|
||||
```
|
||||
|
||||
To specify attributes that should be retrieved:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function retrieveRuleType (ruleTypeId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const ruleType = await pricingService.retrieveRuleType(ruleTypeId, {
|
||||
select: ["name"]
|
||||
})
|
||||
|
||||
// do something with the rule type or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type to retrieve.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)<[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)>",
|
||||
"description": "The configurations determining how the rule type is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The retrieved rule type.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,515 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/setPriceListRules
|
||||
sidebar_label: setPriceListRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# setPriceListRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `setPriceListRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to set the rules of a price list.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function setPriceListRules (priceListId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceList = await pricingService.setPriceListRules({
|
||||
priceListId,
|
||||
rules: {
|
||||
region_id: "US"
|
||||
}
|
||||
})
|
||||
|
||||
// do something with the price list or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[SetPriceListRulesDTO](../../pricing/interfaces/pricing.SetPriceListRulesDTO.mdx)",
|
||||
"description": "The rules to set for a price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "priceListId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price list to add rules to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "`Record<string, string \\| string[]>`",
|
||||
"description": "The rules to add to the price list. Each key of the object is a rule type's `rule_attribute`, and its value\nis the value(s) of the rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The updated price lists.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ends_at",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The price list expires after this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amounts",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"description": "The associated money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The price of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)",
|
||||
"description": "The money amount's currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The currency code of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The maximum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The minimum quantity required to be purchased for this price to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)",
|
||||
"description": "The details of the relation between the money amount and its associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "number_rules",
|
||||
"type": "`number`",
|
||||
"description": "The number of rules associated with this price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_rules",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"description": "The price set's rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list rule's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The associated price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_rule_values",
|
||||
"type": "[PriceListRuleValueDTO](../../pricing/interfaces/pricing.PriceListRuleValueDTO.mdx)[]",
|
||||
"description": "The associated rule values.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)",
|
||||
"description": "The associated rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amounts",
|
||||
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)[]",
|
||||
"description": "The associated price set money amounts.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a price set money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "money_amount",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)",
|
||||
"description": "The money amount associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The price list associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_rules",
|
||||
"type": "[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]",
|
||||
"description": "The price rules associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set",
|
||||
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)",
|
||||
"description": "The price set associated with the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price set.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The title of the price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule_types",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"description": "The associated rule types.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"description": "The price set's rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The price list rule's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
|
||||
"description": "The associated price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_rule_values",
|
||||
"type": "[PriceListRuleValueDTO](../../pricing/interfaces/pricing.PriceListRuleValueDTO.mdx)[]",
|
||||
"description": "The associated rule values.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)",
|
||||
"description": "The associated rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "starts_at",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The price list is enabled starting from this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[PriceListStatus](../../pricing/enums/pricing.PriceListStatus.mdx)",
|
||||
"description": "The price list's status.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ACTIVE",
|
||||
"type": "`\"active\"`",
|
||||
"description": "The price list is enabled and its prices can be used.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "DRAFT",
|
||||
"type": "`\"draft\"`",
|
||||
"description": "The price list is disabled, meaning its prices can't be used yet.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The price list's title.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,177 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/updateCurrencies
|
||||
sidebar_label: updateCurrencies
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# updateCurrencies - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `updateCurrencies` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to update existing currencies with the provided data. In each currency object, the currency code must be provided to identify which currency to update.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function updateCurrencies () {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const currencies = await pricingService.updateCurrencies([
|
||||
{
|
||||
code: "USD",
|
||||
symbol: "$",
|
||||
}
|
||||
])
|
||||
|
||||
// do something with the currencies or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[UpdateCurrencyDTO](../../pricing/interfaces/pricing.UpdateCurrencyDTO.mdx)[]",
|
||||
"description": "The currencies to update, each having the attributes that should be updated in a currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "The code of the currency to update.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The name of the currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol",
|
||||
"type": "`string`",
|
||||
"description": "The symbol of the currency.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol_native",
|
||||
"type": "`string`",
|
||||
"description": "The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of updated currencies.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "CurrencyDTO[]",
|
||||
"type": "[CurrencyDTO](../../pricing/interfaces/pricing.CurrencyDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "CurrencyDTO",
|
||||
"type": "`object`",
|
||||
"description": "A currency's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,186 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/updateMoneyAmounts
|
||||
sidebar_label: updateMoneyAmounts
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# updateMoneyAmounts - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `updateMoneyAmounts` method. This belongs to the Pricing Module.
|
||||
|
||||
This method updates existing money amounts.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function updateMoneyAmounts (moneyAmountId: string, amount: number) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const moneyAmounts = await pricingService.updateMoneyAmounts([
|
||||
{
|
||||
id: moneyAmountId,
|
||||
amount
|
||||
}
|
||||
])
|
||||
|
||||
// do something with the money amounts or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[UpdateMoneyAmountDTO](../../pricing/interfaces/pricing.UpdateMoneyAmountDTO.mdx)[]",
|
||||
"description": "The money amounts to update, each having the attributes that should be updated in a money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The price of this money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The code of the currency to associate with the money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the money amount to update.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of updated money amounts.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "MoneyAmountDTO[]",
|
||||
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "MoneyAmountDTO",
|
||||
"type": "`object`",
|
||||
"description": "A money amount's data. A money amount represents a price.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,185 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/updatePriceListRules
|
||||
sidebar_label: updatePriceListRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# updatePriceListRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `updatePriceListRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to update price list rules.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function updatePriceListRules (items: {
|
||||
id: string
|
||||
rule_type_id?: string
|
||||
price_list_id?: string
|
||||
}[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceListRules = await pricingService.updatePriceListRules(items)
|
||||
|
||||
// do something with the price list rule or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[UpdatePriceListRuleDTO](../../pricing/interfaces/pricing.UpdatePriceListRuleDTO.mdx)[]",
|
||||
"description": "The attributes to update for each price list rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price list rule to update.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a price list to be associated with the price list rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a price list to be associated with the price list rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a rule type or the details of an existing rule type to be associated with the price list rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a rule type to be associated with the price list rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The updated price list rules.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListRuleDTO[]",
|
||||
"type": "[PriceListRuleDTO](../../pricing/interfaces/pricing.PriceListRuleDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListRuleDTO",
|
||||
"type": "`object`",
|
||||
"description": "The price list rule's details.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,224 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/updatePriceLists
|
||||
sidebar_label: updatePriceLists
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# updatePriceLists - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `updatePriceLists` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to update price lists.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function updatePriceLists (items: {
|
||||
id: string
|
||||
title: string
|
||||
description: string
|
||||
starts_at?: string
|
||||
ends_at?: string
|
||||
}[]) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceList = await pricingService.updatePriceLists(items)
|
||||
|
||||
// do something with the price lists or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[UpdatePriceListDTO](../../pricing/interfaces/pricing.UpdatePriceListDTO.mdx)[]",
|
||||
"description": "The attributes to update in each price list.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ends_at",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The price list expires after this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price list to update.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number_rules",
|
||||
"type": "`number`",
|
||||
"description": "The number of rules associated with the price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rules",
|
||||
"type": "[CreatePriceListRules](../../pricing/interfaces/pricing.CreatePriceListRules.mdx)",
|
||||
"description": "The rules to be created and associated with the price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "starts_at",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The price list is enabled starting from this date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[PriceListStatus](../../pricing/enums/pricing.PriceListStatus.mdx)",
|
||||
"description": "The price list's status.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ACTIVE",
|
||||
"type": "`\"active\"`",
|
||||
"description": "The price list is enabled and its prices can be used.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "DRAFT",
|
||||
"type": "`\"draft\"`",
|
||||
"description": "The price list is disabled, meaning its prices can't be used yet.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The price list's title.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The updated price lists.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListDTO[]",
|
||||
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceListDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price list's details.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,207 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/updatePriceRules
|
||||
sidebar_label: updatePriceRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# updatePriceRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `updatePriceRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to update price rules, each with their provided data.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function updatePriceRules (
|
||||
id: string,
|
||||
priceSetId: string,
|
||||
) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceRules = await pricingService.updatePriceRules([
|
||||
{
|
||||
id,
|
||||
price_set_id: priceSetId,
|
||||
}
|
||||
])
|
||||
|
||||
// do something with the price rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[UpdatePriceRuleDTO](../../pricing/interfaces/pricing.UpdatePriceRuleDTO.mdx)[]",
|
||||
"description": "The price rules to update, each having attributes that should be updated in a price rule.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price list.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the price rule in comparison to other applicable price rules.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the price rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of updated price rules.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceRuleDTO[]",
|
||||
"type": "[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceRuleDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price rule's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,177 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/updatePriceSetMoneyAmountRules
|
||||
sidebar_label: updatePriceSetMoneyAmountRules
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# updatePriceSetMoneyAmountRules - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `updatePriceSetMoneyAmountRules` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to update price set money amount rules, each with their provided data.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function updatePriceSetMoneyAmountRules (id: string, value: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const priceSetMoneyAmountRules = await pricingService.updatePriceSetMoneyAmountRules([
|
||||
{
|
||||
id,
|
||||
value
|
||||
}
|
||||
])
|
||||
|
||||
// do something with the price set money amount rules or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[UpdatePriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.UpdatePriceSetMoneyAmountRulesDTO.mdx)[]",
|
||||
"description": "The price set money amounts to update, each having the attributes to update in a price set money amount.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the price set money amount rule to update.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_set_money_amount",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a price set money amount.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_type",
|
||||
"type": "`string`",
|
||||
"description": "The ID of a rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value of the price set money amount rule.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of updated price set money amount rules.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetMoneyAmountRulesDTO[]",
|
||||
"type": "[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "PriceSetMoneyAmountRulesDTO",
|
||||
"type": "`object`",
|
||||
"description": "A price set money amount rule's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,177 @@
|
||||
---
|
||||
displayed_sidebar: pricingReference
|
||||
badge:
|
||||
variant: orange
|
||||
text: Beta
|
||||
slug: /references/pricing/updateRuleTypes
|
||||
sidebar_label: updateRuleTypes
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# updateRuleTypes - Pricing Module Reference
|
||||
|
||||
This documentation provides a reference to the `updateRuleTypes` method. This belongs to the Pricing Module.
|
||||
|
||||
This method is used to update existing rule types with the provided data.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializePricingModule,
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
async function updateRuleTypes (ruleTypeId: string) {
|
||||
const pricingService = await initializePricingModule()
|
||||
|
||||
const ruleTypes = await pricingService.updateRuleTypes([
|
||||
{
|
||||
id: ruleTypeId,
|
||||
name: "Region",
|
||||
}
|
||||
])
|
||||
|
||||
// do something with the rule types or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[UpdateRuleTypeDTO](../../pricing/interfaces/pricing.UpdateRuleTypeDTO.mdx)[]",
|
||||
"description": "The rule types to update, each having the attributes that should be updated in a rule type.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "default_priority",
|
||||
"type": "`number`",
|
||||
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy the provided context. The higher the value, the higher the priority of the rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the rule type to update.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The display name of the rule type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_attribute",
|
||||
"type": "`string`",
|
||||
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of the `calculatePrices` method to specify a rule for calculating the price.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sharedContext",
|
||||
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "enableNestedTransactions",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean value indicating whether nested transactions are enabled.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationLevel",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionId",
|
||||
"type": "`string`",
|
||||
"description": "A string indicating the ID of the current transaction.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`TManager`",
|
||||
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of updated rule types.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "RuleTypeDTO[]",
|
||||
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "RuleTypeDTO",
|
||||
"type": "`object`",
|
||||
"description": "A rule type's data.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
Reference in New Issue
Block a user