Skip to main content
Skip to main content

LineItemAdjustmentService

Provides layer to manipulate line item adjustments.

constructor

Parameters

__namedParametersLineItemAdjustmentServicePropsRequired

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
discountServiceDiscountServiceRequired
lineItemAdjustmentRepo_Repository<LineItemAdjustment>Required
manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired

Accessors

activeManager_

Returns

EntityManagerEntityManagerRequired

Methods

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

TResultobjectRequired
TErrorobjectRequired

Parameters

work(transactionManager: EntityManager) => Promise<TResult>Required
the 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>Required
the result of the transactional work

create

Creates a line item adjustment

Parameters

dataPartial<LineItemAdjustment>Required
the line item adjustment to create

Returns

PromisePromise<LineItemAdjustment>Required
line item adjustment

createAdjustmentForLineItem

Creates adjustment for a line item

Parameters

cartCartRequired
the cart object holding discounts
lineItemLineItemRequired
the line item for which a line item adjustment might be created

Returns

PromisePromise<LineItemAdjustment[]>Required
a line item adjustment or undefined if no adjustment was created

createAdjustments

Creates adjustment for a line item

Parameters

cartCartRequired
the cart object holding discounts
lineItemLineItem
the line item for which a line item adjustment might be created

Returns

PromisePromise<LineItemAdjustment[] | LineItemAdjustment[][]>Required
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

selectorOrIdsstring | string[] | FilterableLineItemAdjustmentProps & objectRequired
the query object for find or the line item adjustment id

Returns

PromisePromise<void>Required
the result of the delete operation

generateAdjustments

Creates adjustment for a line item

Parameters

calculationContextDataCalculationContextDataRequired
the calculationContextData object holding discounts
generatedLineItemLineItemRequired
the line item for which a line item adjustment might be created
contextAdjustmentContextRequired
the line item for which a line item adjustment might be created

Returns

PromisePromise<GeneratedAdjustment[]>Required
a line item adjustment or undefined if no adjustment was created

list

Lists line item adjustments

Parameters

selectorFilterableLineItemAdjustmentPropsRequired
the query object for find

Default: {}

the config to be used for find

Returns

PromisePromise<LineItemAdjustment[]>Required
the result of the find operation

retrieve

Retrieves a line item adjustment by id.

Parameters

lineItemAdjustmentIdstringRequired
the id of the line item adjustment to retrieve
the config to retrieve the line item adjustment by

Default: {}

Returns

PromisePromise<LineItemAdjustment>Required
the line item adjustment.

shouldRetryTransaction_

Parameters

errRecord<string, unknown> | objectRequired

Returns

booleanboolean

update

Creates a line item adjustment

Parameters

idstringRequired
the line item adjustment id to update
dataPartial<LineItemAdjustment>Required
the line item adjustment to create

Returns

PromisePromise<LineItemAdjustment>Required
line item adjustment

withTransaction

Parameters

transactionManagerEntityManager

Returns

LineItemAdjustmentServiceobjectRequired
Provides layer to manipulate line item adjustments.
Was this section helpful?