---
displayed_sidebar: servicesSidebar
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# RegionService
Provides layer to manipulate regions.
## constructor
### Parameters
___
## Properties
`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__container__",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__moduleDeclaration__",
"type": "`Record`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "countryRepository_",
"type": "Repository<[Country](../../entities/classes/entities.Country.mdx)>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "currencyRepository_",
"type": "Repository<[Currency](../../entities/classes/entities.Currency.mdx)>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "eventBus_",
"type": "[EventBusService](services.EventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "featureFlagRouter_",
"type": "`FlagRouter`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fulfillmentProviderRepository_",
"type": "Repository<[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fulfillmentProviderService_",
"type": "[FulfillmentProviderService](services.FulfillmentProviderService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager_",
"type": "`EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "paymentProviderRepository_",
"type": "Repository<[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "paymentProviderService_",
"type": "[PaymentProviderService](services.PaymentProviderService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "regionRepository_",
"type": "Repository<[Region](../../entities/classes/entities.Region.mdx)>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "storeService_",
"type": "[StoreService](services.StoreService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "taxProviderRepository_",
"type": "Repository<[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager_",
"type": "`undefined` \\| `EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "Events",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "Events.CREATED",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"region.created\"",
"expandable": false,
"children": []
},
{
"name": "Events.DELETED",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"region.deleted\"",
"expandable": false,
"children": []
},
{
"name": "Events.UPDATED",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"region.updated\"",
"expandable": false,
"children": []
}
]} />
___
## Accessors
### activeManager\_
#### Returns
___
## Methods
### addCountry
Adds a country to the region.
#### Parameters
#### Returns
___
### addFulfillmentProvider
Adds a fulfillment provider that is available in the region. Fails if the
provider doesn't exist.
#### Parameters
#### Returns
___
### addPaymentProvider
Adds a payment provider that is available in the region. Fails if the
provider doesn't exist.
#### Parameters
#### Returns
___
### atomicPhase\_
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
#### Parameters
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
___
### create
Creates a region.
#### Parameters
#### Returns
___
### delete
Deletes a region.
#### Parameters
#### Returns
___
### list
Lists all regions based on a query
#### Parameters
#### Returns
___
### listAndCount
Lists all regions based on a query and returns them along with count
#### Parameters
#### Returns
___
### removeCountry
Removes a country from a Region.
#### Parameters
#### Returns
___
### removeFulfillmentProvider
Removes a fulfillment provider from a region. Is idempotent.
#### Parameters
#### Returns
___
### removePaymentProvider
Removes a payment provider from a region. Is idempotent.
#### Parameters
#### Returns
___
### retrieve
Retrieves a region by its id.
#### Parameters
#### Returns
___
### retrieveByCountryCode
Retrieve a region by country code.
#### Parameters
#### Returns
___
### retrieveByName
Retrieves a region by name.
#### Parameters
#### Returns
___
### shouldRetryTransaction\_
#### Parameters
` \\| `object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
___
### update
Updates a region
#### Parameters
#### Returns
___
### validateCountry
Validates a country code. Will normalize the code before checking for
existence.
#### Parameters
#### Returns
___
### validateCurrency
Validates a currency code. Will throw if the currency code doesn't exist.
#### Parameters
#### Returns
#### Throws
if the provided currency code is invalid
___
### validateFields
Validates fields for creation and updates. If the region already exists
the id can be passed to check that country updates are allowed.
#### Type Parameters
#### Parameters
#### Returns
___
### validateTaxRate
Validates a tax rate. Will throw if the tax rate is not between 0 and 1.
#### Parameters
#### Returns
#### Throws
if the tax rate isn't number between 0-100
___
### withTransaction
#### Parameters
#### Returns