docs: generate pricing module reference (#5349)

* docs: generate pricing module reference

* added notes about new configurations
This commit is contained in:
Shahed Nasser
2023-10-11 14:08:19 +03:00
committed by GitHub
parent 9c1c19f409
commit f0af8ecc89
110 changed files with 7170 additions and 146 deletions

View File

@@ -10,40 +10,46 @@ module.exports = ({
tsconfigPath = "",
moduleName = "",
documentsToFormat = [],
additionalFormatting = {},
extraOptions = {},
}) => {
const formatting = {}
documentsToFormat.forEach((document) => {
formatting[document] = {
reflectionTitle: {
kind: false,
typeParameters: false,
suffix: "Reference",
},
expandMembers: true,
showCommentsAsHeader: true,
parameterStyle: "list",
useTsLinkResolution: false,
showReturnSignature: false,
sections: {
reflection_typeParameters: false,
member_declaration_typeParameters: false,
reflection_implements: false,
reflection_implementedBy: false,
reflection_callable: false,
reflection_indexable: false,
member_signature_typeParameters: false,
member_signature_sources: false,
member_signature_title: false,
},
reflectionGroups: {
Constructors: false,
Properties: false,
},
...additionalFormatting,
documentsToFormat.forEach(
({ pattern, additionalFormatting, useDefaults = false }) => {
formatting[pattern] = {
...(!useDefaults
? {
reflectionTitle: {
kind: false,
typeParameters: false,
suffix: "Reference",
},
expandMembers: true,
showCommentsAsHeader: true,
parameterStyle: "list",
useTsLinkResolution: false,
showReturnSignature: false,
sections: {
reflection_typeParameters: false,
member_declaration_typeParameters: false,
reflection_implements: false,
reflection_implementedBy: false,
reflection_callable: false,
reflection_indexable: false,
member_signature_typeParameters: false,
member_signature_sources: false,
member_signature_title: false,
title_reflectionPath: false,
},
reflectionGroups: {
Constructors: false,
Properties: false,
},
}
: {}),
...additionalFormatting,
}
}
})
)
return {
...globalTypedocOptions,
entryPoints: [path.join(pathPrefix, entryPointPath)],
@@ -66,6 +72,7 @@ module.exports = ({
],
hideMembersSymbol: true,
formatting,
allReflectionsHaveOwnDocument: true,
...extraOptions,
}
}

View File

@@ -5,14 +5,62 @@ module.exports = modulesConfig({
entryPointPath: "packages/types/src/pricing/service.ts",
outPath: "www/apps/docs/content/references/pricing",
moduleName: "Pricing Module Reference",
documentsToFormat: ["IPricingModuleService"],
additionalFormatting: {
reflectionDescription:
"This document provides a reference to the `IPricingModuleService` interfaces methods. This is the interface developers use to use the functionalities provided by the Pricing Module.",
},
extraOptions: {
frontmatterData: {
displayed_sidebar: "modules",
documentsToFormat: [
{
pattern: "IPricingModuleService.md",
additionalFormatting: {
reflectionDescription:
"This section of the documentation provides a reference to the `IPricingModuleService` interfaces methods. This is the interface developers use to use the functionalities provided by the Pricing Module.",
frontmatterData: {
displayed_sidebar: "pricingReference",
badge: {
variant: "orange",
text: "Beta",
},
slug: "/references/pricing",
// hide_table_of_contents: true,
},
},
},
{
pattern: "IPricingModuleService/methods",
additionalFormatting: {
reflectionDescription:
"This documentation provides a reference to the {{alias}} {{kind}}. This belongs to the Pricing Module.",
frontmatterData: {
displayed_sidebar: "pricingReference",
badge: {
variant: "orange",
text: "Beta",
},
slug: "/references/pricing/{{alias}}",
sidebar_label: "{{alias}}",
},
reflectionTitle: {
kind: false,
typeParameters: false,
suffix: "- Pricing Module Reference",
},
},
},
{
pattern: "*",
useDefaults: true,
additionalFormatting: {
frontmatterData: {
displayed_sidebar: "pricingReference",
},
},
},
],
extraOptions: {
// frontmatterData: {
// displayed_sidebar: "modules",
// badge: {
// variant: "orange",
// text: "Beta",
// },
// // hide_table_of_contents: true,
// },
},
})

View File

@@ -2,6 +2,8 @@
A Typedoc plugin that allows inserting frontmatter key-value pairs at the top of the exported Markdown files.
> For more flexibility in what pages to apply the frontmatter data to, for example, to specify different frontmatter for different pages, ues the [`typedoc-plugin-markdown-medusa` plugin's `frontmatterData` option](../typedoc-plugin-markdown-medusa/README.md#configurations)
## Configurations
The following options are optional and can be used to customize the configurations of the plugin.

View File

@@ -30,5 +30,8 @@
"packages",
"monorepo",
"typedoc"
]
],
"dependencies": {
"yaml": "^2.3.2"
}
}

View File

@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Application, PageEvent, ParameterType } from "typedoc"
import { stringify } from "yaml"
export function load(app: Application) {
app.options.addDeclaration({
@@ -35,20 +36,15 @@ export function load(app: Application) {
if (typeof frontmatterData === "string") {
frontmatterData = JSON.parse(frontmatterData)
}
const frontmatterDataEntries = Object.entries(frontmatterData)
if (!frontmatterDataEntries.length || !pattern.test(page.filename)) {
if (!pattern.test(page.filename) || !Object.keys(frontmatterData).length) {
return
}
let frontmatterStr = `---\n`
const frontmatterStr = stringify(frontmatterData)
for (const [key, value] of frontmatterDataEntries) {
frontmatterStr += `${key}: ${value}\n`
if (frontmatterStr.length) {
page.contents = `---\n` + frontmatterStr + `---\n\n` + page.contents
}
frontmatterStr += `---\n\n`
page.contents = frontmatterStr + page.contents
})
}

View File

@@ -16,8 +16,11 @@ Aside from the options detailed in [typedoc-plugin-markdown](https://github.com/
- `reflectionDescription`: (optional) a string used to add description in a documentation page after the page's title.
- `expandMembers`: (optional) a boolean indicating whether members in a page should be expanded. When enabled, the member titles (for example, `Methods`) are removed and the heading level of nested titles whithin the member is elevated by `1`.
- `showCommentAsHeader`: (optional) a boolean indicating whether comments, for example, a method's name, are represented as headers.
- `showCommentsAsDetails`: (optional) a boolean indicating whether comments, for example, a method's name, are represented as details component.
- `parameterStyle`: (optional) a string indicating how parameters are displayed. Its value can be `table` (default) or `list`.
- `showReturnSignature`: (optional) a boolean indicating whether to show the signature for returned values.
- `frontmatterData`: (optional) an object that will be injected as frontmatter to the pages matching specified pattern.
-
## Build Plugin

View File

@@ -32,6 +32,7 @@
"typedoc"
],
"dependencies": {
"handlebars": "^4.7.8"
"handlebars": "^4.7.8",
"yaml": "^2.3.2"
}
}

View File

@@ -35,6 +35,8 @@ import typeParameterHelper from "./resources/helpers/type-parameter"
import parameterListHelper from "./resources/helpers/parameter-list"
import parameterHelper from "./resources/helpers/parameter"
import debugHelper from "./resources/helpers/debug"
import frontmatterHelper from "./resources/helpers/frontmatter"
import reflectionDescriptionHelper from "./resources/helpers/reflection-description"
import { MarkdownTheme } from "./theme"
const TEMPLATE_PATH = path.join(__dirname, "resources", "templates")
@@ -98,4 +100,6 @@ export function registerHelpers(theme: MarkdownTheme) {
parameterListHelper()
parameterHelper(theme)
debugHelper()
frontmatterHelper(theme)
reflectionDescriptionHelper(theme)
}

View File

@@ -13,7 +13,8 @@ export default function (theme: MarkdownTheme) {
commentLevel = 4,
parent = null
) {
const { showCommentsAsHeader } = theme.getFormattingOptionsForLocation()
const { showCommentsAsHeader, showCommentsAsDetails } =
theme.getFormattingOptionsForLocation()
const md: string[] = []
if (showSummary && comment.summary) {
@@ -26,16 +27,19 @@ export default function (theme: MarkdownTheme) {
if (showTags && comment.blockTags?.length) {
const tags = filteredTags.map((tag) => {
return `${
showCommentsAsHeader
? `${Handlebars.helpers.titleLevel.call(
parent || comment,
commentLevel
)} `
: "**`"
}${camelToTitleCase(tag.tag.substring(1))}${
showCommentsAsHeader ? "" : "`**"
}\n\n${Handlebars.helpers.comment(tag.content)}`
const tagTitle = camelToTitleCase(tag.tag.substring(1)),
tagContent = Handlebars.helpers.comment(tag.content)
if (showCommentsAsHeader) {
return `${Handlebars.helpers.titleLevel.call(
parent || comment,
commentLevel
)} ${tagTitle}\n\n${tagContent}`
} else if (showCommentsAsDetails) {
return `<details>\n<summary>\n${tagTitle}\n</summary>\n\n${tagContent}\n\n</details>`
} else {
return `**${tagTitle}**\n\n${tagContent}`
}
})
md.push(tags.join("\n\n"))
}

View File

@@ -0,0 +1,47 @@
import * as Handlebars from "handlebars"
import { MarkdownTheme } from "../../theme"
import { stringify } from "yaml"
import { replaceTemplateVariables } from "../../utils/reflection-template-strings"
import { Reflection } from "typedoc"
export default function (theme: MarkdownTheme) {
Handlebars.registerHelper("frontmatter", function (this: Reflection) {
const { frontmatterData } = theme.getFormattingOptionsForLocation()
if (!frontmatterData) {
return ""
}
// format frontmatter data in case it has any template variables
return `---\n${stringify(
resolveFrontmatterVariables(frontmatterData, this)
).trim()}\n---\n\n`
})
}
function resolveFrontmatterVariables(
frontmatterData: Record<string, unknown>,
reflection: Reflection
): Record<string, unknown> {
const tempFrontmatterData = Object.assign({}, frontmatterData)
Object.keys(tempFrontmatterData).forEach((key) => {
const value = tempFrontmatterData[key]
if (!value) {
return
}
switch (typeof value) {
case "object":
tempFrontmatterData[key] = resolveFrontmatterVariables(
value as Record<string, unknown>,
reflection
)
break
case "string":
tempFrontmatterData[key] = replaceTemplateVariables(reflection, value)
}
})
return tempFrontmatterData
}

View File

@@ -0,0 +1,16 @@
import * as Handlebars from "handlebars"
import { MarkdownTheme } from "../../theme"
import { Reflection } from "typedoc"
import { replaceTemplateVariables } from "../../utils/reflection-template-strings"
export default function (theme: MarkdownTheme) {
Handlebars.registerHelper(
"reflectionDescription",
function (this: Reflection) {
const { reflectionDescription } = theme.getFormattingOptionsForLocation()
// parse variables in description
return replaceTemplateVariables(this, reflectionDescription)
}
)
}

View File

@@ -9,6 +9,12 @@ export default function (theme: MarkdownTheme) {
const { expandMembers, sections } =
theme.getFormattingOptionsForLocation()
if (!expandMembers) {
return Array(originalLevel).fill("#").join("")
}
const { allReflectionsHaveOwnDocument } = theme
let isSignatureChild = false
if (
sections &&
@@ -22,8 +28,15 @@ export default function (theme: MarkdownTheme) {
(this.parent.signatures as SignatureReflection[]).length > 1
}
const level =
expandMembers && !isSignatureChild ? originalLevel - 1 : originalLevel
const numberToSubtract = allReflectionsHaveOwnDocument
? isSignatureChild
? 1
: 2
: isSignatureChild
? 0
: 1
const level = originalLevel - numberToSubtract
return Array(level).fill("#").join("")
}

View File

@@ -4,7 +4,11 @@
{{/ifShowPageTitle}}
{{{getFormattingOption "reflectionDescription"}}}
{{#with model}}
{{{reflectionDescription}}}
{{/with}}
{{#if (sectionEnabled "title_reflectionPath")}}

View File

@@ -1,3 +1,9 @@
{{#with model}}
{{{frontmatter}}}
{{/with}}
{{> header}}
{{#with model.readme}}

View File

@@ -1,3 +1,9 @@
{{#with model}}
{{{frontmatter}}}
{{/with}}
{{> header}}
{{> title}}

View File

@@ -1,3 +1,9 @@
{{#with model}}
{{{frontmatter}}}
{{/with}}
{{> header}}
{{> title}}

View File

@@ -13,7 +13,6 @@ import {
Theme,
UrlMapping,
} from "typedoc"
import { getKindPlural } from "./groups"
import {
indexTemplate,
reflectionMemberTemplate,
@@ -26,7 +25,6 @@ import {
FormattingOptionType,
FormattingOptionsType,
Mapping,
NavigationItem,
ObjectLiteralDeclarationStyle,
} from "./types"
@@ -139,9 +137,9 @@ export class MarkdownTheme extends Theme {
reflection: DeclarationReflection,
urls: UrlMapping[]
): UrlMapping[] {
const mapping = this.mappings.find((mapping) =>
reflection.kindOf(mapping.kind)
)
const mapping = this.getMappings(
reflection.parent?.isProject() ? "" : reflection.parent?.getAlias()
).find((mapping) => reflection.kindOf(mapping.kind))
if (mapping) {
if (!reflection.url || !MarkdownTheme.URL_PREFIX.test(reflection.url)) {
const url = this.toUrl(mapping, reflection)
@@ -266,103 +264,36 @@ export class MarkdownTheme extends Theme {
}
}
getNavigation(project: ProjectReflection) {
const urls = this.getUrls(project)
const getUrlMapping = (name: string) => {
if (!name) {
return ""
}
return urls.find((url) => url.model.name === name)
}
const createNavigationItem = (
title: string,
url: string | undefined,
isLabel: boolean,
children: NavigationItem[] = []
) => {
const navigationItem = new NavigationItem(title, url)
navigationItem.isLabel = isLabel
navigationItem.children = children
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { reflection, parent, ...filteredNavigationItem } = navigationItem
return filteredNavigationItem as NavigationItem
}
const navigation = createNavigationItem(project.name, undefined, false)
const hasReadme = !this.readme.endsWith("none")
if (hasReadme) {
navigation.children?.push(
createNavigationItem("Readme", this.entryDocument, false)
)
}
if (this.entryPoints.length === 1) {
navigation.children?.push(
createNavigationItem(
"Exports",
hasReadme ? this.globalsFile : this.entryDocument,
false
)
)
}
this.mappings.forEach((mapping) => {
const kind = mapping.kind[0]
const items = project.getReflectionsByKind(kind)
if (items.length > 0) {
const children = items
.map((item) => {
const urlMapping = getUrlMapping(item.name) || ""
return createNavigationItem(
item.getFullName(),
typeof urlMapping === "string" ? urlMapping : urlMapping.url,
true
)
})
.sort((a, b) => {
return a.title > b.title ? 1 : -1
})
const group = createNavigationItem(
getKindPlural(kind),
undefined,
true,
children
)
navigation.children?.push(group)
}
})
return navigation
}
get mappings(): Mapping[] {
getMappings(directoryPrefix?: string): Mapping[] {
return [
{
kind: [ReflectionKind.Module],
isLeaf: false,
directory: "modules",
directory: path.join(directoryPrefix || "", "modules"),
template: this.getReflectionTemplate(),
},
{
kind: [ReflectionKind.Namespace],
isLeaf: false,
directory: "modules",
directory: path.join(directoryPrefix || "", "modules"),
template: this.getReflectionTemplate(),
},
{
kind: [ReflectionKind.Enum],
isLeaf: false,
directory: "enums",
directory: path.join(directoryPrefix || "", "enums"),
template: this.getReflectionTemplate(),
},
{
kind: [ReflectionKind.Class],
isLeaf: false,
directory: "classes",
directory: path.join(directoryPrefix || "", "classes"),
template: this.getReflectionTemplate(),
},
{
kind: [ReflectionKind.Interface],
isLeaf: false,
directory: "interfaces",
directory: path.join(directoryPrefix || "", "interfaces"),
template: this.getReflectionTemplate(),
},
...(this.allReflectionsHaveOwnDocument
@@ -370,19 +301,25 @@ export class MarkdownTheme extends Theme {
{
kind: [ReflectionKind.TypeAlias],
isLeaf: true,
directory: "types",
directory: path.join(directoryPrefix || "", "types"),
template: this.getReflectionMemberTemplate(),
},
{
kind: [ReflectionKind.Variable],
isLeaf: true,
directory: "variables",
directory: path.join(directoryPrefix || "", "variables"),
template: this.getReflectionMemberTemplate(),
},
{
kind: [ReflectionKind.Function],
isLeaf: true,
directory: "functions",
directory: path.join(directoryPrefix || "", "functions"),
template: this.getReflectionMemberTemplate(),
},
{
kind: [ReflectionKind.Method],
isLeaf: true,
directory: path.join(directoryPrefix || "", "methods"),
template: this.getReflectionMemberTemplate(),
},
]

View File

@@ -68,8 +68,10 @@ export type FormattingOptionType = {
reflectionDescription?: string
expandMembers?: boolean
showCommentsAsHeader?: boolean
showCommentsAsDetails?: boolean
parameterStyle?: ParameterStyle
showReturnSignature?: boolean
frontmatterData?: Record<string, unknown>
}
export type FormattingOptionsType = {

View File

@@ -0,0 +1,25 @@
import { Reflection, ReflectionKind } from "typedoc"
export function replaceTemplateVariables(
reflection: Reflection,
text?: string
): string {
if (!text) {
return ""
}
return text
.replaceAll("{{alias}}", reflection.getAlias())
.replaceAll("{{kind}}", getKindAsText(reflection.kind))
}
export function getKindAsText(kind: ReflectionKind) {
switch (kind) {
case ReflectionKind.Method:
return "method"
case ReflectionKind.Enum:
return "enum"
default:
return ""
}
}

View File

@@ -2832,6 +2832,7 @@ __metadata:
dependencies:
"@types/node": ^16.11.10
typescript: ^4.6
yaml: ^2.3.2
peerDependencies:
typedoc: 0.25.x
languageName: unknown
@@ -2845,6 +2846,7 @@ __metadata:
copyfiles: ^2.4.1
handlebars: ^4.7.8
typescript: ^4.6
yaml: ^2.3.2
peerDependencies:
typedoc: 0.25.x
languageName: unknown
@@ -3139,6 +3141,13 @@ __metadata:
languageName: node
linkType: hard
"yaml@npm:^2.3.2":
version: 2.3.2
resolution: "yaml@npm:2.3.2"
checksum: c2aac464015f037911c5b819475e81e52119e5495e3d43fe7cb82b5a84d59d66a86049dc85d8e90658636c1c04dde177ae196818deaf76c1bda4d34209d5c087
languageName: node
linkType: hard
"yargs-parser@npm:^20.2.2":
version: 20.2.9
resolution: "yargs-parser@npm:20.2.9"

View File

@@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

View File

@@ -0,0 +1,258 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/addPrices
sidebar_label: addPrices
---
# addPrices - Pricing Module Reference
This documentation provides a reference to the addPrices method. This belongs to the Pricing Module.
## addPrices(data, sharedContext?): Promise<PriceSetDTO\>
This method adds prices to a price set.
### Parameters
- `data`: An object of type [AddPricesDTO](../../interfaces/AddPricesDTO.md) that holds the data necessary to add the prices. It accepts the following properties:
- `priceSetId`: A string indicating the ID of the price set to add prices to.
- `prices`: An array of objects of type [CreatePricesDTO](../../interfaces/CreatePricesDTO.md), each being a price to add to the price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this money amount.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: A string that indicates the currency code of this money amount.
- `id`: (optional) A string that indicates the ID of the money amount.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this money amount to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this money amount to be applied.
- `rules`: An object whose keys are rule types' `rule_attribute` attribute, and values are the value of that rule associated with this price.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
### Returns
A promise that resolves to an object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md), which is the price set that the prices belong to.
<details>
<summary>
PriceSetDTO
</summary>
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
### 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
}
```
## addPrices(data, sharedContext?): Promise<PriceSetDTO[]\>
This method adds prices to multiple price sets.
### Parameters
- `data`: An array of objects of type [AddPricesDTO](../../interfaces/AddPricesDTO.md), each holding the data necessary to add the prices to the price set. Its items accept the following properties:
- `priceSetId`: A string indicating the ID of the price set to add prices to.
- `prices`: An array of objects of type [CreatePricesDTO](../../interfaces/CreatePricesDTO.md), each being a price to add to the price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this money amount.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: A string that indicates the currency code of this money amount.
- `id`: (optional) A string that indicates the ID of the money amount.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this money amount to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this money amount to be applied.
- `rules`: An object whose keys are rule types' `rule_attribute` attribute, and values are the value of that rule associated with this price.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
### Returns
A promise that resolves to an array of objects of type [PriceSetDTO](../../interfaces/PriceSetDTO.md), each being a price list that prices were added to.
<details>
<summary>
PriceSetDTO
</summary>
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
### 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
}
```

View File

@@ -0,0 +1,144 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/addRules
sidebar_label: addRules
---
# addRules - Pricing Module Reference
This documentation provides a reference to the addRules method. This belongs to the Pricing Module.
## addRules(data, sharedContext?): Promise<PriceSetDTO\>
This method adds rules to a price set.
### Parameters
- `data`: An object of type [AddRulesDTO](../../interfaces/AddRulesDTO.md) that holds the necessary data to add rules to a price set. It accepts the following properties:
- `priceSetId`: A string indicating the ID of the price set to add the rules to.
- `rules`: An array of objects, each object holds a property `attribute`, with its value being the `rule_attribute` of the rule to add to the price set.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
### Returns
A promise that resolves to an object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md), which is the price set that the rules belong to.
<details>
<summary>
PriceSetDTO
</summary>
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
### 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
}
```
## addRules(data, sharedContext?): Promise<PriceSetDTO[]\>
This method adds rules to multiple price sets.
### Parameters
- `data`: An array of objects of type [AddRulesDTO](../../interfaces/AddRulesDTO.md), each holding the necessary data to add rules to a price set. Its items accept the following properties:
- `priceSetId`: A string indicating the ID of the price set to add the rules to.
- `rules`: An array of objects, each object holds a property `attribute`, with its value being the `rule_attribute` of the rule to add to the price set.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
### Returns
A promise that resolves to an array of objects of type [PriceSetDTO](../../interfaces/PriceSetDTO.md), each being the price set that rules were added to.
<details>
<summary>
PriceSetDTO
</summary>
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
### 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
}
```

View File

@@ -0,0 +1,66 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/calculatePrices
sidebar_label: calculatePrices
---
# 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.
## Parameters
- `filters`: An object of type [PricingFilters](../../interfaces/PricingFilters.md) used to filter the price sets. It accepts the following properties:
- `id`: An array of strings, each being an ID of a price set.
- `context`: (optional) An object of type [PricingContext](../../interfaces/PricingContext.md) to select prices. For example, the pricing context can specify the currency code to calculate prices in. It accepts the following properties:
- `context`: (optional) 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. Another 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.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an object of type [CalculatedPriceSetDTO](../../interfaces/CalculatedPriceSetDTO.md) which includes the calculated prices.
<details>
<summary>
CalculatedPriceSetDTO
</summary>
- `amount`: a number indicating the calculated amount. It can possibly be `null` if there's no price set up for the provided context.
- `currency_code`: a string indicating the currency code of the calculated price. It can possibly be `null`.
- `id`: a string indicating the ID of the price set.
- `max_quantity`: a number indicaitng the maximum quantity required to be purchased for this price to apply. It's set if the `quantity` property is provided in the context. Otherwise, its value will be `null`.
- `min_quantity`: a number indicaitng the minimum quantity required to be purchased for this price to apply. It's set if the `quantity` property is provided in the context. Otherwise, its value will be `null`.
</details>
## Example
```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
}
```

View File

@@ -0,0 +1,273 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/create
sidebar_label: create
---
# create - Pricing Module Reference
This documentation provides a reference to the create method. This belongs to the Pricing Module.
## create(data, sharedContext?): Promise<PriceSetDTO\>
This method is used to create a new price set.
### Parameters
- `data`: An object of type [CreatePriceSetDTO](../../interfaces/CreatePriceSetDTO.md) that holds the attribute of the price set to create. It accepts the following properties:
- `prices`: (optional) An array of objects of type [CreatePricesDTO](../../interfaces/CreatePricesDTO.md), each being a price to associate with the price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this money amount.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: A string that indicates the currency code of this money amount.
- `id`: (optional) A string that indicates the ID of the money amount.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this money amount to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this money amount to be applied.
- `rules`: An object whose keys are rule types' `rule_attribute` attribute, and values are the value of that rule associated with this price.
- `rules`: (optional) An array of objects, each object accepts a property `rule_attribute`, whose value is a string indicating the `rule_attribute` value of a rule type. This property is used to specify the rule types associated with the price set.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
### Returns
A promise that resolves to an object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md), which is the created price set.
<details>
<summary>
PriceSetDTO
</summary>
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
### 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
}
```
## create(data, sharedContext?): Promise<PriceSetDTO[]\>
This method is used to create multiple price sets.
### Parameters
- `data`: An array of objects of type [CreatePriceSetDTO](../../interfaces/CreatePriceSetDTO.md), where each object holds the attribute of a price set to create. Its items accept the following properties:
- `prices`: (optional) An array of objects of type [CreatePricesDTO](../../interfaces/CreatePricesDTO.md), each being a price to associate with the price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this money amount.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: A string that indicates the currency code of this money amount.
- `id`: (optional) A string that indicates the ID of the money amount.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this money amount to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this money amount to be applied.
- `rules`: An object whose keys are rule types' `rule_attribute` attribute, and values are the value of that rule associated with this price.
- `rules`: (optional) An array of objects, each object accepts a property `rule_attribute`, whose value is a string indicating the `rule_attribute` value of a rule type. This property is used to specify the rule types associated with the price set.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
### Returns
A promise that resolves to an array of objects of type [PriceSetDTO](../../interfaces/PriceSetDTO.md), which are the created price sets.
<details>
<summary>
PriceSetDTO
</summary>
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
### 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
}
```

View File

@@ -0,0 +1,67 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/createCurrencies
sidebar_label: createCurrencies
---
# 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.
## Parameters
- `data`: An array of objects of type [CreateCurrencyDTO](../../interfaces/CreateCurrencyDTO.md), each object holding the data of a currency to create. Its items accept the following properties:
- `code`: a string indicating the code of the currency.
- `name`: a string indicating the name of the currency.
- `symbol`: a string indicating the symbol of the currency.
- `symbol_native`: a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [CurrencyDTO](../../interfaces/CurrencyDTO.md), each object being a created currency.
<details>
<summary>
CurrencyDTO
</summary>
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
</details>
## 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
}
```

View File

@@ -0,0 +1,83 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/createMoneyAmounts
sidebar_label: createMoneyAmounts
---
# createMoneyAmounts - Pricing Module Reference
This documentation provides a reference to the createMoneyAmounts method. This belongs to the Pricing Module.
This method creates money amounts.
## Parameters
- `data`: An array of objects of type [CreateMoneyAmountDTO](../../interfaces/CreateMoneyAmountDTO.md) that holds the necessary data to create the money amount. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this money amount.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: A string that indicates the currency code of this money amount.
- `id`: (optional) A string that indicates the ID of the money amount.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this money amount to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this money amount to be applied.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), each being a created money amount.
<details>
<summary>
MoneyAmountDTO
</summary>
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
</details>
## 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
}
```

View File

@@ -0,0 +1,103 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/createPriceRules
sidebar_label: createPriceRules
---
# 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.
## Parameters
- `data`: An array of objects of type [CreatePriceRuleDTO](../../interfaces/CreatePriceRuleDTO.md), each containing the data necessary to create a price rule. Its items accept the following properties:
- `id`: A string indicating the ID of the price rule.
- `is_dynamic`: (optional) A boolean indicating whether the price rule is dynamic.
- `price_list_id`: A string indicating the ID of the associated price list.
- `price_set_id`: A string indicating the ID of the associated price set.
- `price_set_money_amount_id`: A string indicating the ID of the associated price set money amount.
- `priority`: (optional) A number indicating the priority of the price rule in comparison to other applicable price rules.
- `rule_type_id`: A string indicating the ID of the associated rule type.
- `value`: A string indicating the value of the price rule.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [PriceRuleDTO](../../interfaces/PriceRuleDTO.md), each being a created price rule.
<details>
<summary>
PriceRuleDTO
</summary>
- `id`: A string indicating the ID of the price rule.
- `is_dynamic`: A boolean indicating whether the price rule is dynamic.
- `price_list_id`: A string indicating the ID of the associated price list.
- `price_set`: An object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md) that holds the data of the associated price set. It may only be available if the relation `price_set` is expanded. It accepts the following properties:
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `price_set_id`: A string indicating the ID of the associated price set.
- `price_set_money_amount_id`: A string indicating the ID of the associated price set money amount.
- `priority`: A number indicating the priority of the price rule in comparison to other applicable price rules.
- `rule_type`: An object of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md) that holds the data of the associated rule type. It may only be available if the relation `rule_type` is expanded. It accepts the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `rule_type_id`: A string indicating the ID of the associated rule type.
- `value`: A string indicating the value of the price rule.
</details>
## 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
}
```

View File

@@ -0,0 +1,84 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/createPriceSetMoneyAmountRules
sidebar_label: createPriceSetMoneyAmountRules
---
# 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.
## Parameters
- `data`: An array of objects of type [CreatePriceSetMoneyAmountRulesDTO](../../interfaces/CreatePriceSetMoneyAmountRulesDTO.md), each containing the data of a price set money amount rule to create. Its items accept the following properties:
- `price_set_money_amount`: A string indicating the ID of a price set money amount.
- `rule_type`: A string indicating the ID of a rule type.
- `value`: A string indicating the value of the price set money amount rule.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [PriceSetMoneyAmountRulesDTO](../../interfaces/PriceSetMoneyAmountRulesDTO.md), each being
a created price set money amount rule.
<details>
<summary>
PriceSetMoneyAmountRulesDTO
</summary>
- `id`: A string indicating the ID of the price set money amount.
- `price_set_money_amount`: an object of type [PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.md) holding the data of the associated price set money amount. It accepts the following properties:
- `id`: a string indicating the ID of a price set money amount.
- `money_amount`: (optional) an object of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md) holding the data of the associated money amount. It accepts the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `price_set`: (optional) an object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md) holding the data of the associated price set. It accepts the following properties:
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set.
- `title`: (optional) a string indicating the title of the price set money amount.
- `rule_type`: an object of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md) holding the data of the associated rule type. It accepts the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `value`: a string indicating the value of the price set money amount rule.
</details>
## 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
}
```

View File

@@ -0,0 +1,65 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/createRuleTypes
sidebar_label: createRuleTypes
---
# 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.
## Parameters
- `data`: An array of objects of type [CreateRuleTypeDTO](../../interfaces/CreateRuleTypeDTO.md), each being the data to use to create a rule type. Its items accept the following properties:
- `default_priority`: (optional) A number indicating 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.
- `id`: (optional) A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), each being a created rule type.
<details>
<summary>
RuleTypeDTO
</summary>
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
## 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
}
```

View File

@@ -0,0 +1,42 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/delete
sidebar_label: delete
---
# 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.
## Parameters
- `ids`: An array of strings, each being the ID for a price set to delete.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves when the price sets are successfully deleted.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function removePriceSetRule (priceSetIds: string[]) {
const pricingService = await initializePricingModule()
await pricingService.delete(priceSetIds)
}
```

View File

@@ -0,0 +1,43 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/deleteCurrencies
sidebar_label: deleteCurrencies
---
# 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.
## Parameters
- `currencyCodes`: An array of strings, each being a code of a currency to delete.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves once the currencies are deleted.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function deleteCurrencies () {
const pricingService = await initializePricingModule()
await pricingService.deleteCurrencies(["USD"])
}
```

View File

@@ -0,0 +1,44 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/deleteMoneyAmounts
sidebar_label: deleteMoneyAmounts
---
# 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.
## Parameters
- `ids`: An array of strings, each being the ID of a money amount to delete.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves when the money amounts are successfully deleted.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function deleteMoneyAmounts (moneyAmountIds: string[]) {
const pricingService = await initializePricingModule()
await pricingService.deleteMoneyAmounts(
moneyAmountIds
)
}
```

View File

@@ -0,0 +1,44 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/deletePriceRules
sidebar_label: deletePriceRules
---
# 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.
## Parameters
- `priceRuleIds`: An array of strings, each being the ID of a price rule to delete.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves once the price rules are deleted.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function deletePriceRules (
id: string,
) {
const pricingService = await initializePricingModule()
await pricingService.deletePriceRules([id])
}
```

