Files
medusa-store/www/apps/docs/content/references/services/classes/TaxRateService.mdx
github-actions[bot] cdd42dbdcd chore(docs): Generated References (#5743)
Generated the following references:
- `entities`
- `inventory`
- `js-client`
- `pricing`
- `product`
- `services`
- `stock-location`
- `workflows`

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
2023-11-27 18:58:52 +00:00

903 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&#60;[TaxRate](TaxRate.mdx)&#62; & ``{ 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` **activeManager\_**: [object Object]
## Methods
#### addToProduct
`**addToProduct**(id, productIds, replace?): Promise&#60;[ProductTaxRate](ProductTaxRate.mdx) \| [ProductTaxRate](ProductTaxRate.mdx)[]&#62;`
##### 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&#60;[ProductTaxRate](ProductTaxRate.mdx) \| [ProductTaxRate](ProductTaxRate.mdx)[]&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[ProductTaxRate](ProductTaxRate.mdx) \\| [ProductTaxRate](ProductTaxRate.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### addToProductType
`**addToProductType**(id, productTypeIds, replace?): Promise&#60;[ProductTypeTaxRate](ProductTypeTaxRate.mdx)[]&#62;`
##### 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&#60;[ProductTypeTaxRate](ProductTypeTaxRate.mdx)[]&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[ProductTypeTaxRate](ProductTypeTaxRate.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### addToShippingOption
`**addToShippingOption**(id, optionIds, replace?): Promise&#60;[ShippingTaxRate](ShippingTaxRate.mdx)[]&#62;`
##### 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&#60;[ShippingTaxRate](ShippingTaxRate.mdx)[]&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[ShippingTaxRate](ShippingTaxRate.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### atomicPhase\_
`Protected **atomicPhase_**<TypeParameter TResult, TypeParameter TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise&#60;TResult&#62;`
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.
##### Type Parameters
<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&#60;TResult&#62;",
"description": "the transactional work to be done",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationOrErrorHandler",
"type": "`IsolationLevel` \\| (`error`: `TError`) => Promise&#60;void \\| TResult&#62;",
"description": "the isolation level to be used for the work.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "maybeErrorHandlerOrDontFail",
"type": "(`error`: `TError`) => Promise&#60;void \\| TResult&#62;",
"description": "Potential error handler",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
##### Returns
Promise&#60;TResult&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;TResult&#62;",
"optional": false,
"defaultValue": "",
"description": "the result of the transactional work",
"expandable": false,
"children": []
}
]} />
___
#### create
`**create**(data): Promise&#60;[TaxRate](TaxRate.mdx)&#62;`
##### Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[CreateTaxRateInput](../types/CreateTaxRateInput.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
##### Returns
Promise&#60;[TaxRate](TaxRate.mdx)&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[TaxRate](TaxRate.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### delete
`**delete**(id): Promise&#60;void&#62;`
##### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string` \\| `string`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
##### Returns
Promise&#60;void&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### list
`**list**(selector, config?): Promise&#60;[TaxRate](TaxRate.mdx)[]&#62;`
##### Parameters
<ParameterTypes parameters={[
{
"name": "selector",
"type": "[FilterableTaxRateProps](../types/FilterableTaxRateProps.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "config",
"type": "[FindConfig](../interfaces/FindConfig.mdx)&#60;[TaxRate](TaxRate.mdx)&#62;",
"description": "",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
##### Returns
Promise&#60;[TaxRate](TaxRate.mdx)[]&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[TaxRate](TaxRate.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### listAndCount
`**listAndCount**(selector, config?): Promise&#60;[[TaxRate](TaxRate.mdx)[], number]&#62;`
##### Parameters
<ParameterTypes parameters={[
{
"name": "selector",
"type": "[FilterableTaxRateProps](../types/FilterableTaxRateProps.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "config",
"type": "[FindConfig](../interfaces/FindConfig.mdx)&#60;[TaxRate](TaxRate.mdx)&#62;",
"description": "",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
##### Returns
Promise&#60;[[TaxRate](TaxRate.mdx)[], number]&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[[TaxRate](TaxRate.mdx)[], number]&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### listByProduct
`**listByProduct**(productId, config): Promise&#60;[TaxRate](TaxRate.mdx)[]&#62;`
##### 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&#60;[TaxRate](TaxRate.mdx)[]&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[TaxRate](TaxRate.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### listByShippingOption
`**listByShippingOption**(shippingOptionId): Promise&#60;[TaxRate](TaxRate.mdx)[]&#62;`
##### Parameters
<ParameterTypes parameters={[
{
"name": "shippingOptionId",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
##### Returns
Promise&#60;[TaxRate](TaxRate.mdx)[]&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[TaxRate](TaxRate.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### removeFromProduct
`**removeFromProduct**(id, productIds): Promise&#60;void&#62;`
##### 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&#60;void&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### removeFromProductType
`**removeFromProductType**(id, typeIds): Promise&#60;void&#62;`
##### 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&#60;void&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### removeFromShippingOption
`**removeFromShippingOption**(id, optionIds): Promise&#60;void&#62;`
##### 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&#60;void&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
#### retrieve
`**retrieve**(taxRateId, config?): Promise&#60;[TaxRate](TaxRate.mdx)&#62;`
##### Parameters
<ParameterTypes parameters={[
{
"name": "taxRateId",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "config",
"type": "[FindConfig](../interfaces/FindConfig.mdx)&#60;[TaxRate](TaxRate.mdx)&#62;",
"description": "",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
##### Returns
Promise&#60;[TaxRate](TaxRate.mdx)&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[TaxRate](TaxRate.mdx)&#62;",
"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&#60;[TaxRate](TaxRate.mdx)&#62;`
##### 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&#60;[TaxRate](TaxRate.mdx)&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[TaxRate](TaxRate.mdx)&#62;",
"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": []
}
]} />