NewTotalsService
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
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.
Parameters
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
giftCardableAmount
numberRequired__namedParameters
objectRequired__namedParameters.giftCardTransactions
GiftCardTransaction[]__namedParameters.giftCards
GiftCard[]Returns
Promise
Promise<{ tax_total: number ; total: number }>RequiredgetGiftCardTransactionsTotals
Calculate and return the gift cards totals based on their transactions
Parameters
__namedParameters
objectRequired__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
getLineItemTotalsLegacy
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
getLineItemTotals_
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
getShippingMethodTotals
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
getShippingMethodTotalsLegacy
Calculate and return the shipping method totals legacy using the tax rate
Parameters
__namedParameters
objectRequired__namedParameters.discounts
Discount[]__namedParameters.taxRate
numberRequiredReturns
getShippingMethodTotals_
Calculate and return the shipping method totals
Parameters
__namedParameters
objectRequired__namedParameters.discounts
Discount[]__namedParameters.includeTax
boolean__namedParameters.taxLines
ShippingMethodTaxLine[]Returns
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
booleanwithTransaction
Parameters
transactionManager
EntityManager