import { ApplyCouponCodeResult } from '@subit/common/lib/generated-shop-types'; import { AssignPromotionsToChannelInput, ConfigurableOperationDefinition, CreatePromotionInput, CreatePromotionResult, DeletionResponse, RemovePromotionsFromChannelInput, UpdatePromotionInput, UpdatePromotionResult } from '@subit/common/lib/generated-types'; import { ID, PaginatedList } from '@subit/common/lib/shared-types'; import { RequestContext } from '../../api/common/request-context'; 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 { Order } from '../../entity/order/order.entity'; import { Promotion } from '../../entity/promotion/promotion.entity'; import { ConfigArgService } from '../helpers/config-arg/config-arg.service'; import { ListQueryBuilder } from '../helpers/list-query-builder/list-query-builder'; import { TransactionalConnection } from '../transaction/transactional-connection'; import { ChannelService } from './channel.service'; export declare class PromotionService { private connection; private configService; private channelService; private listQueryBuilder; private configArgService; availableConditions: PromotionCondition[]; availableActions: PromotionAction[]; /** * All active AdjustmentSources are cached in memory becuase they are needed * every time an order is changed, which will happen often. Caching them means * a DB call is not required newly each time. */ private activePromotions; constructor(connection: TransactionalConnection, configService: ConfigService, channelService: ChannelService, listQueryBuilder: ListQueryBuilder, configArgService: ConfigArgService); findAll(ctx: RequestContext, options?: ListQueryOptions): Promise>; findOne(ctx: RequestContext, adjustmentSourceId: ID): Promise; getPromotionConditions(ctx: RequestContext): ConfigurableOperationDefinition[]; getPromotionActions(ctx: RequestContext): ConfigurableOperationDefinition[]; /** * Returns all active AdjustmentSources. */ getActivePromotions(): Promise; 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; validateCouponCode(ctx: RequestContext, couponCode: string, customerId?: ID): Promise | Promotion>; addPromotionsToOrder(ctx: RequestContext, order: Order): Promise; private countPromotionUsagesForCustomer; private calculatePriorityScore; /** * Update the activeSources cache. */ private updatePromotions; private validateRequiredConditions; }