public function handle(CreateCouponCommand $command) { $coupon = new Coupon($command->getCode(), $command->getCouponId()); $coupon->setFlagFreeShipping($command->getFlagFreeShipping()); $coupon->setMinOrderValue($command->getMinOrderValue()); $coupon->setMaxOrderValue($command->getMaxOrderValue()); $coupon->setCanCombineWithOtherCoupons($command->canCombineWithOtherCoupons()); $coupon->setName($command->getName()); $coupon->setType(PromotionType::createById($command->getPromotionTypeId())); $coupon->setValue($command->getValue()); $coupon->setReducesTaxSubtotal($command->getReducesTaxSubtotal()); $coupon->setMaxRedemptions($command->getMaxRedemptions()); $coupon->setStart($command->getStartDate()); $coupon->setEnd($command->getEndDate()); $this->couponService->create($coupon); }