DiscountConditionService
Provides layer to manipulate discount conditions.
Implements
Constructors
constructor
new DiscountConditionService(«destructured»
)
Parameters
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>discountConditionRepository_
Repository<DiscountCondition> & { addConditionResources: Method addConditionResources ; canApplyForCustomer: Method canApplyForCustomer ; findOneWithDiscount: Method findOneWithDiscount ; getJoinTableResourceIdentifiers: Method getJoinTableResourceIdentifiers ; isValidForProduct: Method isValidForProduct ; queryConditionTable: Method queryConditionTable ; removeConditionResources: Method removeConditionResources }Requiredmanager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Protected
get
activeManager_(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredMethods
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>Requireddelete
delete(discountConditionId
): Promise
<void
| DiscountCondition
>
Parameters
discountConditionId
stringRequiredReturns
Promise
<void
| DiscountCondition
>
removeResources
removeResources(data
): Promise
<void
>
Parameters
Returns
Promise
<void
>
Promise
Promise<void>Requiredretrieve
retrieve(conditionId
, config?
): Promise
<DiscountCondition
>
Parameters
conditionId
stringRequiredconfig
FindConfig<DiscountCondition>Returns
Promise
<DiscountCondition
>
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanupsertCondition
upsertCondition(data
, overrideExisting?
): Promise
<(DiscountConditionProduct
| DiscountConditionProductType
| DiscountConditionProductCollection
| DiscountConditionProductTag
| DiscountConditionCustomerGroup
)[]>
Parameters
overrideExisting
booleanRequiredDefault: true
Returns
Promise
<(DiscountConditionProduct
| DiscountConditionProductType
| DiscountConditionProductCollection
| DiscountConditionProductTag
| DiscountConditionCustomerGroup
)[]>
Promise
Promise<(DiscountConditionProduct | DiscountConditionProductType | DiscountConditionProductCollection | DiscountConditionProductTag | DiscountConditionCustomerGroup)[]>RequiredwithTransaction
withTransaction(transactionManager?
): DiscountConditionService
Parameters
transactionManager
EntityManagerReturns
resolveConditionType_
Static
Protected
resolveConditionType_(data
): undefined
| { resource_ids
: (string
| { id
: string
})[] ; type
: DiscountConditionType
}
Parameters
Returns
undefined
| { resource_ids
: (string
| { id
: string
})[] ; type
: DiscountConditionType
}
undefined \| { `resource_ids`: (`string` \| { `id`: `string` })[] ; `type`: [`DiscountConditionType`](/references/services/enums/DiscountConditionType) }
undefined | { resource_ids: (string | { id: string })[] ; type: DiscountConditionType }