LineItemAdjustmentService
Provides layer to manipulate line item adjustments.
Constructors
constructor
**new LineItemAdjustmentService**(«destructured»)
Parameters
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Protected get**activeManager_**(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredMethods
atomicPhase_
Protected **atomicPhase_**<TypeParameter TResult, TypeParameter TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise<TResult>
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.
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise<TResult>
Promise
Promise<TResult>Requiredcreate
**create**(data): Promise<[LineItemAdjustment](/references/services/classes/LineItemAdjustment)>
Creates a line item adjustment
Parameters
Returns
Promise<LineItemAdjustment>
createAdjustmentForLineItem
**createAdjustmentForLineItem**(cart, lineItem): Promise<[LineItemAdjustment](/references/services/classes/LineItemAdjustment)[]>
Creates adjustment for a line item
Parameters
Returns
Promise<LineItemAdjustment[]>
createAdjustments
**createAdjustments**(cart, lineItem?): Promise<[LineItemAdjustment](/references/services/classes/LineItemAdjustment)[] \| [LineItemAdjustment](/references/services/classes/LineItemAdjustment)[][]>
Creates adjustment for a line item
Parameters
Returns
Promise<LineItemAdjustment[] | LineItemAdjustment[][]>
delete
**delete**(selectorOrIds): Promise<void>
Deletes line item adjustments matching a selector
Parameters
selectorOrIds
string | string[] | FilterableLineItemAdjustmentProps & { discount_id?: FindOperator<null \| string> }RequiredReturns
Promise<void>
Promise
Promise<void>RequiredgenerateAdjustments
**generateAdjustments**(calculationContextData, generatedLineItem, context): Promise<[GeneratedAdjustment](/references/services/types/GeneratedAdjustment)[]>
Creates adjustment for a line item
Parameters
Returns
Promise<GeneratedAdjustment[]>
list
**list**(selector?, config?): Promise<[LineItemAdjustment](/references/services/classes/LineItemAdjustment)[]>
Lists line item adjustments
Parameters
Default: {}
Returns
Promise<LineItemAdjustment[]>
retrieve
**retrieve**(lineItemAdjustmentId, config?): Promise<[LineItemAdjustment](/references/services/classes/LineItemAdjustment)>
Retrieves a line item adjustment by id.
Parameters
lineItemAdjustmentId
stringRequiredDefault: {}
Returns
Promise<LineItemAdjustment>
shouldRetryTransaction_
Protected **shouldRetryTransaction_**(err): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanupdate
**update**(id, data): Promise<[LineItemAdjustment](/references/services/classes/LineItemAdjustment)>
Creates a line item adjustment
Parameters
id
stringRequiredReturns
Promise<LineItemAdjustment>
withTransaction
**withTransaction**(transactionManager?): [LineItemAdjustmentService](/references/services/classes/LineItemAdjustmentService)
Parameters
transactionManager
EntityManager