/// <summary> /// Validates the specified order carrier. /// </summary> /// <param name="orderCarrier">The order carrier.</param> /// <param name="checkoutFlowInfo">The checkout flow info.</param> public void Validate(OrderCarrier orderCarrier, CheckoutFlowInfo checkoutFlowInfo) { if (orderCarrier.OrderRows.Count != 0) { var personId = orderCarrier.CustomerInfo?.PersonID ?? _securityToken.UserID; var orderRows = from orderRowCarrier in orderCarrier.OrderRows let result = _orderRowFactory.Create(new ShoppingCartItemCarrier { ArticleNumber = orderRowCarrier.ArticleNumber, ProductID = orderRowCarrier.ProductID, CustomerID = personId, LanguageID = FoundationContext.Current.LanguageID, Quantity = orderRowCarrier.Quantity, Comments = orderRowCarrier.Comments }, orderCarrier.WebSiteID, orderCarrier.CurrencyID, personId, orderCarrier.CountryID, _securityToken) where result != null where Math.Round(orderRowCarrier.UnitListPrice, 2) != Math.Round(result.UnitListPrice, 2) || Math.Round(orderRowCarrier.VATPercentage, 2) != Math.Round(result.VATPercentage, 2) select orderRowCarrier; if (orderRows.Any()) { throw new PreOrderValidationException("accelerator.validation.productprices.haschanged".AsAngularResourceString()); } } }
/// <summary> /// Validates the specified order carrier. /// </summary> /// <param name="orderCarrier">The order carrier.</param> /// <param name="checkoutFlowInfo">The checkout flow info.</param> public void Validate(OrderCarrier orderCarrier, CheckoutFlowInfo checkoutFlowInfo) { var personId = orderCarrier.CustomerInfo?.PersonID ?? _securityToken.UserID; var orderRows = orderCarrier.OrderRows.Select(orderRowCarrier => _orderRowFactory.Create(new ShoppingCartItemCarrier { ArticleNumber = orderRowCarrier.ArticleNumber, ProductID = orderRowCarrier.ProductID, CustomerID = personId, LanguageID = FoundationContext.Current.LanguageID, Quantity = orderRowCarrier.Quantity, Comments = orderRowCarrier.Comments }, orderCarrier.WebSiteID, orderCarrier.CurrencyID, personId, orderCarrier.CountryID, _securityToken)); if (orderRows.Any(result => result == null)) { throw new PreOrderValidationException("accelerator.validation.product.nolongeravailableforsale".AsAngularResourceString()); } }