# tax This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`. ## `tax.create` *Source: `src/store/tax/create.js`* Creates a new tax rate. **Parameters** | Name | Type | Description | | --- | --- | --- | | `rate` | `number` | The tax rate in percent (e.g. `19`). | | `[tx]` | `object` | Optional transaction to run within. | **Returns** `Promise` — The id of the created tax rate. **Example** ```js const id = await store.tax.create(19); // => 1 ``` ## `tax.ensure` *Source: `src/store/tax/ensure.js`* Returns the id of a tax rate, creating it if it does not exist. **Parameters** | Name | Type | Description | | --- | --- | --- | | `rate` | `number` | The tax rate in percent (e.g. `19`). | | `[tx]` | `object` | Optional transaction to run within. | **Returns** `Promise` — The id of the tax rate. **Example** ```js const id = await store.tax.ensure(19); // => 1 ``` ## `tax.getByRate` *Source: `src/store/tax/getByRate.js`* Returns a tax row by its rate. **Parameters** | Name | Type | Description | | --- | --- | --- | | `rate` | `number` | The tax rate in percent (e.g. `19`). | | `[tx]` | `object` | Optional transaction to run within. | **Returns** `Promise<{id: number, rate: number}>` — The tax row, or `undefined` if not found. **Example** ```js const tax = await store.tax.getByRate(19); // => { id: 1, rate: 19 } ``` ## `tax.list` *Source: `src/store/tax/list.js`* Lists all tax rates. **Returns** `Promise>` — All tax rate rows. **Example** ```js const taxes = await store.tax.list(); // => [{ id: 1, rate: 19 }] ```