LineItemAdjustmentService
internal.internal.LineItemAdjustmentService
Provides layer to manipulate line item adjustments.
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>discountService
anyRequiredlineItemAdjustmentRepo_
anyRequiredmanager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Protected
get
activeManager_(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredInherited from
TransactionBaseService.activeManager_
Methods
atomicPhase_
Protected
atomicPhase_<TResult
, 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>RequiredInherited from
TransactionBaseService.atomicPhase_
create
create(data
): Promise
<LineItemAdjustment
>
Creates a line item adjustment
Parameters
Returns
Promise
<LineItemAdjustment
>
line item adjustment
createAdjustmentForLineItem
createAdjustmentForLineItem(cart
, lineItem
): Promise
<LineItemAdjustment
[]>
Creates adjustment for a line item
Parameters
Returns
Promise
<LineItemAdjustment
[]>
a line item adjustment or undefined if no adjustment was created
createAdjustments
createAdjustments(cart
, lineItem?
): Promise
<LineItemAdjustment
[] | LineItemAdjustment
[][]>
Creates adjustment for a line item
Parameters
Returns
Promise
<LineItemAdjustment
[] | LineItemAdjustment
[][]>
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
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
[]>
Creates adjustment for a line item
Parameters
Returns
Promise
<GeneratedAdjustment
[]>
a line item adjustment or undefined if no adjustment was created
list
list(selector?
, config?
): Promise
<LineItemAdjustment
[]>
Lists line item adjustments
Parameters
config
FindConfig<LineItemAdjustment>Returns
Promise
<LineItemAdjustment
[]>
the result of the find operation
retrieve
retrieve(lineItemAdjustmentId
, config?
): Promise
<LineItemAdjustment
>
Retrieves a line item adjustment by id.
Parameters
lineItemAdjustmentId
stringRequiredconfig
FindConfig<LineItemAdjustment>Returns
Promise
<LineItemAdjustment
>
the line item adjustment.
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanInherited from
TransactionBaseService.shouldRetryTransaction_
update
update(id
, data
): Promise
<LineItemAdjustment
>
Creates a line item adjustment
Parameters
id
stringRequiredReturns
Promise
<LineItemAdjustment
>
line item adjustment
withTransaction
withTransaction(transactionManager?
): LineItemAdjustmentService
Parameters
transactionManager
EntityManager