NewTotalsService
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
__container__
anyRequiredfeatureFlagRouter_
FlagRouterRequiredmanager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
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
tax_total
numberRequiredtotal
numberRequiredtax_total
numberRequiredtotal
numberRequiredgetGiftCardableAmount
Parameters
__namedParameters
objectRequired__namedParameters.discount_total
numberRequired__namedParameters.shipping_total
numberRequired__namedParameters.subtotal
numberRequired__namedParameters.tax_total
numberRequired__namedParameters.gift_cards_taxable
booleanReturns
number
numberRequiredgetLineItemRefund
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
numberRequiredgetLineItemRefundLegacy
Parameters
lineItem
objectRequiredlineItem.id
stringRequiredlineItem.includes_tax
booleanRequiredlineItem.quantity
numberRequiredlineItem.unit_price
numberRequired__namedParameters
objectRequired__namedParameters.taxRate
numberRequiredReturns
number
numberRequiredgetLineItemTotals
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.taxRate
numberRequired__namedParameters.lineItemAllocation.discount
DiscountAllocation__namedParameters.lineItemAllocation.gift_card
GiftCardAllocationReturns
Promise
Promise<LineItemTotals>RequiredgetLineItemTotals_
Calculate and return the totals for an item
Parameters
__namedParameters
objectRequired__namedParameters.lineItemAllocation
objectRequired__namedParameters.includeTax
boolean__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.taxRate
numberRequired__namedParameters.discounts
Discount[]Returns
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
booleanRequiredwithTransaction
Parameters
transactionManager
EntityManagerReturns
NewTotalsService
objectRequired