import { ApplyCouponCodeResult } from '@vendure/common/lib/generated-shop-types'; import { AssignPromotionsToChannelInput, ConfigurableOperationDefinition, CreatePromotionInput, CreatePromotionResult, DeletionResponse, RemovePromotionsFromChannelInput, UpdatePromotionInput, UpdatePromotionResult } from '@vendure/common/lib/generated-types'; import { ID, PaginatedList } from '@vendure/common/lib/shared-types'; import { RequestContext } from '../../api/common/request-context'; import { RelationPaths } from '../../api/decorators/relations.decorator'; import { ErrorResultUnion, JustErrorResults } from '../../common/error/error-result'; import { ListQueryOptions } from '../../common/types/common-types'; import { ConfigService } from '../../config/config.service'; import { PromotionAction } from '../../config/promotion/promotion-action'; import { PromotionCondition } from '../../config/promotion/promotion-condition'; import { TransactionalConnection } from '../../connection/transactional-connection'; import { Order } from '../../entity/order/order.entity'; import { Promotion } from '../../entity/promotion/promotion.entity'; import { EventBus } from '../../event-bus'; import { ConfigArgService } from '../helpers/config-arg/config-arg.service'; import { CustomFieldRelationService } from '../helpers/custom-field-relation/custom-field-relation.service'; import { ListQueryBuilder } from '../helpers/list-query-builder/list-query-builder'; import { TranslatableSaver } from '../helpers/translatable-saver/translatable-saver'; import { TranslatorService } from '../helpers/translator/translator.service'; import { ChannelService } from './channel.service'; /** * @description * Contains methods relating to {@link Promotion} entities. * * @docsCategory services */ export declare class PromotionService { private connection; private configService; private channelService; private listQueryBuilder; private configArgService; private customFieldRelationService; private eventBus; private translatableSaver; private translator; availableConditions: PromotionCondition[]; availableActions: PromotionAction[]; constructor(connection: TransactionalConnection, configService: ConfigService, channelService: ChannelService, listQueryBuilder: ListQueryBuilder, configArgService: ConfigArgService, customFieldRelationService: CustomFieldRelationService, eventBus: EventBus, translatableSaver: TranslatableSaver, translator: TranslatorService); findAll(ctx: RequestContext, options?: ListQueryOptions, relations?: RelationPaths): Promise>; findOne(ctx: RequestContext, adjustmentSourceId: ID, relations?: RelationPaths): Promise; getPromotionConditions(ctx: RequestContext): ConfigurableOperationDefinition[]; getPromotionActions(ctx: RequestContext): ConfigurableOperationDefinition[]; createPromotion(ctx: RequestContext, input: CreatePromotionInput): Promise>; updatePromotion(ctx: RequestContext, input: UpdatePromotionInput): Promise>; softDeletePromotion(ctx: RequestContext, promotionId: ID): Promise; assignPromotionsToChannel(ctx: RequestContext, input: AssignPromotionsToChannelInput): Promise; removePromotionsFromChannel(ctx: RequestContext, input: RemovePromotionsFromChannelInput): Promise[]>; /** * @description * Checks the validity of a coupon code, by checking that it is associated with an existing, * enabled and non-expired Promotion. Additionally, if there is a usage limit on the coupon code, * this method will enforce that limit against the specified Customer. */ validateCouponCode(ctx: RequestContext, couponCode: string, customerId?: ID): Promise | Promotion>; getActivePromotionsInChannel(ctx: RequestContext): Promise[]>; getActivePromotionsOnOrder(ctx: RequestContext, orderId: ID): Promise; runPromotionSideEffects(ctx: RequestContext, order: Order, promotionsPre: Promotion[]): Promise; /** * @description * Used internally to associate a Promotion with an Order, once an Order has been placed. * * @deprecated This method is no longer used and will be removed in v2.0 */ addPromotionsToOrder(ctx: RequestContext, order: Order): Promise; private countPromotionUsagesForCustomer; private countPromotionUsages; private calculatePriorityScore; private validateRequiredConditions; }