Skip to content

Commit

Permalink
Merge branch 'release/3.420.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vc-ci committed Nov 13, 2023
2 parents 6041e10 + 1926ba8 commit 7250ba5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<!-- These properties will be shared for all projects -->
<PropertyGroup>
<VersionPrefix>3.419.0</VersionPrefix>
<VersionPrefix>3.420.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@ public virtual async Task<CustomerOrder> PlaceCustomerOrderFromCartAsync(Shoppin
protected virtual CustomerOrder ConvertCartToOrder(ShoppingCart cart)
{
var cartLineItemsMap = new Dictionary<string, LineItem>();
var vendorIds = new List<string>();

// Copy Native Properties
var order = ToOrderModel(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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.OrdersModule.Web/module.manifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<id>VirtoCommerce.Orders</id>
<version>3.419.0</version>
<version>3.420.0</version>
<version-tag />
<platformVersion>3.413.0</platformVersion>
<dependencies>
Expand Down

0 comments on commit 7250ba5

Please sign in to comment.