--- displayed_sidebar: servicesSidebar --- import ParameterTypes from "@site/src/components/ParameterTypes" # LineItemAdjustmentService Provides layer to manipulate line item adjustments. ## Constructors #### constructor `**new LineItemAdjustmentService**(«destructured»)` ##### Parameters ## Properties `", "description": "", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "__container__", "type": "`any`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "__moduleDeclaration__", "type": "`Record`", "description": "", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "discountService", "type": "[DiscountService](DiscountService.mdx)", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "lineItemAdjustmentRepo_", "type": "Repository<[LineItemAdjustment](LineItemAdjustment.mdx)>", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "manager_", "type": "EntityManager", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "transactionManager_", "type": "`undefined` \\| EntityManager", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ]} /> ## Accessors #### activeManager\_ `Protected` **activeManager\_**: [object Object] ## Methods #### atomicPhase\_ `Protected **atomicPhase_**(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. ##### Type Parameters ##### Parameters Promise<TResult>", "description": "the transactional work to be done", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "isolationOrErrorHandler", "type": "`IsolationLevel` \\| (`error`: `TError`) => Promise<void \\| TResult>", "description": "the isolation level to be used for the work.", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "maybeErrorHandlerOrDontFail", "type": "(`error`: `TError`) => Promise<void \\| TResult>", "description": "Potential error handler", "optional": true, "defaultValue": "", "expandable": false, "children": [] } ]} /> ##### Returns Promise<TResult> ___ #### create `**create**(data): Promise<[LineItemAdjustment](LineItemAdjustment.mdx)>` Creates a line item adjustment ##### Parameters ##### Returns Promise<[LineItemAdjustment](LineItemAdjustment.mdx)> ___ #### createAdjustmentForLineItem `**createAdjustmentForLineItem**(cart, lineItem): Promise<[LineItemAdjustment](LineItemAdjustment.mdx)[]>` Creates adjustment for a line item ##### Parameters ##### Returns Promise<[LineItemAdjustment](LineItemAdjustment.mdx)[]> ___ #### createAdjustments `**createAdjustments**(cart, lineItem?): Promise<[LineItemAdjustment](LineItemAdjustment.mdx)[] \| [LineItemAdjustment](LineItemAdjustment.mdx)[][]>` Creates adjustment for a line item ##### Parameters ##### Returns Promise<[LineItemAdjustment](LineItemAdjustment.mdx)[] \| [LineItemAdjustment](LineItemAdjustment.mdx)[][]> ___ #### delete `**delete**(selectorOrIds): Promise<void>` Deletes line item adjustments matching a selector ##### Parameters ##### Returns Promise<void> ___ #### generateAdjustments `**generateAdjustments**(calculationContextData, generatedLineItem, context): Promise<[GeneratedAdjustment](../types/GeneratedAdjustment.mdx)[]>` Creates adjustment for a line item ##### Parameters ##### Returns Promise<[GeneratedAdjustment](../types/GeneratedAdjustment.mdx)[]> ___ #### list `**list**(selector?, config?): Promise<[LineItemAdjustment](LineItemAdjustment.mdx)[]>` Lists line item adjustments ##### Parameters ##### Returns Promise<[LineItemAdjustment](LineItemAdjustment.mdx)[]> ___ #### retrieve `**retrieve**(lineItemAdjustmentId, config?): Promise<[LineItemAdjustment](LineItemAdjustment.mdx)>` Retrieves a line item adjustment by id. ##### Parameters ##### Returns Promise<[LineItemAdjustment](LineItemAdjustment.mdx)> ___ #### shouldRetryTransaction\_ `Protected **shouldRetryTransaction_**(err): boolean` ##### Parameters ` \\| ``{ code: string }``", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ]} /> ##### Returns `boolean` ___ #### update `**update**(id, data): Promise<[LineItemAdjustment](LineItemAdjustment.mdx)>` Creates a line item adjustment ##### Parameters ##### Returns Promise<[LineItemAdjustment](LineItemAdjustment.mdx)> ___ #### withTransaction `**withTransaction**(transactionManager?): [LineItemAdjustmentService](LineItemAdjustmentService.mdx)` ##### Parameters ##### Returns [LineItemAdjustmentService](LineItemAdjustmentService.mdx)