PromotionService
Contains methods relating to Promotion entities.
availableConditions
property
PromotionCondition[]availableActions
property
PromotionAction[]constructor
method
(connection: TransactionalConnection, configService: ConfigService, channelService: ChannelService, listQueryBuilder: ListQueryBuilder, configArgService: ConfigArgService, customFieldRelationService: CustomFieldRelationService, eventBus: EventBus, translatableSaver: TranslatableSaver, translator: TranslatorService) => PromotionServicefindAll
method
(ctx: RequestContext, options?: ListQueryOptions<Promotion>, relations: RelationPaths<Promotion> = []) => Promise<PaginatedList<Promotion>>findOne
method
(ctx: RequestContext, adjustmentSourceId: ID, relations: RelationPaths<Promotion> = []) => Promise<Promotion | undefined>getPromotionConditions
method
(ctx: RequestContext) => ConfigurableOperationDefinition[]getPromotionActions
method
(ctx: RequestContext) => ConfigurableOperationDefinition[]createPromotion
method
(ctx: RequestContext, input: CreatePromotionInput) => Promise<ErrorResultUnion<CreatePromotionResult, Promotion>>updatePromotion
method
(ctx: RequestContext, input: UpdatePromotionInput) => Promise<ErrorResultUnion<UpdatePromotionResult, Promotion>>softDeletePromotion
method
(ctx: RequestContext, promotionId: ID) => Promise<DeletionResponse>assignPromotionsToChannel
method
(ctx: RequestContext, input: AssignPromotionsToChannelInput) => Promise<Promotion[]>removePromotionsFromChannel
method
(ctx: RequestContext, input: RemovePromotionsFromChannelInput) => validateCouponCode
method
(ctx: RequestContext, couponCode: string, customerId?: ID) => Promise<JustErrorResults<ApplyCouponCodeResult> | Promotion>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.
getActivePromotionsInChannel
method
(ctx: RequestContext) => getActivePromotionsOnOrder
method
(ctx: RequestContext, orderId: ID) => Promise<Promotion[]>runPromotionSideEffects
method
(ctx: RequestContext, order: Order, promotionsPre: Promotion[]) => addPromotionsToOrder
method
(ctx: RequestContext, order: Order) => Promise<Order>Used internally to associate a Promotion with an Order, once an Order has been placed.
Was this chapter helpful?