Files
medusa-store/www/apps/docs/content/references/services/classes/TaxRateService.mdx
github-actions[bot] 39649b3552 chore(docs): Generated References (#5602)
Generated the following references:
- `pricing`
- `product`

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
2023-11-10 17:31:02 +00:00

917 lines
18 KiB
Plaintext

---
displayed_sidebar: servicesSidebar
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# TaxRateService
## Constructors
### constructor
**new TaxRateService**(`«destructured»`)
#### Parameters
<ParameterTypes parameters={[
{
"name": "__namedParameters",
"type": "`Object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Properties
<ParameterTypes parameters={[
{
"name": "__configModule__",
"type": "Record<`string`, `unknown`\\>",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__container__",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__moduleDeclaration__",
"type": "Record<`string`, `unknown`\\>",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager_",
"type": "`EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "productService_",
"type": "[`ProductService`](ProductService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "productTypeService_",
"type": "[`ProductTypeService`](ProductTypeService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "shippingOptionService_",
"type": "[`ShippingOptionService`](ShippingOptionService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "taxRateRepository_",
"type": "`Repository`<[`TaxRate`](TaxRate.mdx)\\> & { `addToProduct`: Method addToProduct ; `addToProductType`: Method addToProductType ; `addToShippingOption`: Method addToShippingOption ; `applyResolutionsToQueryBuilder`: Method applyResolutionsToQueryBuilder ; `findAndCountWithResolution`: Method findAndCountWithResolution ; `findOneWithResolution`: Method findOneWithResolution ; `findWithResolution`: Method findWithResolution ; `getFindQueryBuilder`: Method getFindQueryBuilder ; `listByProduct`: Method listByProduct ; `listByShippingOption`: Method listByShippingOption ; `removeFromProduct`: Method removeFromProduct ; `removeFromProductType`: Method removeFromProductType ; `removeFromShippingOption`: Method removeFromShippingOption }",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager_",
"type": "`undefined` \\| `EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Accessors
### activeManager\_
`Protected` `get` **activeManager_**(): `EntityManager`
#### Returns
`EntityManager`
<ParameterTypes parameters={[
{
"name": "EntityManager",
"type": "`EntityManager`",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
## Methods
### addToProduct
**addToProduct**(`id`, `productIds`, `replace?`): `Promise`<[`ProductTaxRate`](ProductTaxRate.mdx) \| [`ProductTaxRate`](ProductTaxRate.mdx)[]\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "productIds",
"type": "`string` \\| `string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "replace",
"type": "`boolean`",
"description": "",
"optional": false,
"defaultValue": "false",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`ProductTaxRate`](ProductTaxRate.mdx) \| [`ProductTaxRate`](ProductTaxRate.mdx)[]\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<[`ProductTaxRate`](ProductTaxRate.mdx) \\| [`ProductTaxRate`](ProductTaxRate.mdx)[]\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### addToProductType
**addToProductType**(`id`, `productTypeIds`, `replace?`): `Promise`<[`ProductTypeTaxRate`](ProductTypeTaxRate.mdx)[]\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "productTypeIds",
"type": "`string` \\| `string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "replace",
"type": "`boolean`",
"description": "",
"optional": false,
"defaultValue": "false",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`ProductTypeTaxRate`](ProductTypeTaxRate.mdx)[]\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<[`ProductTypeTaxRate`](ProductTypeTaxRate.mdx)[]\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### addToShippingOption
**addToShippingOption**(`id`, `optionIds`, `replace?`): `Promise`<[`ShippingTaxRate`](ShippingTaxRate.mdx)[]\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "optionIds",
"type": "`string` \\| `string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "replace",
"type": "`boolean`",
"description": "",
"optional": false,
"defaultValue": "false",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`ShippingTaxRate`](ShippingTaxRate.mdx)[]\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<[`ShippingTaxRate`](ShippingTaxRate.mdx)[]\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### atomicPhase\_
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
Wraps some work within a transactional block. If the service already has
a transaction manager attached this will be reused, otherwise a new
transaction manager is created.
<ParameterTypes parameters={[
{
"name": "TResult",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "TError",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Parameters
<ParameterTypes parameters={[
{
"name": "work",
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
"description": "the transactional work to be done",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationOrErrorHandler",
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
"description": "the isolation level to be used for the work.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "maybeErrorHandlerOrDontFail",
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
"description": "Potential error handler",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<`TResult`\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<`TResult`\\>",
"optional": false,
"defaultValue": "",
"description": "the result of the transactional work",
"expandable": false,
"children": []
}
]} />
___
### create
**create**(`data`): `Promise`<[`TaxRate`](TaxRate.mdx)\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[`CreateTaxRateInput`](../types/CreateTaxRateInput.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`TaxRate`](TaxRate.mdx)\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<[`TaxRate`](TaxRate.mdx)\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### delete
**delete**(`id`): `Promise`<`void`\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string` \\| `string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<`void`\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<`void`\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### list
**list**(`selector`, `config?`): `Promise`<[`TaxRate`](TaxRate.mdx)[]\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "selector",
"type": "[`FilterableTaxRateProps`](../types/FilterableTaxRateProps.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "config",
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`TaxRate`](TaxRate.mdx)\\>",
"description": "",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`TaxRate`](TaxRate.mdx)[]\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<[`TaxRate`](TaxRate.mdx)[]\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### listAndCount
**listAndCount**(`selector`, `config?`): `Promise`<[[`TaxRate`](TaxRate.mdx)[], `number`]\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "selector",
"type": "[`FilterableTaxRateProps`](../types/FilterableTaxRateProps.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "config",
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`TaxRate`](TaxRate.mdx)\\>",
"description": "",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[[`TaxRate`](TaxRate.mdx)[], `number`]\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<[[`TaxRate`](TaxRate.mdx)[], `number`]\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### listByProduct
**listByProduct**(`productId`, `config`): `Promise`<[`TaxRate`](TaxRate.mdx)[]\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "productId",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "config",
"type": "[`TaxRateListByConfig`](../types/TaxRateListByConfig.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`TaxRate`](TaxRate.mdx)[]\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<[`TaxRate`](TaxRate.mdx)[]\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### listByShippingOption
**listByShippingOption**(`shippingOptionId`): `Promise`<[`TaxRate`](TaxRate.mdx)[]\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "shippingOptionId",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`TaxRate`](TaxRate.mdx)[]\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<[`TaxRate`](TaxRate.mdx)[]\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### removeFromProduct
**removeFromProduct**(`id`, `productIds`): `Promise`<`void`\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "productIds",
"type": "`string` \\| `string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<`void`\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<`void`\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### removeFromProductType
**removeFromProductType**(`id`, `typeIds`): `Promise`<`void`\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "typeIds",
"type": "`string` \\| `string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<`void`\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<`void`\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### removeFromShippingOption
**removeFromShippingOption**(`id`, `optionIds`): `Promise`<`void`\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "optionIds",
"type": "`string` \\| `string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<`void`\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<`void`\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### retrieve
**retrieve**(`taxRateId`, `config?`): `Promise`<[`TaxRate`](TaxRate.mdx)\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "taxRateId",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "config",
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`TaxRate`](TaxRate.mdx)\\>",
"description": "",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`TaxRate`](TaxRate.mdx)\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<[`TaxRate`](TaxRate.mdx)\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### shouldRetryTransaction\_
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
#### Parameters
<ParameterTypes parameters={[
{
"name": "err",
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`boolean`
<ParameterTypes parameters={[
{
"name": "boolean",
"type": "`boolean`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### update
**update**(`id`, `data`): `Promise`<[`TaxRate`](TaxRate.mdx)\>
#### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "data",
"type": "[`UpdateTaxRateInput`](../types/UpdateTaxRateInput.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`TaxRate`](TaxRate.mdx)\>
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "`Promise`<[`TaxRate`](TaxRate.mdx)\\>",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### withTransaction
**withTransaction**(`transactionManager?`): [`TaxRateService`](TaxRateService.mdx)
#### Parameters
<ParameterTypes parameters={[
{
"name": "transactionManager",
"type": "`EntityManager`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
[`TaxRateService`](TaxRateService.mdx)
<ParameterTypes parameters={[
{
"name": "TaxRateService",
"type": "[`TaxRateService`](TaxRateService.mdx)",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />