Files
medusa-store/www/apps/docs/content/references/IPricingModuleService/methods/pricing.IPricingModuleService.retrievePriceSetMoneyAmountRules.mdx
Shahed Nasser 892d737c1f docs: enhance how references are generated (#5805)
* adjusted configurations

* enhancements to tool and configurations

* change reference in docs

* fixed issue in workflows reference

* added project name

* more optimizations

* fix context error

* added a types reference

* resolved missing types

* fix reference reflection types not having children

* add an expand url parameter

* added new option to the README

* added details about new option
2023-12-05 15:29:41 +02:00

338 lines
11 KiB
Plaintext

---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/retrievePriceSetMoneyAmountRules
sidebar_label: retrievePriceSetMoneyAmountRules
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# retrievePriceSetMoneyAmountRules - Pricing Module Reference
This documentation provides a reference to the `retrievePriceSetMoneyAmountRules` method. This belongs to the Pricing Module.
This method is used to a price set money amount rule by its ID based on the provided configuration.
## Example
A simple example that retrieves a price set money amount rule by its ID:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceSetMoneyAmountRule (id: string) {
const pricingService = await initializePricingModule()
const priceSetMoneyAmountRule = await pricingService.retrievePriceSetMoneyAmountRules(id)
// do something with the price set money amount rule or return it
}
```
To specify relations that should be retrieved:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceSetMoneyAmountRule (id: string) {
const pricingService = await initializePricingModule()
const priceSetMoneyAmountRule = await pricingService.retrievePriceSetMoneyAmountRules(id, {
relations: ["price_set_money_amount"]
})
// do something with the price set money amount rule or return it
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "The ID of the price set money amount rule to retrieve.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "config",
"type": "[FindConfig](../../pricing/interfaces/pricing.FindConfig.mdx)&#60;[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)&#62;",
"description": "The configurations determining how the price set money amount rule is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a price set money amount rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "order",
"type": "`object`",
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "relations",
"type": "`string`[]",
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "select",
"type": "(`string` \\| keyof `Entity`)[]",
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "skip",
"type": "`null` \\| `number`",
"description": "A number indicating the number of records to skip before retrieving the results.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "take",
"type": "`null` \\| `number`",
"description": "A number indicating the number of records to return in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "withDeleted",
"type": "`boolean`",
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../pricing/interfaces/pricing.Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceSetMoneyAmountRulesDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountRulesDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The retrieved price set money amount rule.",
"expandable": false,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The ID of the price set money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../pricing/interfaces/pricing.PriceSetMoneyAmountDTO.mdx)",
"description": "The associated price set money amount.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The ID of a price set money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amount",
"type": "[MoneyAmountDTO](../../pricing/interfaces/pricing.MoneyAmountDTO.mdx)",
"description": "The money amount associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../pricing/interfaces/pricing.PriceListDTO.mdx)",
"description": "The price list associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_rules",
"type": "[PriceRuleDTO](../../pricing/interfaces/pricing.PriceRuleDTO.mdx)[]",
"description": "The price rules associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set",
"type": "[PriceSetDTO](../../pricing/interfaces/pricing.PriceSetDTO.mdx)",
"description": "The price set associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set_id",
"type": "`string`",
"description": "The ID of the associated price set.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../pricing/interfaces/pricing.RuleTypeDTO.mdx)",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "default_priority",
"type": "`number`",
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy \nthe provided context. The higher the value, the higher the priority of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "name",
"type": "`string`",
"description": "The display name of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_attribute",
"type": "`string`",
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of \nthe `calculatePrices` method to specify a rule for calculating the price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "value",
"type": "`string`",
"description": "The value of the price set money amount rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />