/** * {@inheritdoc} */ public function create(array $options = []) { $options = $this->optionsResolver->resolve($options); /** @var PromotionRuleInterface $promotionRule */ $promotionRule = $this->promotionRuleFactory->createNew(); $promotionRule->setType($options['type']); $promotionRule->setConfiguration($options['configuration']); return $promotionRule; }
/** * @Given /^([^"]+) gives ("[^"]+%") off the order for customers from ("[^"]*" group)$/ */ public function thePromotionGivesOffTheOrderForCustomersFromGroup(PromotionInterface $promotion, $discount, CustomerGroupInterface $customerGroup) { $rule = $this->ruleFactory->createNew(); $rule->setType(CustomerGroupRuleChecker::TYPE); $rule->setConfiguration(['group_code' => $customerGroup->getCode()]); $this->createPercentagePromotion($promotion, $discount, [], $rule); }