View File

@@ -0,0 +1,42 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/deletePriceSetMoneyAmountRules
sidebar_label: deletePriceSetMoneyAmountRules
---
# 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.
## Parameters
- `ids`: An array of strings, each representing the ID of a price set money amount rule to delete.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves once the price set money amount rules are deleted.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function deletePriceSetMoneyAmountRule (id: string) {
const pricingService = await initializePricingModule()
await pricingService.deletePriceSetMoneyAmountRules([id])
}
```

View File

@@ -0,0 +1,42 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/deleteRuleTypes
sidebar_label: deleteRuleTypes
---
# 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.
## Parameters
- `ruleTypeIds`: An array of strings, each being the ID of a rule type to delete.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves once the rule types are deleted.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function deleteRuleTypes (ruleTypeId: string) {
const pricingService = await initializePricingModule()
await pricingService.deleteRuleTypes([ruleTypeId])
}
```

View File

@@ -0,0 +1,172 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/list
sidebar_label: list
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterablePriceSetProps](../../interfaces/FilterablePriceSetProps.md) that is used to filter the retrieved price lists. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `id`: (optional) An array of strings, each being an ID to filter price sets.
- `money_amounts`: (optional) An object of type [FilterableMoneyAmountProps](../../interfaces/FilterableMoneyAmountProps.md) that is used to filter the price sets by their associated money amounts. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `currency_code`: (optional) A string or an array of strings, each being a currency code to filter money amounts.
- `id`: (optional) An array of strings, each being an ID to filter money amounts.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the price sets are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price set. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [PriceSetDTO](../../interfaces/PriceSetDTO.md).
<details>
<summary>
PriceSetDTO
</summary>
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
## 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
}
```

View File

@@ -0,0 +1,173 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listAndCount
sidebar_label: listAndCount
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterablePriceSetProps](../../interfaces/FilterablePriceSetProps.md) that is used to filter the retrieved price lists. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `id`: (optional) An array of strings, each being an ID to filter price sets.
- `money_amounts`: (optional) An object of type [FilterableMoneyAmountProps](../../interfaces/FilterableMoneyAmountProps.md) that is used to filter the price sets by their associated money amounts. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `currency_code`: (optional) A string or an array of strings, each being a currency code to filter money amounts.
- `id`: (optional) An array of strings, each being an ID to filter money amounts.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the price sets are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price set. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array having two items, the first item is an array of objects of type [PriceSetDTO](../../interfaces/PriceSetDTO.md),
and the second item is a number indicating the total count.
<details>
<summary>
PriceSetDTO
</summary>
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
## 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
}
```

View File

@@ -0,0 +1,121 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listAndCountCurrencies
sidebar_label: listAndCountCurrencies
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterableCurrencyProps](../../interfaces/FilterableCurrencyProps.md) that is used to filter the retrieved currencies. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `code`: (optional) an array of strings, each being a currency code to filter the currencies.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the currencies are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a currency. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array having two items, the first item is an array of objects of type [CurrencyDTO](../../interfaces/CurrencyDTO.md),
and the second item is a number indicating the total count.
<details>
<summary>
CurrencyDTO
</summary>
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
</details>
## 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
}
```

View File

@@ -0,0 +1,160 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listAndCountMoneyAmounts
sidebar_label: listAndCountMoneyAmounts
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterableMoneyAmountProps](../../interfaces/FilterableMoneyAmountProps.md) that is used to filter the retrieved money amounts. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `currency_code`: (optional) A string or an array of strings, each being a currency code to filter money amounts.
- `id`: (optional) An array of strings, each being an ID to filter money amounts.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the money amounts are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a money amount. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array having two items, the first item is an array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md),
and the second item is a number indicating the total count.
<details>
<summary>
MoneyAmountDTO
</summary>
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
</details>
## 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
}
```

View File

@@ -0,0 +1,167 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listAndCountPriceRules
sidebar_label: listAndCountPriceRules
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterablePriceRuleProps](../../interfaces/FilterablePriceRuleProps.md) that is used to filter the retrieved price rules. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `id`: (optional) An array of strings, each indicating an ID to filter price rules.
- `name`: (optional) An array of strings, each indicating a name to filter price rules.
- `price_set_id`: (optional) An array of strings, each indicating a price set ID to filter price rules.
- `rule_type_id`: (optional) An array of strings, each indicating a rule type ID to filter rule types.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the price rule is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price rule. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [PriceRuleDTO](../../interfaces/PriceRuleDTO.md).
<details>
<summary>
PriceRuleDTO
</summary>
- `id`: A string indicating the ID of the price rule.
- `is_dynamic`: A boolean indicating whether the price rule is dynamic.
- `price_list_id`: A string indicating the ID of the associated price list.
- `price_set`: An object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md) that holds the data of the associated price set. It may only be available if the relation `price_set` is expanded. It accepts the following properties:
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `price_set_id`: A string indicating the ID of the associated price set.
- `price_set_money_amount_id`: A string indicating the ID of the associated price set money amount.
- `priority`: A number indicating the priority of the price rule in comparison to other applicable price rules.
- `rule_type`: An object of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md) that holds the data of the associated rule type. It may only be available if the relation `rule_type` is expanded. It accepts the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `rule_type_id`: A string indicating the ID of the associated rule type.
- `value`: A string indicating the value of the price rule.
</details>
## 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
}
```

View File

@@ -0,0 +1,163 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listAndCountPriceSetMoneyAmountRules
sidebar_label: listAndCountPriceSetMoneyAmountRules
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterablePriceSetMoneyAmountRulesProps](../../interfaces/FilterablePriceSetMoneyAmountRulesProps.md) that is used to filter the retrieved price set money amount rules. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `id`: (optional) An array of strings, each string indicating an ID to filter the price set money amount rules.
- `price_set_money_amount_id`: (optional) an array of strings, each string indicating the ID of a price set money amount to filter the price set money amount rules.
- `rule_type_id`: (optional) An array of strings, each string indicating the ID of a rule type to filter the price set money amount rules.
- `value`: (optional) an array of strings, each string indicating a value to filter the price set money amount rules.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the price set money amount rules are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price set money amount rule. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array having two items, the first item is an array of objects of type [PriceSetMoneyAmountRulesDTO](../../interfaces/PriceSetMoneyAmountRulesDTO.md),
and the second item is a number indicating the total count.
<details>
<summary>
PriceSetMoneyAmountRulesDTO
</summary>
- `id`: A string indicating the ID of the price set money amount.
- `price_set_money_amount`: an object of type [PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.md) holding the data of the associated price set money amount. It accepts the following properties:
- `id`: a string indicating the ID of a price set money amount.
- `money_amount`: (optional) an object of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md) holding the data of the associated money amount. It accepts the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `price_set`: (optional) an object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md) holding the data of the associated price set. It accepts the following properties:
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set.
- `title`: (optional) a string indicating the title of the price set money amount.
- `rule_type`: an object of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md) holding the data of the associated rule type. It accepts the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `value`: a string indicating the value of the price set money amount rule.
</details>
## 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
}
```

