---
displayed_sidebar: servicesSidebar
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# NewTotalsService
## Constructors
#### constructor
`**new NewTotalsService**(«destructured»)`
##### 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": "featureFlagRouter_",
"type": "[FlagRouter](FlagRouter.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager_",
"type": "EntityManager",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "taxCalculationStrategy_",
"type": "[ITaxCalculationStrategy](../interfaces/ITaxCalculationStrategy.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "taxProviderService_",
"type": "[TaxProviderService](TaxProviderService.mdx)",
"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
#### atomicPhase\_
`Protected **atomicPhase_**(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.
##### 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
Promise<TResult>
___
#### getGiftCardTotals
`**getGiftCardTotals**(giftCardableAmount, «destructured»): Promise<{ tax_total: number ; total: number }>`
Calculate and return the gift cards totals
##### Parameters
##### Returns
Promise<{ tax_total: number ; total: number }>
___
#### getGiftCardTransactionsTotals
`**getGiftCardTransactionsTotals**(«destructured»): { tax_total: number ; total: number }`
Calculate and return the gift cards totals based on their transactions
##### Parameters
##### Returns
`object`
___
#### getGiftCardableAmount
`**getGiftCardableAmount**(«destructured»): number`
##### Parameters
##### Returns
`number`
___
#### getLineItemRefund
`**getLineItemRefund**(lineItem, «destructured»): number`
Return the amount that can be refund on a line item
##### Parameters
##### Returns
`number`
___
#### getLineItemRefundLegacy
`Protected **getLineItemRefundLegacy**(lineItem, «destructured»): number`
##### Parameters
##### Returns
`number`
___
#### getLineItemTotals
`**getLineItemTotals**(items, «destructured»): Promise<{ [lineItemId: string]: [LineItemTotals](../types/LineItemTotals.mdx); }>`
Calculate and return the items totals for either the legacy calculation or the new calculation
##### Parameters
##### Returns
Promise<{ [lineItemId: string]: [LineItemTotals](../types/LineItemTotals.mdx); }>
___
#### getLineItemTotalsLegacy
`Protected **getLineItemTotalsLegacy**(item, «destructured»): Promise<[LineItemTotals](../types/LineItemTotals.mdx)>`
Calculate and return the legacy calculated totals using the tax rate
##### Parameters
##### Returns
Promise<[LineItemTotals](../types/LineItemTotals.mdx)>
___
#### getLineItemTotals\_
`Protected **getLineItemTotals_**(item, «destructured»): Promise<[LineItemTotals](../types/LineItemTotals.mdx)>`
Calculate and return the totals for an item
##### Parameters
##### Returns
Promise<[LineItemTotals](../types/LineItemTotals.mdx)>
___
#### getShippingMethodTotals
`**getShippingMethodTotals**(shippingMethods, «destructured»): Promise<{ [shippingMethodId: string]: [ShippingMethodTotals](../types/ShippingMethodTotals.mdx); }>`
Calculate and return the shipping methods totals for either the legacy calculation or the new calculation
##### Parameters
##### Returns
Promise<{ [shippingMethodId: string]: [ShippingMethodTotals](../types/ShippingMethodTotals.mdx); }>
___
#### getShippingMethodTotalsLegacy
`Protected **getShippingMethodTotalsLegacy**(shippingMethod, «destructured»): Promise<[ShippingMethodTotals](../types/ShippingMethodTotals.mdx)>`
Calculate and return the shipping method totals legacy using the tax rate
##### Parameters
##### Returns
Promise<[ShippingMethodTotals](../types/ShippingMethodTotals.mdx)>
___
#### getShippingMethodTotals\_
`Protected **getShippingMethodTotals_**(shippingMethod, «destructured»): Promise<[ShippingMethodTotals](../types/ShippingMethodTotals.mdx)>`
Calculate and return the shipping method totals
##### Parameters
##### Returns
Promise<[ShippingMethodTotals](../types/ShippingMethodTotals.mdx)>
___
#### shouldRetryTransaction\_
`Protected **shouldRetryTransaction_**(err): boolean`
##### Parameters
` \\| ``{ code: string }``",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
##### Returns
`boolean`
___
#### withTransaction
`**withTransaction**(transactionManager?): [NewTotalsService](NewTotalsService.mdx)`
##### Parameters
##### Returns
[NewTotalsService](NewTotalsService.mdx)