LineItemAdjustmentService
Provides layer to manipulate line item adjustments.
constructor
Parameters
__namedParametersLineItemAdjustmentServicePropsRequiredProperties
manager_EntityManagerRequiredtransactionManager_undefined | EntityManagerRequired__container__anyRequired__configModule__Record<string, unknown>__moduleDeclaration__Record<string, unknown>Accessors
activeManager_
Returns
EntityManagerEntityManagerRequiredMethods
withTransaction
Parameters
transactionManagerEntityManagerReturns
thisthisRequiredshouldRetryTransaction_
Parameters
errRecord<string, unknown> | objectRequiredReturns
booleanbooleanRequiredatomicPhase_
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
TResultobjectRequiredTErrorobjectRequiredParameters
work(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>Potential error handler
Returns
PromisePromise<TResult>Requiredthe result of the transactional work
retrieve
Retrieves a line item adjustment by id.
Parameters
lineItemAdjustmentIdstringRequiredthe id of the line item adjustment to retrieve
the config to retrieve the line item adjustment by
Default: {}
Returns
the line item adjustment.
create
Creates a line item adjustment
Parameters
the line item adjustment to create
Returns
line item adjustment
update
Creates a line item adjustment
Parameters
idstringRequiredthe line item adjustment id to update
the line item adjustment to create
Returns
line item adjustment
list
Lists line item adjustments
Parameters
selectorFilterableLineItemAdjustmentPropsRequiredthe query object for find
Default: {}
the config to be used for find
Returns
the result of the find operation
delete
Deletes line item adjustments matching a selector
Parameters
selectorOrIdsstring | string[] | FilterableLineItemAdjustmentProps & objectRequiredthe query object for find or the line item adjustment id
Returns
PromisePromise<void>Requiredthe result of the delete operation
generateAdjustments
Creates adjustment for a line item
Parameters
calculationContextDataCalculationContextDataRequiredthe calculationContextData object holding discounts
the line item for which a line item adjustment might be created
contextAdjustmentContextRequiredthe line item for which a line item adjustment might be created
Returns
PromisePromise<GeneratedAdjustment[]>Requireda line item adjustment or undefined if no adjustment was created
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
Was this section helpful?