Skip to main content
Skip to main content

DiscountConditionService

internal.internal.DiscountConditionService

Provides layer to manipulate discount conditions.

Implements

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 }Required
eventBus_EventBusServiceRequired
manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired

Accessors

activeManager_

Protected get activeManager_(): EntityManager

Returns

EntityManager

EntityManagerEntityManagerRequired

Inherited from

TransactionBaseService.activeManager_

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.

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

Promise<TResult>

PromisePromise<TResult>Required
the result of the transactional work

Inherited from

TransactionBaseService.atomicPhase_


delete

delete(discountConditionId): Promise<void | DiscountCondition>

Parameters

discountConditionIdstringRequired

Returns

Promise<void | DiscountCondition>

PromisePromise<void | DiscountCondition>Required

removeResources

removeResources(data): Promise<void>

Parameters

dataOmit<DiscountConditionInput, "id"> & { id: string }Required

Returns

Promise<void>

PromisePromise<void>Required

retrieve

retrieve(conditionId, config?): Promise<DiscountCondition>

Parameters

conditionIdstringRequired

Returns

Promise<DiscountCondition>

PromisePromise<DiscountCondition>Required

shouldRetryTransaction_

Protected shouldRetryTransaction_(err): boolean

Parameters

errRecord<string, unknown> | { code: string }Required

Returns

boolean

booleanboolean

Inherited from

TransactionBaseService.shouldRetryTransaction_


upsertCondition

upsertCondition(data, overrideExisting?): Promise<(DiscountConditionCustomerGroup | DiscountConditionProduct | DiscountConditionProductCollection | DiscountConditionProductTag | DiscountConditionProductType)[]>

Parameters

overrideExistingboolean

Returns

Promise<(DiscountConditionCustomerGroup | DiscountConditionProduct | DiscountConditionProductCollection | DiscountConditionProductTag | DiscountConditionProductType)[]>


withTransaction

withTransaction(transactionManager?): DiscountConditionService

Parameters

transactionManagerEntityManager

Returns

DiscountConditionService

DiscountConditionServiceDiscountConditionServiceRequired

Inherited from

TransactionBaseService.withTransaction


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/js-client/internal/enums/admin_collections.internal.DiscountConditionType) }undefined | { resource_ids: (string | { id: string })[] ; type: DiscountConditionType }
Was this section helpful?