TaxProviderService
Finds tax providers and assists in tax related operations.
constructor
Parameters
container
AwilixContainer<any>RequiredProperties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>cacheService_
ICacheServiceRequiredcontainer_
AwilixContainer<any>RequiredeventBus_
IEventBusServiceRequiredmanager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
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
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
Promise<TResult>RequiredclearLineItemsTaxLines
Parameters
itemIds
string[]RequiredReturns
Promise
Promise<void>RequiredclearTaxLines
Parameters
cartId
stringRequiredReturns
Promise
Promise<void>RequiredcreateShippingTaxLines
Persists the tax lines relevant for a shipping method to the database. Used for return shipping methods.
Parameters
Returns
createTaxLines
Persists the tax lines relevant for an order to the database.
Parameters
Returns
getCacheKey
The cache key to get cache hits by.
Parameters
id
stringRequiredregionId
stringRequiredReturns
string
stringgetRegionRatesForProduct
Gets the tax rates configured for a product. The rates are cached between calls.
Parameters
productIds
string | string[]Requiredregion
RegionDetailsRequiredReturns
getRegionRatesForShipping
Gets the tax rates configured for a shipping option. The rates are cached between calls.
Parameters
optionId
stringRequiredregionDetails
RegionDetailsRequiredReturns
getShippingTaxLines
Gets the relevant tax lines for a shipping method. Note: this method doesn't persist the tax lines. Use createShippingTaxLines if you wish to persist the tax lines to the DB layer.
Parameters
Returns
getTaxLines
Gets the relevant tax lines for an order or cart. If an order is provided the order's tax lines will be returned. If a cart is provided the tax lines will be computed from the tax rules and potentially a 3rd party tax plugin. Note: this method doesn't persist the tax lines. Use createTaxLines if you wish to persist the tax lines to the DB layer.
Parameters
Returns
getTaxLinesMap
Return a map of tax lines for line items and shipping methods
Parameters
Returns
Promise
Promise<TaxLinesMaps>Requiredlist
Returns
registerInstalledProviders
Parameters
providers
string[]RequiredReturns
Promise
Promise<void>RequiredretrieveProvider
Retrieves the relevant tax provider for the given region.
Parameters
Returns
ITaxService
objectRequiredgetTaxLines
that returns numerical rates to apply to line
items and shipping methods.shouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanwithTransaction
Parameters
transactionManager
EntityManagerReturns
TaxProviderService
objectRequired