/**
  * {@inheritdoc}
  */
 public function create(array $options = [])
 {
     $options = $this->optionsResolver->resolve($options);
     /** @var PromotionActionInterface $promotionAction */
     $promotionAction = $this->promotionActionFactory->createNew();
     $promotionAction->setType($options['type']);
     $promotionAction->setConfiguration($options['configuration']);
     return $promotionAction;
 }
Example #2
0
 /**
  * @param PromotionInterface $promotion
  * @param float $discount
  * @param array $configuration
  * @param PromotionRuleInterface $rule
  */
 private function createPercentagePromotion(PromotionInterface $promotion, $discount, array $configuration = [], PromotionRuleInterface $rule = null)
 {
     $this->persistPromotion($promotion, $this->actionFactory->createPercentageDiscount($discount), $configuration, $rule);
 }