NewTotalsService
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>featureFlagRouter_
FlagRouterRequiredmanager_
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>RequiredgetGiftCardTotals
Calculate and return the gift cards totals
Parameters
Returns
Promise
Promise<object>RequiredgetGiftCardTransactionsTotals
Calculate and return the gift cards totals based on their transactions
Parameters
__namedParameters
objectRequired__namedParameters.giftCardTransactions
GiftCardTransaction[]Required__namedParameters.region
objectRequired__namedParameters.region.gift_cards_taxable
booleanRequired__namedParameters.region.tax_rate
numberRequiredReturns
object
objecttax_total
numberRequiredtotal
numberRequiredgetGiftCardableAmount
Parameters
__namedParameters
objectRequired__namedParameters.discount_total
numberRequired__namedParameters.gift_cards_taxable
boolean__namedParameters.shipping_total
numberRequired__namedParameters.subtotal
numberRequired__namedParameters.tax_total
numberRequiredReturns
number
numbergetLineItemRefund
Return the amount that can be refund on a line item
Parameters
lineItem
objectRequiredlineItem.id
stringRequiredlineItem.includes_tax
booleanRequiredlineItem.quantity
numberRequiredlineItem.unit_price
numberRequired__namedParameters
objectRequired__namedParameters.taxRate
null | numberReturns
number
numbergetLineItemRefundLegacy
Parameters
lineItem
objectRequiredlineItem.id
stringRequiredlineItem.includes_tax
booleanRequiredlineItem.quantity
numberRequiredlineItem.unit_price
numberRequired__namedParameters
objectRequired__namedParameters.taxRate
numberRequiredReturns
number
numbergetLineItemTotals
Calculate and return the items totals for either the legacy calculation or the new calculation
Parameters
__namedParameters
objectRequired__namedParameters.includeTax
boolean__namedParameters.taxRate
null | numberReturns
Promise
Promise<object>RequiredgetLineItemTotalsLegacy
Calculate and return the legacy calculated totals using the tax rate
Parameters
__namedParameters
objectRequired__namedParameters.lineItemAllocation
objectRequired__namedParameters.lineItemAllocation.discount
DiscountAllocation__namedParameters.lineItemAllocation.gift_card
GiftCardAllocation__namedParameters.taxRate
numberRequiredReturns
Promise
Promise<LineItemTotals>RequiredgetLineItemTotals_
Calculate and return the totals for an item
Parameters
__namedParameters
objectRequired__namedParameters.includeTax
boolean__namedParameters.lineItemAllocation
objectRequired__namedParameters.lineItemAllocation.discount
DiscountAllocation__namedParameters.lineItemAllocation.gift_card
GiftCardAllocation__namedParameters.taxLines
LineItemTaxLine[]Returns
Promise
Promise<LineItemTotals>RequiredgetShippingMethodTotals
Calculate and return the shipping methods totals for either the legacy calculation or the new calculation
Parameters
__namedParameters
objectRequired__namedParameters.discounts
Discount[]__namedParameters.includeTax
boolean__namedParameters.taxRate
null | numberReturns
Promise
Promise<object>RequiredgetShippingMethodTotalsLegacy
Calculate and return the shipping method totals legacy using the tax rate
Parameters
__namedParameters
objectRequired__namedParameters.discounts
Discount[]__namedParameters.taxRate
numberRequiredReturns
Promise
Promise<ShippingMethodTotals>RequiredgetShippingMethodTotals_
Calculate and return the shipping method totals
Parameters
__namedParameters
objectRequired__namedParameters.discounts
Discount[]__namedParameters.includeTax
boolean__namedParameters.taxLines
ShippingMethodTaxLine[]Returns
Promise
Promise<ShippingMethodTotals>RequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanwithTransaction
Parameters
transactionManager
EntityManagerReturns
NewTotalsService
objectRequired