From 58ab379be8ed3e91c4aee88a57e3350c0ba001da Mon Sep 17 00:00:00 2001 From: vc-ci Date: Tue, 7 Nov 2023 13:41:35 +0000 Subject: [PATCH 1/2] 3.420.0 --- Directory.Build.props | 2 +- src/VirtoCommerce.OrdersModule.Web/module.manifest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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.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 From 1926ba8bfdcb1d956d441d425cf59afa2729aaf1 Mon Sep 17 00:00:00 2001 From: Alexey Shibanov <83034617+alexeyshibanov@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:42:26 +0300 Subject: [PATCH 2/2] fix: Check vendors from selected cart items for shipments and payments (#387) --- .../Services/CustomerOrderBuilder.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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