public function applyDiscount(OrderableInterface $order)
 {
     $amount = $order->getTotalAmount();
     if ($amount->lessThan($this->minimumAmount)) {
         throw $this->createCouponException(sprintf('Coupon requires a minimum amount of %u.', $this->minimumAmount->getAmount()));
     }
     return $this->coupon->applyDiscount($order);
 }
Ejemplo n.º 2
0
 public function applyDiscount(OrderableInterface $order)
 {
     $amount = $order->getTotalAmount();
     return $amount->subtract($amount->multiply($this->rate));
 }