diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj index 73a397c..bee5c7a 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj @@ -1,6 +1,6 @@  - 10.4.10 + 10.4.11 1.0.0.0 Live Integration Live Integration diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/OrderXmlGenerator.cs b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/OrderXmlGenerator.cs index 72b5039..6cda55d 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/OrderXmlGenerator.cs +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/XmlGenerators/OrderXmlGenerator.cs @@ -81,7 +81,7 @@ private static void AddCustomerInformation(Settings currentSettings, XmlElement /// /// The order node. /// The order. - private void AddOrderDeliveryInformation(XmlElement orderNode, Order order, User user) + private void AddOrderDeliveryInformation(OrderXmlGeneratorSettings settings, XmlElement orderNode, Order order, User user) { AddChildXmlNode(orderNode, "OrderDeliveryName", !string.IsNullOrWhiteSpace(order.CustomerName) ? order.CustomerName : !string.IsNullOrWhiteSpace(user?.Name) ? user.Name : order.DeliveryName); @@ -95,6 +95,14 @@ private void AddOrderDeliveryInformation(XmlElement orderNode, Order order, User AddChildXmlNode(orderNode, "OrderDeliveryPhone", order.DeliveryPhone); AddChildXmlNode(orderNode, "OrderDeliveryFax", order.DeliveryFax); AddChildXmlNode(orderNode, "OrderDeliveryCompany", order.DeliveryCompany); + if (settings.CreateOrder && order.DeliveryAddressId > 0) + { + var address = UserManagementServices.UserAddresses.GetAddressById(order.DeliveryAddressId); + if (address is object) + { + AddChildXmlNode(orderNode, "OrderDeliveryAddressId", !string.IsNullOrEmpty(address.ExternalID) ? address.ExternalID : address.UniqueIdentifier); + } + } } /// @@ -190,7 +198,7 @@ private XmlNode BuildOrderXml(Settings currentSettings, XmlDocument xmlDocument, var user = UserManagementServices.Users.GetUserById(order.CustomerAccessUserId); AddCustomerInformation(currentSettings, itemNode, order, user); - AddOrderDeliveryInformation(itemNode, order, user); + AddOrderDeliveryInformation(settings, itemNode, order, user); // do not use order.Modified in XML unless the field can be ignored for hash calculation AddChildXmlNode(itemNode, "CreateOrder", settings.CreateOrder.ToString());