LineItemService
Hierarchy
TransactionBaseService
↳
LineItemService
Constructors
constructor
new LineItemService(«destructured»
)
Parameters
Name |
---|
«destructured» |
Overrides
TransactionBaseService.constructor
Defined in
medusa/src/services/line-item.ts:57
Properties
__configModule__
Protected
Optional
Readonly
__configModule__: Record<string
, unknown
>
Inherited from
TransactionBaseService.__configModule__
Defined in
medusa/src/interfaces/transaction-base-service.ts:14
__container__
Protected
Readonly
__container__: any
Inherited from
TransactionBaseService.__container__
Defined in
medusa/src/interfaces/transaction-base-service.ts:13
__moduleDeclaration__
Protected
Optional
Readonly
__moduleDeclaration__: Record<string
, unknown
>
Inherited from
TransactionBaseService.__moduleDeclaration__
Defined in
medusa/src/interfaces/transaction-base-service.ts:15
cartRepository_
Protected
Readonly
cartRepository_: Repository
<Cart
> & { findOneWithRelations
: Method findOneWithRelations ; findWithRelations
: Method findWithRelations }
Defined in
medusa/src/services/line-item.ts:48
featureFlagRouter_
Protected
Readonly
featureFlagRouter_: FlagRouter
Defined in
medusa/src/services/line-item.ts:53
itemTaxLineRepo_
Protected
Readonly
itemTaxLineRepo_: Repository
<LineItemTaxLine
> & { deleteForCart
: Method deleteForCart ; upsertLines
: Method upsertLines }
Defined in
medusa/src/services/line-item.ts:47
lineItemAdjustmentService_
Protected
Readonly
lineItemAdjustmentService_: LineItemAdjustmentService
Defined in
medusa/src/services/line-item.ts:54
lineItemRepository_
Protected
Readonly
lineItemRepository_: Repository
<LineItem
> & { findByReturn
: Method findByReturn }
Defined in
medusa/src/services/line-item.ts:46
manager_
Protected
manager_: EntityManager
Inherited from
TransactionBaseService.manager_
Defined in
medusa/src/interfaces/transaction-base-service.ts:5
pricingService_
Protected
Readonly
pricingService_: PricingService
Defined in
medusa/src/services/line-item.ts:51
productService_
Protected
Readonly
productService_: ProductService
Defined in
medusa/src/services/line-item.ts:50
productVariantService_
Protected
Readonly
productVariantService_: ProductVariantService
Defined in
medusa/src/services/line-item.ts:49
regionService_
Protected
Readonly
regionService_: RegionService
Defined in
medusa/src/services/line-item.ts:52
taxProviderService_
Protected
Readonly
taxProviderService_: TaxProviderService
Defined in
medusa/src/services/line-item.ts:55
transactionManager_
Protected
transactionManager_: undefined
| EntityManager
Inherited from
TransactionBaseService.transactionManager_
Defined in
medusa/src/interfaces/transaction-base-service.ts:6
Accessors
activeManager_
Protected
get
activeManager_(): EntityManager
Returns
EntityManager
-EntityManager
:
Inherited from
TransactionBaseService.activeManager_
Defined in
medusa/src/interfaces/transaction-base-service.ts:8
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.
Name |
---|
TResult |
TError |
Parameters
Name | Description |
---|---|
work | (transactionManager : EntityManager ) => Promise <TResult > |
isolationOrErrorHandler? | IsolationLevel | (error : TError ) => Promise <void | TResult > |
maybeErrorHandlerOrDontFail? | (error : TError ) => Promise <void | TResult > |
Returns
Promise
<TResult
>
-Promise
: the result of the transactional work
Inherited from
TransactionBaseService.atomicPhase_
Defined in
medusa/src/interfaces/transaction-base-service.ts:56
cloneTo
cloneTo(ids
, data?
, options?
): Promise
<LineItem
[]>
Parameters
Name |
---|
ids |
data |
options |
options.setOriginalLineItemId? |
Returns
Promise
<LineItem
[]>
-Promise
:
-LineItem[]
:
-LineItem
:
Defined in
medusa/src/services/line-item.ts:541
create
create<T
, TResult
>(data
): Promise
<TResult
>
Create a line item
Name | Type |
---|---|
T | object |
TResult | object |
Parameters
Name | Description |
---|---|
data | T |
Returns
Promise
<TResult
>
-Promise
: the created line item
Defined in
medusa/src/services/line-item.ts:421
createReturnLines
createReturnLines(returnId
, cartId
): Promise
<LineItem
[]>
Creates return line items for a given cart based on the return items in a return.
Parameters
Name | Description |
---|---|
returnId | string |
cartId | string |
Returns
Promise
<LineItem
[]>
-Promise
: the created line items
-LineItem[]
:
-LineItem
:
Defined in
medusa/src/services/line-item.ts:131
createTaxLine
createTaxLine(args
): LineItemTaxLine
Create a line item tax line.
Parameters
Name | Description |
---|---|
args | DeepPartial <LineItemTaxLine > |
Returns
LineItemTaxLine
-LineItemTaxLine
: a new line item tax line
Defined in
medusa/src/services/line-item.ts:533
delete
delete(id
): Promise
<undefined
| null
| LineItem
>
Deletes a line item.
Parameters
Name | Description |
---|---|
id | string |
Returns
Promise
<undefined
| null
| LineItem
>
-Promise
: the result of the delete operation
-undefined \| ``null`` \| LineItem
: (optional)
Defined in
medusa/src/services/line-item.ts:494
deleteWithTaxLines
deleteWithTaxLines(id
): Promise
<undefined
| null
| LineItem
>
Parameters
Name | Description |
---|---|
id | string |
Returns
Promise
<undefined
| null
| LineItem
>
-Promise
: the result of the delete operation
-undefined \| ``null`` \| LineItem
: (optional)
Deprecated
no the cascade on the entity takes care of it Deletes a line item with the tax lines.
Defined in
medusa/src/services/line-item.ts:516
generate
generate<T
, TResult
>(variantIdOrData
, regionIdOrContext
, quantity?
, context?
): Promise
<TResult
>
Generate a single or multiple line item without persisting the data into the db
Name | Type |
---|---|
T | object |
TResult | object |
Parameters
Name |
---|
variantIdOrData |
regionIdOrContext |
quantity? |
context |
Returns
Promise
<TResult
>
-Promise
:
Defined in
medusa/src/services/line-item.ts:192
generateLineItem
Protected
generateLineItem(variant
, quantity
, context
): Promise
<LineItem
>
Parameters
Name |
---|
variant |
variant.id |
variant.product |
variant.product.discountable |
variant.product.is_giftcard |
variant.product.thumbnail |
variant.product.title |
variant.product_id |
variant.title |
quantity |
context |
Returns
Promise
<LineItem
>
-Promise
:
-LineItem
:
Defined in
medusa/src/services/line-item.ts:337
list
list(selector
, config?
): Promise
<LineItem
[]>
Parameters
Name |
---|
selector |
config |
Returns
Promise
<LineItem
[]>
-Promise
:
-LineItem[]
:
-LineItem
:
Defined in
medusa/src/services/line-item.ts:84
retrieve
retrieve(id
, config?
): Promise
<LineItem
>
Retrieves a line item by its id.
Parameters
Name | Description |
---|---|
id | string |
config | object |
Returns
Promise
<LineItem
>
-Promise
: the line item
-LineItem
:
Defined in
medusa/src/services/line-item.ts:105
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
Name |
---|
err |
Returns
boolean
-boolean
: (optional)
Inherited from
TransactionBaseService.shouldRetryTransaction_
Defined in
medusa/src/interfaces/transaction-base-service.ts:37
update
update(idOrSelector
, data
): Promise
<LineItem
[]>
Updates a line item
Parameters
Name | Description |
---|---|
idOrSelector | string | Selector <LineItem > |
data | Partial <LineItem > |
Returns
Promise
<LineItem
[]>
-Promise
: the updated line item(s)
-LineItem[]
:
-LineItem
:
Defined in
medusa/src/services/line-item.ts:451
validateGenerateArguments
Protected
validateGenerateArguments<T
, TResult
>(variantIdOrData
, regionIdOrContext
, quantity?
): void
Name | Type |
---|---|
T | object |
TResult | object |
Parameters
Name |
---|
variantIdOrData |
regionIdOrContext |
quantity? |
Returns
void
-void
: (optional)
Defined in
medusa/src/services/line-item.ts:612
withTransaction
withTransaction(transactionManager?
): LineItemService
Parameters
Name |
---|
transactionManager? |
Returns
-LineItemService
:
Inherited from
TransactionBaseService.withTransaction