public function applyDiscount(OrderableInterface $order) { $customer = $order->getCustomer(); if (!$customer->getLoyaltyCardNumber()) { throw $this->createCouponException('Coupon is reserved to loyal customers.'); } return $this->coupon->applyDiscount($order); }
public function applyDiscount(OrderableInterface $order) { $customer = $order->getCustomer(); if ($customer->hasPastOrders()) { throw $this->createCouponException('Customer already has past orders.'); } return $this->coupon->applyDiscount($order); }