public IHttpActionResult ProductExpress(string code, decimal quantity) { var cart = _orderRepository.LoadOrCreateCart <ICart>(PrincipalInfo.CurrentPrincipal.GetContactId(), VippsConstants.VippsSingleProductCart); VippsExpressCartHelper.RemoveAllLineItems(cart); VippsExpressCartHelper.AddToCart(cart, code, quantity); var validationIssues = VippsExpressCartHelper.ValidateCart(cart); if (validationIssues.Any()) { return(GetUnsuccessfulResult(validationIssues.FirstOrDefault().ToString())); } cart.Properties[VippsConstants.VippsPaymentTypeField] = VippsPaymentType.PRODUCTEXPRESS; return(Finalize(cart)); }
public IHttpActionResult WishListExpress() { var wishListCart = _orderRepository.LoadCart <ICart>(PrincipalInfo.CurrentPrincipal.GetContactId(), "WishList"); if (wishListCart == null) { return(GetUnsuccessfulResult("No wish list found")); } var cart = _orderRepository.LoadOrCreateCart <ICart>(PrincipalInfo.CurrentPrincipal.GetContactId(), VippsConstants.VippsSingleProductCart); VippsExpressCartHelper.RemoveAllLineItems(cart); foreach (var lineItem in wishListCart.GetAllLineItems()) { VippsExpressCartHelper.AddToCart(cart, lineItem.Code, lineItem.Quantity); } cart.Properties[VippsConstants.VippsPaymentTypeField] = VippsPaymentType.WISHLISTEXPRESS; return(Finalize(cart)); }