View File

@@ -0,0 +1,150 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listAndCountRuleTypes
sidebar_label: listAndCountRuleTypes
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterableRuleTypeProps](../../interfaces/FilterableRuleTypeProps.md) that is used to filter the retrieved rule types. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `id`: (optional) an array of strings, each being an ID to filter rule types.
- `name`: (optional) an array of strings, each being a name to filter rule types.
- `rule_attribute`: (optional) an array of strings, each being a rule attribute to filter rule types.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the rule types are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a rule type. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array having two items, the first item is an array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md),
and the second item is a number indicating the total count.
<details>
<summary>
RuleTypeDTO
</summary>
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
## 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
}
```

View File

@@ -0,0 +1,120 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listCurrencies
sidebar_label: listCurrencies
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterableCurrencyProps](../../interfaces/FilterableCurrencyProps.md) that is used to filter the retrieved currencies. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `code`: (optional) an array of strings, each being a currency code to filter the currencies.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the currencies are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a currency. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [CurrencyDTO](../../interfaces/CurrencyDTO.md).
<details>
<summary>
CurrencyDTO
</summary>
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
</details>
## 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
}
```

View File

@@ -0,0 +1,159 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listMoneyAmounts
sidebar_label: listMoneyAmounts
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterableMoneyAmountProps](../../interfaces/FilterableMoneyAmountProps.md) that is used to filter the retrieved money amounts. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `currency_code`: (optional) A string or an array of strings, each being a currency code to filter money amounts.
- `id`: (optional) An array of strings, each being an ID to filter money amounts.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the money amounts are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a money amount. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md).
<details>
<summary>
MoneyAmountDTO
</summary>
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
</details>
## 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
}
```

View File

@@ -0,0 +1,167 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listPriceRules
sidebar_label: listPriceRules
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterablePriceRuleProps](../../interfaces/FilterablePriceRuleProps.md) that is used to filter the retrieved price rules. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `id`: (optional) An array of strings, each indicating an ID to filter price rules.
- `name`: (optional) An array of strings, each indicating a name to filter price rules.
- `price_set_id`: (optional) An array of strings, each indicating a price set ID to filter price rules.
- `rule_type_id`: (optional) An array of strings, each indicating a rule type ID to filter rule types.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the price rule is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price rule. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [PriceRuleDTO](../../interfaces/PriceRuleDTO.md).
<details>
<summary>
PriceRuleDTO
</summary>
- `id`: A string indicating the ID of the price rule.
- `is_dynamic`: A boolean indicating whether the price rule is dynamic.
- `price_list_id`: A string indicating the ID of the associated price list.
- `price_set`: An object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md) that holds the data of the associated price set. It may only be available if the relation `price_set` is expanded. It accepts the following properties:
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `price_set_id`: A string indicating the ID of the associated price set.
- `price_set_money_amount_id`: A string indicating the ID of the associated price set money amount.
- `priority`: A number indicating the priority of the price rule in comparison to other applicable price rules.
- `rule_type`: An object of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md) that holds the data of the associated rule type. It may only be available if the relation `rule_type` is expanded. It accepts the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `rule_type_id`: A string indicating the ID of the associated rule type.
- `value`: A string indicating the value of the price rule.
</details>
## 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
}
```

View File

@@ -0,0 +1,161 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listPriceSetMoneyAmountRules
sidebar_label: listPriceSetMoneyAmountRules
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterablePriceSetMoneyAmountRulesProps](../../interfaces/FilterablePriceSetMoneyAmountRulesProps.md) that is used to filter the retrieved price set money amount rules. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `id`: (optional) An array of strings, each string indicating an ID to filter the price set money amount rules.
- `price_set_money_amount_id`: (optional) an array of strings, each string indicating the ID of a price set money amount to filter the price set money amount rules.
- `rule_type_id`: (optional) An array of strings, each string indicating the ID of a rule type to filter the price set money amount rules.
- `value`: (optional) an array of strings, each string indicating a value to filter the price set money amount rules.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the price set money amount rules are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price set money amount rule. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [PriceSetMoneyAmountRulesDTO](../../interfaces/PriceSetMoneyAmountRulesDTO.md).
<details>
<summary>
PriceSetMoneyAmountRulesDTO
</summary>
- `id`: A string indicating the ID of the price set money amount.
- `price_set_money_amount`: an object of type [PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.md) holding the data of the associated price set money amount. It accepts the following properties:
- `id`: a string indicating the ID of a price set money amount.
- `money_amount`: (optional) an object of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md) holding the data of the associated money amount. It accepts the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `price_set`: (optional) an object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md) holding the data of the associated price set. It accepts the following properties:
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set.
- `title`: (optional) a string indicating the title of the price set money amount.
- `rule_type`: an object of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md) holding the data of the associated rule type. It accepts the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `value`: a string indicating the value of the price set money amount rule.
</details>
## 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
}
```

View File

@@ -0,0 +1,149 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listRuleTypes
sidebar_label: listRuleTypes
---
# 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.
## Parameters
- `filters`: (optional) An object of type [FilterableRuleTypeProps](../../interfaces/FilterableRuleTypeProps.md) that is used to filter the retrieved rule types. It accepts the following properties:
- `$and`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
- `$or`: (optional) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- `id`: (optional) an array of strings, each being an ID to filter rule types.
- `name`: (optional) an array of strings, each being a name to filter rule types.
- `rule_attribute`: (optional) an array of strings, each being a rule attribute to filter rule types.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the rule types are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a rule type. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md).
<details>
<summary>
RuleTypeDTO
</summary>
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
## 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
}
```

View File

@@ -0,0 +1,49 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/removeRules
sidebar_label: removeRules
---
# 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.
## Parameters
- `data`: An array of objects of type [RemovePriceSetRulesDTO](../../interfaces/RemovePriceSetRulesDTO.md), each specfiying which rules to remove. Its items accept the following properties:
- `id`: A string indicating the ID of the price set.
- `rules`: An array of strings, each string is the `rule_attribute` of a rule you want to remove.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves when rules are successfully removed.
## 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
},
])
}
```

View File

@@ -0,0 +1,101 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/retrieve
sidebar_label: retrieve
---
# retrieve - Pricing Module Reference
This documentation provides a reference to the retrieve method. This belongs to the Pricing Module.
This method is used to retrieves a price set by its ID.
## Parameters
- `id`: A string indicating the ID of the price set to retrieve.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the price set is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price set. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md) which is the retrieved price set.
<details>
<summary>
PriceSetDTO
</summary>
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
## 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
}
```

View File

@@ -0,0 +1,88 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/retrieveCurrency
sidebar_label: retrieveCurrency
---
# 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.
## Parameters
- `code`: A string indicating the code of the currency to retrieve.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the currency is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a currency. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md).
<details>
<summary>
CurrencyDTO
</summary>
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
</details>
## 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
}
```

View File

@@ -0,0 +1,98 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/retrieveMoneyAmount
sidebar_label: retrieveMoneyAmount
---
# 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.
## Parameters
- `id`: The ID of the money amount to retrieve.
- `config`: (optional) An object of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md) used to configure how a money amount is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a money amount. It accepts the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an object of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md) which is the retrieved money amount.
<details>
<summary>
MoneyAmountDTO
</summary>
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
</details>
## 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
}
```

View File

@@ -0,0 +1,106 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/retrievePriceRule
sidebar_label: retrievePriceRule
---
# 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.
## Parameters
- `id`: The ID of the price rule to retrieve.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the price rule is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price rule. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an object of type [PriceRuleDTO](../../interfaces/PriceRuleDTO.md).
<details>
<summary>
PriceRuleDTO
</summary>
- `id`: A string indicating the ID of the price rule.
- `is_dynamic`: A boolean indicating whether the price rule is dynamic.
- `price_list_id`: A string indicating the ID of the associated price list.
- `price_set`: An object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md) that holds the data of the associated price set. It may only be available if the relation `price_set` is expanded. It accepts the following properties:
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `price_set_id`: A string indicating the ID of the associated price set.
- `price_set_money_amount_id`: A string indicating the ID of the associated price set money amount.
- `priority`: A number indicating the priority of the price rule in comparison to other applicable price rules.
- `rule_type`: An object of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md) that holds the data of the associated rule type. It may only be available if the relation `rule_type` is expanded. It accepts the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `rule_type_id`: A string indicating the ID of the associated rule type.
- `value`: A string indicating the value of the price rule.
</details>
## 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
}
```

View File

@@ -0,0 +1,100 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/retrievePriceSetMoneyAmountRules
sidebar_label: retrievePriceSetMoneyAmountRules
---
# 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.
## Parameters
- `id`: A string indicating the ID of the price set money amount rule to retrieve.
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the price set money amount rule is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price set money amount rule. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an object of type [PriceSetMoneyAmountRulesDTO](../../interfaces/PriceSetMoneyAmountRulesDTO.md).
<details>
<summary>
PriceSetMoneyAmountRulesDTO
</summary>
- `id`: A string indicating the ID of the price set money amount.
- `price_set_money_amount`: an object of type [PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.md) holding the data of the associated price set money amount. It accepts the following properties:
- `id`: a string indicating the ID of a price set money amount.
- `money_amount`: (optional) an object of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md) holding the data of the associated money amount. It accepts the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `price_set`: (optional) an object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md) holding the data of the associated price set. It accepts the following properties:
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set.
- `title`: (optional) a string indicating the title of the price set money amount.
- `rule_type`: an object of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md) holding the data of the associated rule type. It accepts the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `value`: a string indicating the value of the price set money amount rule.
</details>
## 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
}
```

View File

@@ -0,0 +1,83 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/retrieveRuleType
sidebar_label: retrieveRuleType
---
# 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.
## Parameters
- `code`:
- `config`: (optional) An object of type [FindConfig](../../interfaces/FindConfig.md) used to configure how the rule type is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a rule type. It accepts the following properties:
- `order`: (optional) 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` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
- `relations`: (optional) An array of strings, each being relation names of the entity to retrieve in the result.
- `select`: (optional) An array of strings, each being attribute names of the entity to retrieve in the result.
- `skip`: (optional) A number indicating the number of records to skip before retrieving the results.
- `take`: (optional) A number indicating the number of records to return in the result.
- `withDeleted`: (optional) A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an object of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md).
<details>
<summary>
RuleTypeDTO
</summary>
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
## 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
}
```

View File

@@ -0,0 +1,65 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/updateCurrencies
sidebar_label: updateCurrencies
---
# 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.
## Parameters
- `data`: An array of objects of type [UpdateCurrencyDTO](../../interfaces/UpdateCurrencyDTO.md), each object containing data to be updated in a currency. Its items accept the following properties:
- `code`: a string indicating the code of the currency to update.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [CurrencyDTO](../../interfaces/CurrencyDTO.md), each object being an updated currency.
<details>
<summary>
CurrencyDTO
</summary>
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
</details>
## 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
}
```

View File

@@ -0,0 +1,72 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/updateMoneyAmounts
sidebar_label: updateMoneyAmounts
---
# 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.
## Parameters
- `data`: An array of objects of type [UpdateMoneyAmountDTO](../../interfaces/UpdateMoneyAmountDTO.md), each holding data to update in a money amount. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this money amount.
- `currency_code`: (optional) A string that indicates the currency code of the money amount.
- `id`: A string that indicates the ID of the money amount to update.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this money amount to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this money amount to be applied.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), each being a updated money amount.
<details>
<summary>
MoneyAmountDTO
</summary>
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options. It accepts the following properties:
- `code`: a string indicating the code of the currency.
- `name`: (optional) a string indicating the name of the currency.
- `symbol`: (optional) a string indicating the symbol of the currency.
- `symbol_native`: (optional) a string indicating the symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
</details>
## 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
}
```

View File

