LineItemAdjustmentService
Provides layer to manipulate line item adjustments.
constructor
Parameters
__namedParameters
LineItemAdjustmentServicePropsRequiredProperties
__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.
Type Parameters
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Potential error handler
Returns
Promise
Promise<TResult>Requiredthe result of the transactional work
create
Creates a line item adjustment
Parameters
the line item adjustment to create
Returns
line item adjustment
createAdjustmentForLineItem
Creates adjustment for a line item
Parameters
Returns
a line item adjustment or undefined if no adjustment was created
createAdjustments
Creates adjustment for a line item
Parameters
Returns
if a lineItem was given, returns a line item adjustment or undefined if no adjustment was created
otherwise returns an array of line item adjustments for each line item in the cart
delete
Deletes line item adjustments matching a selector
Parameters
selectorOrIds
string | string[] | FilterableLineItemAdjustmentProps & objectRequiredthe query object for find or the line item adjustment id
Returns
Promise
Promise<void>Requiredthe result of the delete operation
generateAdjustments
Creates adjustment for a line item
Parameters
calculationContextData
CalculationContextDataRequiredthe calculationContextData object holding discounts
the line item for which a line item adjustment might be created
context
AdjustmentContextRequiredthe line item for which a line item adjustment might be created
Returns
Promise
Promise<GeneratedAdjustment[]>Requireda line item adjustment or undefined if no adjustment was created
list
Lists line item adjustments
Parameters
selector
FilterableLineItemAdjustmentPropsRequiredthe query object for find
Default: {}
the config to be used for find
Returns
the result of the find operation
retrieve
Retrieves a line item adjustment by id.
Parameters
lineItemAdjustmentId
stringRequiredthe id of the line item adjustment to retrieve
the config to retrieve the line item adjustment by
Default: {}
Returns
the line item adjustment.
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanupdate
Creates a line item adjustment
Parameters
id
stringRequiredthe line item adjustment id to update
the line item adjustment to create
Returns
line item adjustment
withTransaction
Parameters
transactionManager
EntityManagerReturns
LineItemAdjustmentService
objectRequiredProvides layer to manipulate line item adjustments.
Was this section helpful?