Ejemplo n.º 1
0
 /**
  * Given a coupon code, removes it from cart.
  *
  * @param CartInterface $cart       Cart
  * @param string        $couponCode Coupon code
  *
  * @return bool Coupon has been removed from cart
  */
 public function removeCouponByCode(CartInterface $cart, $couponCode)
 {
     $coupon = $this->couponRepository->findOneBy(['code' => $couponCode]);
     if (!$coupon instanceof CouponInterface) {
         return false;
     }
     return $this->removeCoupon($cart, $coupon);
 }
Ejemplo n.º 2
0
 /**
  * Create new CartCouponManager instance
  *
  * @return CartCouponManager
  */
 private function createCartCouponManagerInstance()
 {
     return new CartCouponManager($this->cartCouponEventDispatcher->reveal(), $this->couponRepository->reveal(), $this->cartCouponDirector->reveal(), $this->cartCouponRepository->reveal());
 }