@@ -0,0 +1,94 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/updatePriceRules
sidebar_label: updatePriceRules
---
# 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.
## Parameters
- `data`: An array of objects of type [UpdatePriceRuleDTO](../../interfaces/UpdatePriceRuleDTO.md), each containing the data to update in a price rule. Its items accept the following properties:
- `id`: A string indicating the ID of the price rule to update.
- `price_list_id`: (optional) A string indicating the ID of the associated price list.
- `price_set_id`: (optional) A string indicating the ID of the associated price set.
- `price_set_money_amount_id`: (optional) A string indicating the ID of the associated price set money amount.
- `priority`: (optional) A number indicating the priority of the price rule in comparison to other applicable price rules.
- `rule_type_id`: (optional) A string indicating the ID of the associated rule type.
- `value`: (optional) A string indicating the value of the price rule.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [PriceRuleDTO](../../interfaces/PriceRuleDTO.md), each being an updated price rule.
<details>
<summary>
PriceRuleDTO
</summary>
- `id`: A string indicating the ID of the price rule.
- `is_dynamic`: A boolean indicating whether the price rule is dynamic.
- `price_list_id`: A string indicating the ID of the associated price list.
- `price_set`: An object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md) that holds the data of the associated price set. It may only be available if the relation `price_set` is expanded. It accepts the following properties:
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set. Its items accept the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set. Its items accept the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `price_set_id`: A string indicating the ID of the associated price set.
- `price_set_money_amount_id`: A string indicating the ID of the associated price set money amount.
- `priority`: A number indicating the priority of the price rule in comparison to other applicable price rules.
- `rule_type`: An object of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md) that holds the data of the associated rule type. It may only be available if the relation `rule_type` is expanded. It accepts the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `rule_type_id`: A string indicating the ID of the associated rule type.
- `value`: A string indicating the value of the price rule.
</details>
## 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
}
```

View File

@@ -0,0 +1,83 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/updatePriceSetMoneyAmountRules
sidebar_label: updatePriceSetMoneyAmountRules
---
# 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.
## Parameters
- `data`: An array of objects of type [UpdatePriceSetMoneyAmountRulesDTO](../../interfaces/UpdatePriceSetMoneyAmountRulesDTO.md), each containing the data to update in a price set money amount rule. Its items accept the following properties:
- `id`: A string indicating the ID of the price set money amount rule to update.
- `price_set_money_amount`: (optional) A string indicating the ID of a price set money amount.
- `rule_type`: (optional) A string indicating the ID of a rule type.
- `value`: (optional) A string indicating the value of the price set money amount rule.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [PriceSetMoneyAmountRulesDTO](../../interfaces/PriceSetMoneyAmountRulesDTO.md), each being the
updated price set money amount rule.
<details>
<summary>
PriceSetMoneyAmountRulesDTO
</summary>
- `id`: A string indicating the ID of the price set money amount.
- `price_set_money_amount`: an object of type [PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.md) holding the data of the associated price set money amount. It accepts the following properties:
- `id`: a string indicating the ID of a price set money amount.
- `money_amount`: (optional) an object of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md) holding the data of the associated money amount. It accepts the following properties:
- `amount`: (optional) A number indicating the amount of this price.
- `currency`: (optional) An object of type [CurrencyDTO](../../interfaces/CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
- `currency_code`: (optional) A string that indicates the currency code of this price.
- `id`: A string that indicates the ID of the money amount. A money amount represents a price.
- `max_quantity`: (optional) A number that indicates the maximum quantity required to be purchased for this price to be applied.
- `min_quantity`: (optional) A number that indicates the minimum quantity required to be purchased for this price to be applied.
- `price_set`: (optional) an object of type [PriceSetDTO](../../interfaces/PriceSetDTO.md) holding the data of the associated price set. It accepts the following properties:
- `id`: A string indicating the ID of the price set.
- `money_amounts`: (optional) An array of objects of type [MoneyAmountDTO](../../interfaces/MoneyAmountDTO.md), which holds the prices that belong to this price set.
- `rule_types`: (optional) An array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), which holds the rule types applied on this price set.
- `title`: (optional) a string indicating the title of the price set money amount.
- `rule_type`: an object of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md) holding the data of the associated rule type. It accepts the following properties:
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
- `value`: a string indicating the value of the price set money amount rule.
</details>
## 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
}
```

View File

