コード例 #1
0
ファイル: CartService.php プロジェクト: inklabs/kommerce-core
 /**
  * @param UuidInterface $cartId
  * @param string $couponCode
  * @throws EntityNotFoundException
  */
 public function addCouponByCode(UuidInterface $cartId, $couponCode)
 {
     $coupon = $this->couponRepository->findOneByCode($couponCode);
     $cart = $this->cartRepository->findOneById($cartId);
     $cart->addCoupon($coupon);
     $this->cartRepository->update($cart);
 }
コード例 #2
0
 public function testFindOneByCodeMissingThrowsException()
 {
     $this->setExpectedException(EntityNotFoundException::class, 'Coupon not found');
     $this->couponRepository->findOneByCode('xyz');
 }