diff --git a/Directory.Build.props b/Directory.Build.props index f3a18884..0b6981e9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ - 3.419.0 + 3.420.0 $(VersionSuffix)-$(BuildNumber) diff --git a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs index 7d81d7e6..d4bb269f 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs @@ -48,6 +48,7 @@ public virtual async Task PlaceCustomerOrderFromCartAsync(Shoppin protected virtual CustomerOrder ConvertCartToOrder(ShoppingCart cart) { var cartLineItemsMap = new Dictionary(); + var vendorIds = new List(); // Copy Native Properties var order = ToOrderModel(cart); @@ -55,7 +56,9 @@ protected virtual CustomerOrder ConvertCartToOrder(ShoppingCart cart) // Copy LineItems if (cart.Items != null) { - order.Items = ToOrderModel(cart.Items.Where(x => x.SelectedForCheckout).ToList(), cartLineItemsMap); + var cartLineItems = cart.Items.Where(x => x.SelectedForCheckout).ToArray(); + order.Items = ToOrderModel(cartLineItems, cartLineItemsMap); + vendorIds.AddRange(cartLineItems.Select(x => x.VendorId).Where(x => !string.IsNullOrEmpty(x)).Distinct()); } // Copy Discounts @@ -67,13 +70,19 @@ protected virtual CustomerOrder ConvertCartToOrder(ShoppingCart cart) // Copy Shipments if (cart.Shipments != null) { - order.Shipments = ToOrderModel(cart.Shipments, cartLineItemsMap); + var cartShipments = vendorIds.Any() + ? cart.Shipments.Where(x => string.IsNullOrEmpty(x.VendorId) || vendorIds.Contains(x.VendorId)).ToArray() + : cart.Shipments; + order.Shipments = ToOrderModel(cartShipments, cartLineItemsMap); } // Copy Payments if (cart.Payments != null) { - order.InPayments = ToOrderModel(cart, cart.Payments); + var cartPayments = vendorIds.Any() + ? cart.Payments.Where(x => string.IsNullOrEmpty(x.VendorId) || vendorIds.Contains(x.VendorId)).ToArray() + : cart.Payments; + order.InPayments = ToOrderModel(cart, cartPayments); } // Copy DynamicProperties diff --git a/src/VirtoCommerce.OrdersModule.Web/module.manifest b/src/VirtoCommerce.OrdersModule.Web/module.manifest index 7950999c..6dac83e6 100644 --- a/src/VirtoCommerce.OrdersModule.Web/module.manifest +++ b/src/VirtoCommerce.OrdersModule.Web/module.manifest @@ -1,7 +1,7 @@ VirtoCommerce.Orders - 3.419.0 + 3.420.0 3.413.0