@@ -0,0 +1,65 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/updateRuleTypes
sidebar_label: updateRuleTypes
---
# 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.
## Parameters
- `data`: An array of objects of type [UpdateRuleTypeDTO](../../interfaces/UpdateRuleTypeDTO.md), each object containing data to be updated in a rule type. Its items accept the following properties:
- `default_priority`: (optional) A number indicating 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.
- `id`: A string indicating the ID of the rule type to update.
- `name`: (optional) A string indicating the display name of the rule type.
- `rule_attribute`: (optional) A string indicating a 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.
- `sharedContext`: (optional) An object of type [Context](../../interfaces/Context.md) used to share resources, such as transaction manager, between the application and the module. It accepts the following properties:
- `enableNestedTransactions`: (optional) a boolean value indicating whether nested transactions are enabled.
- `isolationLevel`: (optional) A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
- `manager`: (optional) 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`.
- `transactionId`: (optional) a string indicating the ID of the current transaction.
- `transactionManager`: (optional) 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`.
## Returns
A promise that resolves to an array of objects of type [RuleTypeDTO](../../interfaces/RuleTypeDTO.md), each being an updated rule type.
<details>
<summary>
RuleTypeDTO
</summary>
- `default_priority`: A number indicating 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.
- `id`: A string indicating the ID of the rule type.
- `name`: A string indicating the display name of the rule type.
- `rule_attribute`: A string indicating a 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.
</details>
## 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
}
```

View File

@@ -0,0 +1,56 @@
---
displayed_sidebar: pricingReference
---
# Pricing Module Reference Reference
## Interfaces
- [AddPricesDTO](interfaces/AddPricesDTO.md)
- [AddRulesDTO](interfaces/AddRulesDTO.md)
- [BaseFilterable](interfaces/BaseFilterable.md)
- [CalculatedPriceSetDTO](interfaces/CalculatedPriceSetDTO.md)
- [Context](interfaces/Context.md)
- [CreateCurrencyDTO](interfaces/CreateCurrencyDTO.md)
- [CreateMoneyAmountDTO](interfaces/CreateMoneyAmountDTO.md)
- [CreatePriceRuleDTO](interfaces/CreatePriceRuleDTO.md)
- [CreatePriceSetDTO](interfaces/CreatePriceSetDTO.md)
- [CreatePriceSetMoneyAmountRulesDTO](interfaces/CreatePriceSetMoneyAmountRulesDTO.md)
- [CreatePricesDTO](interfaces/CreatePricesDTO.md)
- [CreateRuleTypeDTO](interfaces/CreateRuleTypeDTO.md)
- [CurrencyDTO](interfaces/CurrencyDTO.md)
- [FilterableCurrencyProps](interfaces/FilterableCurrencyProps.md)
- [FilterableMoneyAmountProps](interfaces/FilterableMoneyAmountProps.md)
- [FilterablePriceRuleProps](interfaces/FilterablePriceRuleProps.md)
- [FilterablePriceSetMoneyAmountRulesProps](interfaces/FilterablePriceSetMoneyAmountRulesProps.md)
- [FilterablePriceSetProps](interfaces/FilterablePriceSetProps.md)
- [FilterableRuleTypeProps](interfaces/FilterableRuleTypeProps.md)
- [FindConfig](interfaces/FindConfig.md)
- [IPricingModuleService](interfaces/IPricingModuleService.md)
- [JoinerServiceConfig](interfaces/JoinerServiceConfig.md)
- [JoinerServiceConfigAlias](interfaces/JoinerServiceConfigAlias.md)
- [MoneyAmountDTO](interfaces/MoneyAmountDTO.md)
- [PriceRuleDTO](interfaces/PriceRuleDTO.md)
- [PriceSetDTO](interfaces/PriceSetDTO.md)
- [PriceSetMoneyAmountDTO](interfaces/PriceSetMoneyAmountDTO.md)
- [PriceSetMoneyAmountRulesDTO](interfaces/PriceSetMoneyAmountRulesDTO.md)
- [PricingContext](interfaces/PricingContext.md)
- [PricingFilters](interfaces/PricingFilters.md)
- [RemovePriceSetRulesDTO](interfaces/RemovePriceSetRulesDTO.md)
- [RuleTypeDTO](interfaces/RuleTypeDTO.md)
- [UpdateCurrencyDTO](interfaces/UpdateCurrencyDTO.md)
- [UpdateMoneyAmountDTO](interfaces/UpdateMoneyAmountDTO.md)
- [UpdatePriceRuleDTO](interfaces/UpdatePriceRuleDTO.md)
- [UpdatePriceSetDTO](interfaces/UpdatePriceSetDTO.md)
- [UpdatePriceSetMoneyAmountRulesDTO](interfaces/UpdatePriceSetMoneyAmountRulesDTO.md)
- [UpdateRuleTypeDTO](interfaces/UpdateRuleTypeDTO.md)
## Type Aliases
- [Exclude](types/Exclude.md)
- [JoinerRelationship](types/JoinerRelationship.md)
- [ModuleJoinerConfig](types/ModuleJoinerConfig.md)
- [ModuleJoinerRelationship](types/ModuleJoinerRelationship.md)
- [Omit](types/Omit.md)
- [Pick](types/Pick.md)
- [Record](types/Record.md)

View File

@@ -0,0 +1,31 @@
---
displayed_sidebar: pricingReference
---
# AddPricesDTO
An object used to specify prices to add to a price set.
## Properties
### priceSetId
**priceSetId**: `string`
A string indicating the ID of the price set to add prices to.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:105](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L105)
___
### prices
**prices**: [`CreatePricesDTO`](CreatePricesDTO.md)[]
An array of objects of type [CreatePricesDTO](CreatePricesDTO.md), each being a price to add to the price set.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:106](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L106)

View File

@@ -0,0 +1,31 @@
---
displayed_sidebar: pricingReference
---
# AddRulesDTO
An object used to specify the rules to add to a price set.
## Properties
### priceSetId
**priceSetId**: `string`
A string indicating the ID of the price set to add the rules to.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:81](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L81)
___
### rules
**rules**: { `attribute`: `string` }[]
An array of objects, each object holds a property `attribute`, with its value being the `rule_attribute` of the rule to add to the price set.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:82](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L82)

View File

@@ -0,0 +1,53 @@
---
displayed_sidebar: pricingReference
---
# BaseFilterable
An object used to allow specifying flexible queries with and/or conditions.
## Type parameters
| Name |
| :------ |
| `T` |
## Hierarchy
- **`BaseFilterable`**
↳ [`FilterablePriceSetProps`](FilterablePriceSetProps.md)
↳ [`FilterableMoneyAmountProps`](FilterableMoneyAmountProps.md)
↳ [`FilterableCurrencyProps`](FilterableCurrencyProps.md)
↳ [`FilterableRuleTypeProps`](FilterableRuleTypeProps.md)
↳ [`FilterablePriceSetMoneyAmountRulesProps`](FilterablePriceSetMoneyAmountRulesProps.md)
↳ [`FilterablePriceRuleProps`](FilterablePriceRuleProps.md)
## Properties
### $and
`Optional` **$and**: (`T` \| [`BaseFilterable`](BaseFilterable.md)<`T`\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
#### Defined in
[packages/types/src/dal/index.ts:14](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L14)
___
### $or
`Optional` **$or**: (`T` \| [`BaseFilterable`](BaseFilterable.md)<`T`\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
#### Defined in
[packages/types/src/dal/index.ts:15](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L15)

View File

@@ -0,0 +1,67 @@
---
displayed_sidebar: pricingReference
---
# CalculatedPriceSetDTO
An object that holds the details of a calculated price set.
## Properties
### amount
**amount**: ``null`` \| `number`
a number indicating the calculated amount. It can possibly be `null` if there's no price set up for the provided context.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:66](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L66)
___
### currency\_code
**currency\_code**: ``null`` \| `string`
a string indicating the currency code of the calculated price. It can possibly be `null`.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:67](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L67)
___
### id
**id**: `string`
a string indicating the ID of the price set.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:65](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L65)
___
### max\_quantity
**max\_quantity**: ``null`` \| `number`
a number indicaitng the maximum quantity required to be purchased for this price to apply. It's set if the `quantity` property is provided in the context. Otherwise, its value will be `null`.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:69](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L69)
___
### min\_quantity
**min\_quantity**: ``null`` \| `number`
a number indicaitng the minimum quantity required to be purchased for this price to apply. It's set if the `quantity` property is provided in the context. Otherwise, its value will be `null`.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:68](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L68)

View File

@@ -0,0 +1,75 @@
---
displayed_sidebar: pricingReference
---
# Context
The interface tag is used to ensure that the type is documented similar to interfaces.
A shared context object that is used to share resources between the application and the module.
## Type parameters
| Name | Type |
| :------ | :------ |
| `TManager` | `unknown` |
## Properties
### enableNestedTransactions
`Optional` **enableNestedTransactions**: `boolean`
a boolean value indicating whether nested transactions are enabled.
#### Defined in
[packages/types/src/shared-context.ts:24](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/shared-context.ts#L24)
___
### isolationLevel
`Optional` **isolationLevel**: `string`
A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.
#### Defined in
[packages/types/src/shared-context.ts:23](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/shared-context.ts#L23)
___
### manager
`Optional` **manager**: `TManager`
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`.
#### Defined in
[packages/types/src/shared-context.ts:22](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/shared-context.ts#L22)
___
### transactionId
`Optional` **transactionId**: `string`
a string indicating the ID of the current transaction.
#### Defined in
[packages/types/src/shared-context.ts:25](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/shared-context.ts#L25)
___
### transactionManager
`Optional` **transactionManager**: `TManager`
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`.
#### Defined in
[packages/types/src/shared-context.ts:21](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/shared-context.ts#L21)

View File

@@ -0,0 +1,56 @@
---
displayed_sidebar: pricingReference
---
# CreateCurrencyDTO
An object that holds data to create a currency.
## Properties
### code
**code**: `string`
a string indicating the code of the currency.
#### Defined in
[packages/types/src/pricing/common/currency.ts:35](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L35)
___
### name
**name**: `string`
a string indicating the name of the currency.
#### Defined in
[packages/types/src/pricing/common/currency.ts:38](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L38)
___
### symbol
**symbol**: `string`
a string indicating the symbol of the currency.
#### Defined in
[packages/types/src/pricing/common/currency.ts:36](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L36)
___
### symbol\_native
**symbol\_native**: `string`
a string indicating the symbol of the currecy in its native form.
This is typically the symbol used when displaying a price.
#### Defined in
[packages/types/src/pricing/common/currency.ts:37](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L37)

View File

@@ -0,0 +1,87 @@
---
displayed_sidebar: pricingReference
---
# CreateMoneyAmountDTO
*
An object that holds data to create a money amount.
## Hierarchy
- **`CreateMoneyAmountDTO`**
↳ [`CreatePricesDTO`](CreatePricesDTO.md)
## Properties
### amount
`Optional` **amount**: `number`
A number indicating the amount of this money amount.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:41](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L41)
___
### currency
`Optional` **currency**: [`CreateCurrencyDTO`](CreateCurrencyDTO.md)
An object of type [CurrencyDTO](CurrencyDTO.md) that holds the details of the money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:40](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L40)
___
### currency\_code
**currency\_code**: `string`
A string that indicates the currency code of this money amount.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:39](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L39)
___
### id
`Optional` **id**: `string`
A string that indicates the ID of the money amount.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:38](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L38)
___
### max\_quantity
`Optional` **max\_quantity**: `number`
A number that indicates the maximum quantity required to be purchased for this money amount to be applied.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:43](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L43)
___
### min\_quantity
`Optional` **min\_quantity**: `number`
A number that indicates the minimum quantity required to be purchased for this money amount to be applied.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:42](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L42)

View File

@@ -0,0 +1,103 @@
---
displayed_sidebar: pricingReference
---
# CreatePriceRuleDTO
An object used to specify the necessary data to create a price rule.
## Properties
### id
**id**: `string`
A string indicating the ID of the price rule.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:50](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L50)
___
### is\_dynamic
`Optional` **is\_dynamic**: `boolean`
A boolean indicating whether the price rule is dynamic.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:53](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L53)
___
### price\_list\_id
**price\_list\_id**: `string`
A string indicating the ID of the associated price list.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:57](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L57)
___
### price\_set\_id
**price\_set\_id**: `string`
A string indicating the ID of the associated price set.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:51](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L51)
___
### price\_set\_money\_amount\_id
**price\_set\_money\_amount\_id**: `string`
A string indicating the ID of the associated price set money amount.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:56](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L56)
___
### priority
`Optional` **priority**: `number`
A number indicating the priority of the price rule in comparison to other applicable price rules.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:55](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L55)
___
### rule\_type\_id
**rule\_type\_id**: `string`
A string indicating the ID of the associated rule type.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:52](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L52)
___
### value
**value**: `string`
A string indicating the value of the price rule.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:54](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L54)

View File

@@ -0,0 +1,32 @@
---
displayed_sidebar: pricingReference
---
# CreatePriceSetDTO
An object of expected properties when creating a price set.
## Properties
### prices
`Optional` **prices**: [`CreatePricesDTO`](CreatePricesDTO.md)[]
An array of objects of type [CreatePricesDTO](CreatePricesDTO.md), each being a price to associate with the price set.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:134](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L134)
___
### rules
`Optional` **rules**: { `rule_attribute`: `string` }[]
An array of objects, each object accepts a property `rule_attribute`, whose value is a string indicating the `rule_attribute` value of a rule type.
This property is used to specify the rule types associated with the price set.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:133](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L133)

View File

@@ -0,0 +1,43 @@
---
displayed_sidebar: pricingReference
---
# CreatePriceSetMoneyAmountRulesDTO
An object used to create a price set money amount rule, which represents an association between a price set money amount and a rule type.
## Properties
### price\_set\_money\_amount
**price\_set\_money\_amount**: `string`
A string indicating the ID of a price set money amount.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:32](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L32)
___
### rule\_type
**rule\_type**: `string`
A string indicating the ID of a rule type.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:33](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L33)
___
### value
**value**: `string`
A string indicating the value of the price set money amount rule.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:34](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L34)

View File

@@ -0,0 +1,121 @@
---
displayed_sidebar: pricingReference
---
# CreatePricesDTO
An object used to pass prices data when creating a price set.
## Hierarchy
- [`CreateMoneyAmountDTO`](CreateMoneyAmountDTO.md)
**`CreatePricesDTO`**
## Properties
### amount
`Optional` **amount**: `number`
A number indicating the amount of this money amount.
#### Inherited from
[CreateMoneyAmountDTO](CreateMoneyAmountDTO.md).[amount](CreateMoneyAmountDTO.md#amount)
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:41](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L41)
___
### currency
`Optional` **currency**: [`CreateCurrencyDTO`](CreateCurrencyDTO.md)
An object of type [CurrencyDTO](CurrencyDTO.md) that holds the details of the money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
#### Inherited from
[CreateMoneyAmountDTO](CreateMoneyAmountDTO.md).[currency](CreateMoneyAmountDTO.md#currency)
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:40](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L40)
___
### currency\_code
**currency\_code**: `string`
A string that indicates the currency code of this money amount.
#### Inherited from
[CreateMoneyAmountDTO](CreateMoneyAmountDTO.md).[currency_code](CreateMoneyAmountDTO.md#currency_code)
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:39](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L39)
___
### id
`Optional` **id**: `string`
A string that indicates the ID of the money amount.
#### Inherited from
[CreateMoneyAmountDTO](CreateMoneyAmountDTO.md).[id](CreateMoneyAmountDTO.md#id)
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:38](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L38)
___
### max\_quantity
`Optional` **max\_quantity**: `number`
A number that indicates the maximum quantity required to be purchased for this money amount to be applied.
#### Inherited from
[CreateMoneyAmountDTO](CreateMoneyAmountDTO.md).[max_quantity](CreateMoneyAmountDTO.md#max_quantity)
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:43](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L43)
___
### min\_quantity
`Optional` **min\_quantity**: `number`
A number that indicates the minimum quantity required to be purchased for this money amount to be applied.
#### Inherited from
[CreateMoneyAmountDTO](CreateMoneyAmountDTO.md).[min_quantity](CreateMoneyAmountDTO.md#min_quantity)
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:42](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L42)
___
### rules
**rules**: [`Record`](../types/Record.md)<`string`, `string`\>
An object whose keys are rule types' `rule_attribute` attribute, and values are the value of that rule associated with this price.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:93](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L93)

View File

@@ -0,0 +1,55 @@
---
displayed_sidebar: pricingReference
---
# CreateRuleTypeDTO
An object used when creating a rule type to specify its data.
## Properties
### default\_priority
`Optional` **default\_priority**: `number`
A number indicating 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.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:34](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L34)
___
### id
`Optional` **id**: `string`
A string indicating the ID of the rule type.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:31](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L31)
___
### name
**name**: `string`
A string indicating the display name of the rule type.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:32](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L32)
___
### rule\_attribute
**rule\_attribute**: `string`
A string indicating a 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.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:33](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L33)

View File

@@ -0,0 +1,56 @@
---
displayed_sidebar: pricingReference
---
# CurrencyDTO
An object representing a currency.
## Properties
### code
**code**: `string`
a string indicating the code of the currency.
#### Defined in
[packages/types/src/pricing/common/currency.ts:16](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L16)
___
### name
`Optional` **name**: `string`
a string indicating the name of the currency.
#### Defined in
[packages/types/src/pricing/common/currency.ts:19](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L19)
___
### symbol
`Optional` **symbol**: `string`
a string indicating the symbol of the currency.
#### Defined in
[packages/types/src/pricing/common/currency.ts:17](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L17)
___
### symbol\_native
`Optional` **symbol\_native**: `string`
a string indicating the symbol of the currecy in its native form.
This is typically the symbol used when displaying a price.
#### Defined in
[packages/types/src/pricing/common/currency.ts:18](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L18)

View File

@@ -0,0 +1,57 @@
---
displayed_sidebar: pricingReference
---
# FilterableCurrencyProps
An object used to filter retrieved currencies.
## Hierarchy
- [`BaseFilterable`](BaseFilterable.md)<[`FilterableCurrencyProps`](FilterableCurrencyProps.md)\>
**`FilterableCurrencyProps`**
## Properties
### $and
`Optional` **$and**: ([`FilterableCurrencyProps`](FilterableCurrencyProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterableCurrencyProps`](FilterableCurrencyProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$and](BaseFilterable.md#$and)
#### Defined in
[packages/types/src/dal/index.ts:14](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L14)
___
### $or
`Optional` **$or**: ([`FilterableCurrencyProps`](FilterableCurrencyProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterableCurrencyProps`](FilterableCurrencyProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$or](BaseFilterable.md#$or)
#### Defined in
[packages/types/src/dal/index.ts:15](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L15)
___
### code
`Optional` **code**: `string`[]
an array of strings, each being a currency code to filter the currencies.
#### Defined in
[packages/types/src/pricing/common/currency.ts:69](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L69)

View File

@@ -0,0 +1,69 @@
---
displayed_sidebar: pricingReference
---
# FilterableMoneyAmountProps
An object that can be used to filter money amounts.
## Hierarchy
- [`BaseFilterable`](BaseFilterable.md)<[`FilterableMoneyAmountProps`](FilterableMoneyAmountProps.md)\>
**`FilterableMoneyAmountProps`**
## Properties
### $and
`Optional` **$and**: ([`FilterableMoneyAmountProps`](FilterableMoneyAmountProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterableMoneyAmountProps`](FilterableMoneyAmountProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$and](BaseFilterable.md#$and)
#### Defined in
[packages/types/src/dal/index.ts:14](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L14)
___
### $or
`Optional` **$or**: ([`FilterableMoneyAmountProps`](FilterableMoneyAmountProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterableMoneyAmountProps`](FilterableMoneyAmountProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$or](BaseFilterable.md#$or)
#### Defined in
[packages/types/src/dal/index.ts:15](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L15)
___
### currency\_code
`Optional` **currency\_code**: `string` \| `string`[]
A string or an array of strings, each being a currency code to filter money amounts.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:77](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L77)
___
### id
`Optional` **id**: `string`[]
An array of strings, each being an ID to filter money amounts.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:76](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L76)

View File

@@ -0,0 +1,93 @@
---
displayed_sidebar: pricingReference
---
# FilterablePriceRuleProps
An object used to filter price rules when retrieving them.
## Hierarchy
- [`BaseFilterable`](BaseFilterable.md)<[`FilterablePriceRuleProps`](FilterablePriceRuleProps.md)\>
**`FilterablePriceRuleProps`**
## Properties
### $and
`Optional` **$and**: ([`FilterablePriceRuleProps`](FilterablePriceRuleProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterablePriceRuleProps`](FilterablePriceRuleProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$and](BaseFilterable.md#$and)
#### Defined in
[packages/types/src/dal/index.ts:14](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L14)
___
### $or
`Optional` **$or**: ([`FilterablePriceRuleProps`](FilterablePriceRuleProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterablePriceRuleProps`](FilterablePriceRuleProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$or](BaseFilterable.md#$or)
#### Defined in
[packages/types/src/dal/index.ts:15](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L15)
___
### id
`Optional` **id**: `string`[]
An array of strings, each indicating an ID to filter price rules.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:103](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L103)
___
### name
`Optional` **name**: `string`[]
An array of strings, each indicating a name to filter price rules.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:104](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L104)
___
### price\_set\_id
`Optional` **price\_set\_id**: `string`[]
An array of strings, each indicating a price set ID to filter price rules.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:105](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L105)
___
### rule\_type\_id
`Optional` **rule\_type\_id**: `string`[]
An array of strings, each indicating a rule type ID to filter rule types.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:106](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L106)

View File

@@ -0,0 +1,93 @@
---
displayed_sidebar: pricingReference
---
# FilterablePriceSetMoneyAmountRulesProps
An object used to filter price set money amount rules when listing them.
## Hierarchy
- [`BaseFilterable`](BaseFilterable.md)<[`FilterablePriceSetMoneyAmountRulesProps`](FilterablePriceSetMoneyAmountRulesProps.md)\>
**`FilterablePriceSetMoneyAmountRulesProps`**
## Properties
### $and
`Optional` **$and**: ([`FilterablePriceSetMoneyAmountRulesProps`](FilterablePriceSetMoneyAmountRulesProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterablePriceSetMoneyAmountRulesProps`](FilterablePriceSetMoneyAmountRulesProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$and](BaseFilterable.md#$and)
#### Defined in
[packages/types/src/dal/index.ts:14](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L14)
___
### $or
`Optional` **$or**: ([`FilterablePriceSetMoneyAmountRulesProps`](FilterablePriceSetMoneyAmountRulesProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterablePriceSetMoneyAmountRulesProps`](FilterablePriceSetMoneyAmountRulesProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$or](BaseFilterable.md#$or)
#### Defined in
[packages/types/src/dal/index.ts:15](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L15)
___
### id
`Optional` **id**: `string`[]
An array of strings, each string indicating an ID to filter the price set money amount rules.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:66](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L66)
___
### price\_set\_money\_amount\_id
`Optional` **price\_set\_money\_amount\_id**: `string`[]
an array of strings, each string indicating the ID of a price set money amount to filter the price set money amount rules.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:68](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L68)
___
### rule\_type\_id
`Optional` **rule\_type\_id**: `string`[]
An array of strings, each string indicating the ID of a rule type to filter the price set money amount rules.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:67](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L67)
___
### value
`Optional` **value**: `string`[]
an array of strings, each string indicating a value to filter the price set money amount rules.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:69](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L69)

View File

@@ -0,0 +1,69 @@
---
displayed_sidebar: pricingReference
---
# FilterablePriceSetProps
An object that can be used to specify filters on price sets.
## Hierarchy
- [`BaseFilterable`](BaseFilterable.md)<[`FilterablePriceSetProps`](FilterablePriceSetProps.md)\>
**`FilterablePriceSetProps`**
## Properties
### $and
`Optional` **$and**: ([`FilterablePriceSetProps`](FilterablePriceSetProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterablePriceSetProps`](FilterablePriceSetProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$and](BaseFilterable.md#$and)
#### Defined in
[packages/types/src/dal/index.ts:14](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L14)
___
### $or
`Optional` **$or**: ([`FilterablePriceSetProps`](FilterablePriceSetProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterablePriceSetProps`](FilterablePriceSetProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$or](BaseFilterable.md#$or)
#### Defined in
[packages/types/src/dal/index.ts:15](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L15)
___
### id
`Optional` **id**: `string`[]
An array of strings, each being an ID to filter price sets.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:158](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L158)
___
### money\_amounts
`Optional` **money\_amounts**: [`FilterableMoneyAmountProps`](FilterableMoneyAmountProps.md)
An object of type [FilterableMoneyAmountProps](FilterableMoneyAmountProps.md) that is used to filter the price sets by their associated money amounts.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:159](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L159)

View File

@@ -0,0 +1,81 @@
---
displayed_sidebar: pricingReference
---
# FilterableRuleTypeProps
An object used to filter retrieved rule types.
## Hierarchy
- [`BaseFilterable`](BaseFilterable.md)<[`FilterableRuleTypeProps`](FilterableRuleTypeProps.md)\>
**`FilterableRuleTypeProps`**
## Properties
### $and
`Optional` **$and**: ([`FilterableRuleTypeProps`](FilterableRuleTypeProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterableRuleTypeProps`](FilterableRuleTypeProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$and](BaseFilterable.md#$and)
#### Defined in
[packages/types/src/dal/index.ts:14](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L14)
___
### $or
`Optional` **$or**: ([`FilterableRuleTypeProps`](FilterableRuleTypeProps.md) \| [`BaseFilterable`](BaseFilterable.md)<[`FilterableRuleTypeProps`](FilterableRuleTypeProps.md)\>)[]
An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
#### Inherited from
[BaseFilterable](BaseFilterable.md).[$or](BaseFilterable.md#$or)
#### Defined in
[packages/types/src/dal/index.ts:15](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/dal/index.ts#L15)
___
### id
`Optional` **id**: `string`[]
an array of strings, each being an ID to filter rule types.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:65](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L65)
___
### name
`Optional` **name**: `string`[]
an array of strings, each being a name to filter rule types.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:66](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L66)
___
### rule\_attribute
`Optional` **rule\_attribute**: `string`[]
an array of strings, each being a rule attribute to filter rule types.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:67](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L67)

View File

@@ -0,0 +1,92 @@
---
displayed_sidebar: pricingReference
---
# FindConfig
An object that is used to configure how an entity is retrieved from the database. It accepts as a typed parameter an `Entity` class,
which provides correct typing of field names in its properties.
## Type parameters
| Name |
| :------ |
| `Entity` |
## Properties
### order
`Optional` **order**: `Object`
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`
to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
#### Index signature
▪ [K: `string`]: ``"ASC"`` \| ``"DESC"``
#### Defined in
[packages/types/src/common/common.ts:64](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/common/common.ts#L64)
___
### relations
`Optional` **relations**: `string`[]
An array of strings, each being relation names of the entity to retrieve in the result.
#### Defined in
[packages/types/src/common/common.ts:63](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/common/common.ts#L63)
___
### select
`Optional` **select**: (`string` \| keyof `Entity`)[]
An array of strings, each being attribute names of the entity to retrieve in the result.
#### Defined in
[packages/types/src/common/common.ts:60](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/common/common.ts#L60)
___
### skip
`Optional` **skip**: `number`
A number indicating the number of records to skip before retrieving the results.
#### Defined in
[packages/types/src/common/common.ts:61](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/common/common.ts#L61)
___
### take
`Optional` **take**: `number`
A number indicating the number of records to return in the result.
#### Defined in
[packages/types/src/common/common.ts:62](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/common/common.ts#L62)
___
### withDeleted
`Optional` **withDeleted**: `boolean`
A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the
`SoftDeletableEntity` class.
#### Defined in
[packages/types/src/common/common.ts:65](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/common/common.ts#L65)

View File

@@ -0,0 +1,53 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing
---
# IPricingModuleService Reference
This section of the documentation provides a reference to the `IPricingModuleService` interfaces methods. This is the interface developers use to use the functionalities provided by the Pricing Module.
## Methods
- [addPrices](../IPricingModuleService/methods/IPricingModuleService.addPrices.md)
- [addRules](../IPricingModuleService/methods/IPricingModuleService.addRules.md)
- [calculatePrices](../IPricingModuleService/methods/IPricingModuleService.calculatePrices.md)
- [create](../IPricingModuleService/methods/IPricingModuleService.create.md)
- [createCurrencies](../IPricingModuleService/methods/IPricingModuleService.createCurrencies.md)
- [createMoneyAmounts](../IPricingModuleService/methods/IPricingModuleService.createMoneyAmounts.md)
- [createPriceRules](../IPricingModuleService/methods/IPricingModuleService.createPriceRules.md)
- [createPriceSetMoneyAmountRules](../IPricingModuleService/methods/IPricingModuleService.createPriceSetMoneyAmountRules.md)
- [createRuleTypes](../IPricingModuleService/methods/IPricingModuleService.createRuleTypes.md)
- [delete](../IPricingModuleService/methods/IPricingModuleService.delete.md)
- [deleteCurrencies](../IPricingModuleService/methods/IPricingModuleService.deleteCurrencies.md)
- [deleteMoneyAmounts](../IPricingModuleService/methods/IPricingModuleService.deleteMoneyAmounts.md)
- [deletePriceRules](../IPricingModuleService/methods/IPricingModuleService.deletePriceRules.md)
- [deletePriceSetMoneyAmountRules](../IPricingModuleService/methods/IPricingModuleService.deletePriceSetMoneyAmountRules.md)
- [deleteRuleTypes](../IPricingModuleService/methods/IPricingModuleService.deleteRuleTypes.md)
- [list](../IPricingModuleService/methods/IPricingModuleService.list.md)
- [listAndCount](../IPricingModuleService/methods/IPricingModuleService.listAndCount.md)
- [listAndCountCurrencies](../IPricingModuleService/methods/IPricingModuleService.listAndCountCurrencies.md)
- [listAndCountMoneyAmounts](../IPricingModuleService/methods/IPricingModuleService.listAndCountMoneyAmounts.md)
- [listAndCountPriceRules](../IPricingModuleService/methods/IPricingModuleService.listAndCountPriceRules.md)
- [listAndCountPriceSetMoneyAmountRules](../IPricingModuleService/methods/IPricingModuleService.listAndCountPriceSetMoneyAmountRules.md)
- [listAndCountRuleTypes](../IPricingModuleService/methods/IPricingModuleService.listAndCountRuleTypes.md)
- [listCurrencies](../IPricingModuleService/methods/IPricingModuleService.listCurrencies.md)
- [listMoneyAmounts](../IPricingModuleService/methods/IPricingModuleService.listMoneyAmounts.md)
- [listPriceRules](../IPricingModuleService/methods/IPricingModuleService.listPriceRules.md)
- [listPriceSetMoneyAmountRules](../IPricingModuleService/methods/IPricingModuleService.listPriceSetMoneyAmountRules.md)
- [listRuleTypes](../IPricingModuleService/methods/IPricingModuleService.listRuleTypes.md)
- [removeRules](../IPricingModuleService/methods/IPricingModuleService.removeRules.md)
- [retrieve](../IPricingModuleService/methods/IPricingModuleService.retrieve.md)
- [retrieveCurrency](../IPricingModuleService/methods/IPricingModuleService.retrieveCurrency.md)
- [retrieveMoneyAmount](../IPricingModuleService/methods/IPricingModuleService.retrieveMoneyAmount.md)
- [retrievePriceRule](../IPricingModuleService/methods/IPricingModuleService.retrievePriceRule.md)
- [retrievePriceSetMoneyAmountRules](../IPricingModuleService/methods/IPricingModuleService.retrievePriceSetMoneyAmountRules.md)
- [retrieveRuleType](../IPricingModuleService/methods/IPricingModuleService.retrieveRuleType.md)
- [updateCurrencies](../IPricingModuleService/methods/IPricingModuleService.updateCurrencies.md)
- [updateMoneyAmounts](../IPricingModuleService/methods/IPricingModuleService.updateMoneyAmounts.md)
- [updatePriceRules](../IPricingModuleService/methods/IPricingModuleService.updatePriceRules.md)
- [updatePriceSetMoneyAmountRules](../IPricingModuleService/methods/IPricingModuleService.updatePriceSetMoneyAmountRules.md)
- [updateRuleTypes](../IPricingModuleService/methods/IPricingModuleService.updateRuleTypes.md)

View File

@@ -0,0 +1,81 @@
---
displayed_sidebar: pricingReference
---
# JoinerServiceConfig
## Properties
### alias
`Optional` **alias**: [`JoinerServiceConfigAlias`](JoinerServiceConfigAlias.md) \| [`JoinerServiceConfigAlias`](JoinerServiceConfigAlias.md)[]
Property name to use as entrypoint to the service
#### Defined in
[packages/types/src/joiner/index.ts:38](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/joiner/index.ts#L38)
___
### args
`Optional` **args**: [`Record`](../types/Record.md)<`string`, `any`\>
Extra arguments to pass to the remoteFetchData callback
#### Defined in
[packages/types/src/joiner/index.ts:59](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/joiner/index.ts#L59)
___
### extends
`Optional` **extends**: { `relationship`: [`JoinerRelationship`](../types/JoinerRelationship.md) ; `serviceName`: `string` }[]
#### Defined in
[packages/types/src/joiner/index.ts:52](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/joiner/index.ts#L52)
___
### fieldAlias
`Optional` **fieldAlias**: [`Record`](../types/Record.md)<`string`, `string` \| { `forwardArgumentsOnPath`: `string`[] ; `path`: `string` }\>
alias for deeper nested relationships (e.g. { 'price': 'prices.calculated_price_set.amount' })
#### Defined in
[packages/types/src/joiner/index.ts:42](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/joiner/index.ts#L42)
___
### primaryKeys
**primaryKeys**: `string`[]
#### Defined in
[packages/types/src/joiner/index.ts:50](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/joiner/index.ts#L50)
___
### relationships
`Optional` **relationships**: [`JoinerRelationship`](../types/JoinerRelationship.md)[]
#### Defined in
[packages/types/src/joiner/index.ts:51](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/joiner/index.ts#L51)
___
### serviceName
**serviceName**: `string`
#### Defined in
[packages/types/src/joiner/index.ts:34](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/joiner/index.ts#L34)

View File

@@ -0,0 +1,27 @@
---
displayed_sidebar: pricingReference
---
# JoinerServiceConfigAlias
## Properties
### args
`Optional` **args**: [`Record`](../types/Record.md)<`string`, `any`\>
Extra arguments to pass to the remoteFetchData callback
#### Defined in
[packages/types/src/joiner/index.ts:30](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/joiner/index.ts#L30)
___
### name
**name**: `string`
#### Defined in
[packages/types/src/joiner/index.ts:26](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/joiner/index.ts#L26)

View File

@@ -0,0 +1,79 @@
---
displayed_sidebar: pricingReference
---
# MoneyAmountDTO
An object that holds prices, which typically belong to a price set.
## Properties
### amount
`Optional` **amount**: `number`
A number indicating the amount of this price.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:20](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L20)
___
### currency
`Optional` **currency**: [`CurrencyDTO`](CurrencyDTO.md)
An object of type [CurrencyDTO](CurrencyDTO.md) that holds the details of the price's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:19](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L19)
___
### currency\_code
`Optional` **currency\_code**: `string`
A string that indicates the currency code of this price.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:18](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L18)
___
### id
**id**: `string`
A string that indicates the ID of the money amount. A money amount represents a price.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:17](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L17)
___
### max\_quantity
`Optional` **max\_quantity**: `number`
A number that indicates the maximum quantity required to be purchased for this price to be applied.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:22](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L22)
___
### min\_quantity
`Optional` **min\_quantity**: `number`
A number that indicates the minimum quantity required to be purchased for this price to be applied.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:21](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L21)

View File

@@ -0,0 +1,127 @@
---
displayed_sidebar: pricingReference
---
# PriceRuleDTO
An object that represents a price rule.
## Properties
### id
**id**: `string`
A string indicating the ID of the price rule.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:22](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L22)
___
### is\_dynamic
**is\_dynamic**: `boolean`
A boolean indicating whether the price rule is dynamic.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:27](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L27)
___
### price\_list\_id
**price\_list\_id**: `string`
A string indicating the ID of the associated price list.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:31](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L31)
___
### price\_set
**price\_set**: [`PriceSetDTO`](PriceSetDTO.md)
An object of type [PriceSetDTO](PriceSetDTO.md) that holds the data of the associated price set. It may only be available if the relation `price_set` is expanded.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:24](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L24)
___
### price\_set\_id
**price\_set\_id**: `string`
A string indicating the ID of the associated price set.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:23](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L23)
___
### price\_set\_money\_amount\_id
**price\_set\_money\_amount\_id**: `string`
A string indicating the ID of the associated price set money amount.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:30](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L30)
___
### priority
**priority**: `number`
A number indicating the priority of the price rule in comparison to other applicable price rules.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:29](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L29)
___
### rule\_type
**rule\_type**: [`RuleTypeDTO`](RuleTypeDTO.md)
An object of type [RuleTypeDTO](RuleTypeDTO.md) that holds the data of the associated rule type. It may only be available if the relation `rule_type` is expanded.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:26](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L26)
___
### rule\_type\_id
**rule\_type\_id**: `string`
A string indicating the ID of the associated rule type.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:25](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L25)
___
### value
**value**: `string`
A string indicating the value of the price rule.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:28](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L28)

View File

@@ -0,0 +1,43 @@
---
displayed_sidebar: pricingReference
---
# PriceSetDTO
An object that holds the details of a retrieved price set.
## Properties
### id
**id**: `string`
A string indicating the ID of the price set.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:48](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L48)
___
### money\_amounts
`Optional` **money\_amounts**: [`MoneyAmountDTO`](MoneyAmountDTO.md)[]
An array of objects of type [MoneyAmountDTO](MoneyAmountDTO.md), which holds the prices that belong to this price set.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:49](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L49)
___
### rule\_types
`Optional` **rule\_types**: [`RuleTypeDTO`](RuleTypeDTO.md)[]
An array of objects of type [RuleTypeDTO](RuleTypeDTO.md), which holds the rule types applied on this price set.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:50](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L50)

View File

@@ -0,0 +1,55 @@
---
displayed_sidebar: pricingReference
---
# PriceSetMoneyAmountDTO
An object representing a price set money amount, which holds the data related to the association between a price set and a money amount.
## Properties
### id
**id**: `string`
a string indicating the ID of a price set money amount.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount.ts:15](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount.ts#L15)
___
### money\_amount
`Optional` **money\_amount**: [`MoneyAmountDTO`](MoneyAmountDTO.md)
an object of type [MoneyAmountDTO](MoneyAmountDTO.md) holding the data of the associated money amount.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount.ts:18](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount.ts#L18)
___
### price\_set
`Optional` **price\_set**: [`PriceSetDTO`](PriceSetDTO.md)
an object of type [PriceSetDTO](PriceSetDTO.md) holding the data of the associated price set.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount.ts:17](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount.ts#L17)
___
### title
`Optional` **title**: `string`
a string indicating the title of the price set money amount.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount.ts:16](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount.ts#L16)

View File

@@ -0,0 +1,55 @@
---
displayed_sidebar: pricingReference
---
# PriceSetMoneyAmountRulesDTO
An object representing a price set money amount rule, which holds data related to the association between a price set money amount and a rule.
## Properties
### id
**id**: `string`
A string indicating the ID of the price set money amount.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:16](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L16)
___
### price\_set\_money\_amount
**price\_set\_money\_amount**: [`PriceSetMoneyAmountDTO`](PriceSetMoneyAmountDTO.md)
an object of type [PriceSetMoneyAmountDTO](PriceSetMoneyAmountDTO.md) holding the data of the associated price set money amount.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:17](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L17)
___
### rule\_type
**rule\_type**: [`RuleTypeDTO`](RuleTypeDTO.md)
an object of type [RuleTypeDTO](RuleTypeDTO.md) holding the data of the associated rule type.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:18](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L18)
___
### value
**value**: `string`
a string indicating the value of the price set money amount rule.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:19](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L19)

View File

@@ -0,0 +1,26 @@
---
displayed_sidebar: pricingReference
---
# PricingContext
Used to specify the context to calculate prices. For example, you can specify the currency code to calculate prices in.
**Example**
```ts
To calculate prices
```
## Properties
### context
`Optional` **context**: [`Record`](../types/Record.md)<`string`, `string` \| `number`\>
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.
Another 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.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:23](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L23)

View File

@@ -0,0 +1,19 @@
---
displayed_sidebar: pricingReference
---
# PricingFilters
Used to filter prices when calculating them.
## Properties
### id
**id**: `string`[]
An array of strings, each being an ID of a price set.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:34](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L34)

View File

@@ -0,0 +1,31 @@
---
displayed_sidebar: pricingReference
---
# RemovePriceSetRulesDTO
An object of expected properties when removing a price set's rules.
## Properties
### id
**id**: `string`
A string indicating the ID of the price set.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:118](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L118)
___
### rules
**rules**: `string`[]
An array of strings, each string is the `rule_attribute` of a rule you want to remove.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:119](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L119)

View File

@@ -0,0 +1,55 @@
---
displayed_sidebar: pricingReference
---
# RuleTypeDTO
An object that holds the details of a rule type.
## Properties
### default\_priority
**default\_priority**: `number`
A number indicating 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.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:17](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L17)
___
### id
**id**: `string`
A string indicating the ID of the rule type.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:14](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L14)
___
### name
**name**: `string`
A string indicating the display name of the rule type.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:15](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L15)
___
### rule\_attribute
**rule\_attribute**: `string`
A string indicating a 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.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:16](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L16)

View File

@@ -0,0 +1,56 @@
---
displayed_sidebar: pricingReference
---
# UpdateCurrencyDTO
An object that holds data to update a currency. The currency code must be provided to identify which currency to update.
## Properties
### code
**code**: `string`
a string indicating the code of the currency to update.
#### Defined in
[packages/types/src/pricing/common/currency.ts:54](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L54)
___
### name
`Optional` **name**: `string`
a string indicating the name of the currency.
#### Defined in
[packages/types/src/pricing/common/currency.ts:57](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L57)
___
### symbol
`Optional` **symbol**: `string`
a string indicating the symbol of the currency.
#### Defined in
[packages/types/src/pricing/common/currency.ts:55](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L55)
___
### symbol\_native
`Optional` **symbol\_native**: `string`
a string indicating the symbol of the currecy in its native form.
This is typically the symbol used when displaying a price.
#### Defined in
[packages/types/src/pricing/common/currency.ts:56](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/currency.ts#L56)

View File

@@ -0,0 +1,69 @@
---
displayed_sidebar: pricingReference
---
# UpdateMoneyAmountDTO
*
An object that holds data to update a money amount.
## Properties
### amount
`Optional` **amount**: `number`
A number indicating the amount of this money amount.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:61](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L61)
___
### currency\_code
`Optional` **currency\_code**: `string`
A string that indicates the currency code of the money amount.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:60](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L60)
___
### id
**id**: `string`
A string that indicates the ID of the money amount to update.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:59](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L59)
___
### max\_quantity
`Optional` **max\_quantity**: `number`
A number that indicates the maximum quantity required to be purchased for this money amount to be applied.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:63](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L63)
___
### min\_quantity
`Optional` **min\_quantity**: `number`
A number that indicates the minimum quantity required to be purchased for this money amount to be applied.
#### Defined in
[packages/types/src/pricing/common/money-amount.ts:62](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/money-amount.ts#L62)

View File

@@ -0,0 +1,91 @@
---
displayed_sidebar: pricingReference
---
# UpdatePriceRuleDTO
An object used to specify the necessary data to update a price rule.
## Properties
### id
**id**: `string`
A string indicating the ID of the price rule to update.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:75](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L75)
___
### price\_list\_id
`Optional` **price\_list\_id**: `string`
A string indicating the ID of the associated price list.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:88](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L88)
___
### price\_set\_id
`Optional` **price\_set\_id**: `string`
A string indicating the ID of the associated price set.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:76](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L76)
___
### price\_set\_money\_amount\_id
`Optional` **price\_set\_money\_amount\_id**: `string`
A string indicating the ID of the associated price set money amount.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:87](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L87)
___
### priority
`Optional` **priority**: `number`
A number indicating the priority of the price rule in comparison to other applicable price rules.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:86](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L86)
___
### rule\_type\_id
`Optional` **rule\_type\_id**: `string`
A string indicating the ID of the associated rule type.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:77](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L77)
___
### value
`Optional` **value**: `string`
A string indicating the value of the price rule.
#### Defined in
[packages/types/src/pricing/common/price-rule.ts:85](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-rule.ts#L85)

View File

@@ -0,0 +1,19 @@
---
displayed_sidebar: pricingReference
---
# UpdatePriceSetDTO
An object of expected properties when updating a price set.
## Properties
### id
**id**: `string`
A string indicating the ID of the price set to update.
#### Defined in
[packages/types/src/pricing/common/price-set.ts:145](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set.ts#L145)

View File

@@ -0,0 +1,55 @@
---
displayed_sidebar: pricingReference
---
# UpdatePriceSetMoneyAmountRulesDTO
An object used to update a price set money amount rule. The price set money amount rule is identified by the provided `id`.
## Properties
### id
**id**: `string`
A string indicating the ID of the price set money amount rule to update.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:48](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L48)
___
### price\_set\_money\_amount
`Optional` **price\_set\_money\_amount**: `string`
A string indicating the ID of a price set money amount.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:49](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L49)
___
### rule\_type
`Optional` **rule\_type**: `string`
A string indicating the ID of a rule type.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:50](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L50)
___
### value
`Optional` **value**: `string`
A string indicating the value of the price set money amount rule.
#### Defined in
[packages/types/src/pricing/common/price-set-money-amount-rules.ts:51](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/price-set-money-amount-rules.ts#L51)

View File

@@ -0,0 +1,55 @@
---
displayed_sidebar: pricingReference
---
# UpdateRuleTypeDTO
An object used when updating a rule type to specify the data to update.
## Properties
### default\_priority
`Optional` **default\_priority**: `number`
A number indicating 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.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:51](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L51)
___
### id
**id**: `string`
A string indicating the ID of the rule type to update.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:48](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L48)
___
### name
`Optional` **name**: `string`
A string indicating the display name of the rule type.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:49](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L49)
___
### rule\_attribute
`Optional` **rule\_attribute**: `string`
A string indicating a 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.
#### Defined in
[packages/types/src/pricing/common/rule-type.ts:50](https://github.com/medusajs/medusa/blob/daea35fe73/packages/types/src/pricing/common/rule-type.ts#L50)

View File

@@ -0,0 +1,20 @@
---
displayed_sidebar: pricingReference
---
# Exclude
**Exclude**<`T`, `U`\>: `T` extends `U` ? `never` : `T`
Exclude from T those types that are assignable to U
#### Type parameters
| Name |
| :------ |
| `T` |
| `U` |
#### Defined in
docs-util/node_modules/typescript/lib/lib.es5.d.ts:1606

Some files were not shown because too many files have changed in this diff Show More