Skip to main content

Class: LineItemAdjustmentService

Provides layer to manipulate line item adjustments.

Hierarchy

  • Copy to Clipboard

    Copy to Clipboard

Constructors

constructor

new LineItemAdjustmentService(Copy to Clipboard)

Parameters

NameType
Copy to ClipboardCopy to Clipboard

Overrides

TransactionBaseService.constructor

Defined in

packages/medusa/src/services/line-item-adjustment.ts:44

Properties

__configModule__

Copy to Clipboard Copy to Clipboard Copy to Clipboard __configModule__: Copy to Clipboard<Copy to Clipboard, Copy to Clipboard>

Inherited from

TransactionBaseService.__configModule__

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:10


__container__

Copy to Clipboard Copy to Clipboard __container__: Copy to Clipboard

Inherited from

TransactionBaseService.__container__

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:9


discountService

Copy to Clipboard Copy to Clipboard discountService: Copy to Clipboard

Defined in

packages/medusa/src/services/line-item-adjustment.ts:42


lineItemAdjustmentRepo_

Copy to Clipboard Copy to Clipboard lineItemAdjustmentRepo_: typeof Copy to Clipboard

Defined in

packages/medusa/src/services/line-item-adjustment.ts:41


manager_

Copy to Clipboard Copy to Clipboard manager_: Copy to Clipboard

Overrides

TransactionBaseService.manager_

Defined in

packages/medusa/src/services/line-item-adjustment.ts:38


transactionManager_

Copy to Clipboard transactionManager_: Copy to Clipboard | Copy to Clipboard

Overrides

TransactionBaseService.transactionManager_

Defined in

packages/medusa/src/services/line-item-adjustment.ts:39

Methods

atomicPhase_

Copy to Clipboard atomicPhase_<Copy to Clipboard, Copy to Clipboard>(Copy to Clipboard, Copy to Clipboard, Copy to Clipboard): Copy to Clipboard<Copy to Clipboard>

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

Name
Copy to Clipboard
Copy to Clipboard

Parameters

NameTypeDescription
Copy to Clipboard(Copy to Clipboard: Copy to Clipboard) => Copy to Clipboard<Copy to Clipboard>the transactional work to be done
Copy to ClipboardCopy to Clipboard | (Copy to Clipboard: Copy to Clipboard) => Copy to Clipboard<Copy to Clipboard | Copy to Clipboard>the isolation level to be used for the work.
Copy to Clipboard(Copy to Clipboard: Copy to Clipboard) => Copy to Clipboard<Copy to Clipboard | Copy to Clipboard>Potential error handler

Returns

Copy to Clipboard<Copy to Clipboard>

the result of the transactional work

Inherited from

TransactionBaseService.atomicPhase_

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:48


create

create(Copy to Clipboard): Copy to Clipboard<Copy to Clipboard>

Creates a line item adjustment

Parameters

NameTypeDescription
Copy to ClipboardCopy to Clipboard<Copy to Clipboard>the line item adjustment to create

Returns

Copy to Clipboard<Copy to Clipboard>

line item adjustment

Defined in

packages/medusa/src/services/line-item-adjustment.ts:88


createAdjustmentForLineItem

createAdjustmentForLineItem(Copy to Clipboard, Copy to Clipboard): Copy to Clipboard<Copy to Clipboard[]>

Creates adjustment for a line item

Parameters

NameTypeDescription
Copy to ClipboardCopy to Clipboardthe cart object holding discounts
Copy to ClipboardCopy to Clipboardthe line item for which a line item adjustment might be created

Returns

Copy to Clipboard<Copy to Clipboard[]>

a line item adjustment or undefined if no adjustment was created

Defined in

packages/medusa/src/services/line-item-adjustment.ts:255


createAdjustments

createAdjustments(Copy to Clipboard, Copy to Clipboard): Copy to Clipboard<Copy to Clipboard[] | Copy to Clipboard[][]>

Creates adjustment for a line item

Parameters

NameTypeDescription
Copy to ClipboardCopy to Clipboardthe cart object holding discounts
Copy to ClipboardCopy to Clipboardthe line item for which a line item adjustment might be created

Returns

Copy to Clipboard<Copy to Clipboard[] | Copy to Clipboard[][]>

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

Defined in

packages/medusa/src/services/line-item-adjustment.ts:283


delete

delete(Copy to Clipboard): Copy to Clipboard<Copy to Clipboard>

Deletes line item adjustments matching a selector

Parameters

NameTypeDescription
Copy to ClipboardCopy to Clipboard | Copy to Clipboard[] | Copy to Clipboardthe query object for find or the line item adjustment id

Returns

Copy to Clipboard<Copy to Clipboard>

the result of the delete operation

Defined in

packages/medusa/src/services/line-item-adjustment.ts:153


generateAdjustments

generateAdjustments(Copy to Clipboard, Copy to Clipboard, Copy to Clipboard): Copy to Clipboard<Copy to Clipboard[]>

Creates adjustment for a line item

Parameters

NameTypeDescription
Copy to ClipboardCopy to Clipboardthe cart object holding discounts
Copy to ClipboardCopy to Clipboardthe line item for which a line item adjustment might be created
Copy to ClipboardCopy to Clipboardthe line item for which a line item adjustment might be created

Returns

Copy to Clipboard<Copy to Clipboard[]>

a line item adjustment or undefined if no adjustment was created

Defined in

packages/medusa/src/services/line-item-adjustment.ts:182


list

list(Copy to Clipboard, Copy to Clipboard): Copy to Clipboard<Copy to Clipboard[]>

Lists line item adjustments

Parameters

NameTypeDescription
Copy to ClipboardCopy to Clipboardthe query object for find
Copy to ClipboardCopy to Clipboard<Copy to Clipboard>the config to be used for find

Returns

Copy to Clipboard<Copy to Clipboard[]>

the result of the find operation

Defined in

packages/medusa/src/services/line-item-adjustment.ts:136


retrieve

retrieve(Copy to Clipboard, Copy to Clipboard): Copy to Clipboard<Copy to Clipboard>

Retrieves a line item adjustment by id.

Parameters

NameTypeDescription
Copy to ClipboardCopy to Clipboardthe id of the line item adjustment to retrieve
Copy to ClipboardCopy to Clipboard<Copy to Clipboard>the config to retrieve the line item adjustment by

Returns

Copy to Clipboard<Copy to Clipboard>

the line item adjustment.

Defined in

packages/medusa/src/services/line-item-adjustment.ts:63


shouldRetryTransaction_

Copy to Clipboard shouldRetryTransaction_(Copy to Clipboard): Copy to Clipboard

Parameters

NameType
Copy to ClipboardCopy to Clipboard<Copy to Clipboard, Copy to Clipboard> | { Copy to Clipboard: Copy to Clipboard }

Returns

Copy to Clipboard

Inherited from

TransactionBaseService.shouldRetryTransaction_

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:29


update

update(Copy to Clipboard, Copy to Clipboard): Copy to Clipboard<Copy to Clipboard>

Creates a line item adjustment

Parameters

NameTypeDescription
Copy to ClipboardCopy to Clipboardthe line item adjustment id to update
Copy to ClipboardCopy to Clipboard<Copy to Clipboard>the line item adjustment to create

Returns

Copy to Clipboard<Copy to Clipboard>

line item adjustment

Defined in

packages/medusa/src/services/line-item-adjustment.ts:105


withTransaction

withTransaction(Copy to Clipboard): Copy to Clipboard

Parameters

NameType
Copy to ClipboardCopy to Clipboard

Returns

Copy to Clipboard

Inherited from

TransactionBaseService.withTransaction

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:13