diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Connectors/Connector.cs b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Connectors/Connector.cs index 8192c7b..292ef25 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Connectors/Connector.cs +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Connectors/Connector.cs @@ -243,7 +243,7 @@ private static XmlDocument Communicate(Settings settings, string request, string if (!Helpers.ParseResponseToXml(erpXmlResponse, logger, out result)) { result = null; - exception = new Exception("Response is not valid XML"); + exception = new Exception($"Response is not valid XML: {erpXmlResponse}"); } if (result != null && !LicenseService.ValidateLicense(url, result, logger)) { diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj index d2a6726..f3646fa 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.25 + 10.4.26 1.0.0.0 Live Integration Live Integration diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/OrderHandler.cs b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/OrderHandler.cs index 1eae2c6..20043f5 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/OrderHandler.cs +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/OrderHandler.cs @@ -130,7 +130,7 @@ private static ResponseCacheLevel GetOrderCacheLevel(Settings settings) // save this hash for next calls SaveOrderHash(settings, currentHash); - + XmlDocument response = GetResponse(settings, requestXml, order, createOrder, logger, out bool? requestCancelled, liveIntegrationSubmitType); if (response != null && !string.IsNullOrWhiteSpace(response.InnerXml)) { @@ -143,8 +143,7 @@ private static ResponseCacheLevel GetOrderCacheLevel(Settings settings) // error occurred if (createOrder && (!requestCancelled.HasValue || !requestCancelled.Value)) { - HandleIntegrationFailure(settings, order, failedOrderStateId, orderId, null, logger); - Services.OrderDebuggingInfos.Save(order, $"ERP communication failed with null response returned.", OrderErpCallFailed, DebuggingInfoType.Undefined); + HandleIntegrationFailure(settings, order, failedOrderStateId, orderId, null, logger); } Diagnostics.ExecutionTable.Current.Add("DynamicwebLiveIntegration.OrderHandler.UpdateOrder END"); @@ -268,7 +267,7 @@ private static OrderLine CreateOrderLine(Order order, string productNumber, Logg private static XmlDocument GetResponse(Settings settings, string requestXml, Order order, bool createOrder, Logger logger, out bool? requestCancelled, SubmitType submitType) { XmlDocument response = null; - requestCancelled = null; + requestCancelled = null; string orderIdentifier = Helpers.OrderIdentifier(order); @@ -289,7 +288,8 @@ private static XmlDocument GetResponse(Settings settings, string requestXml, Ord if (createOrder && error != null) { - Services.OrderDebuggingInfos.Save(order, $"ERP communication failed with error: {error}", OrderErpCallFailed, DebuggingInfoType.Undefined); + string msg = !string.IsNullOrEmpty(error.Message) ? error.Message : error.ToString(); + Services.OrderDebuggingInfos.Save(order, $"ERP communication failed with error: {msg}", OrderErpCallFailed, DebuggingInfoType.Undefined); } NotificationManager.Notify(Notifications.Order.OnAfterSendingOrderToErp, new Notifications.Order.OnAfterSendingOrderToErpArgs(order, createOrder, response, error, settings, logger)); diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/UI/Commands/TransferOrderToErpCommand.cs b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/UI/Commands/TransferOrderToErpCommand.cs index 4e6bd40..d91ca94 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/UI/Commands/TransferOrderToErpCommand.cs +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/UI/Commands/TransferOrderToErpCommand.cs @@ -34,7 +34,7 @@ public override CommandResult Handle() bool result = OrderHandler.UpdateOrder(settings, order, SubmitType.ManualSubmit) ?? false; return new CommandResult { - Message = result ? "Order successfully transferred to ERP" : "Error creating order in ERP. Check the LiveIntegration log for details", + Message = result ? "Order successfully transferred to ERP" : "Error creating order in ERP. Check the Order log and LiveIntegration log for details", Status = result ? CommandResult.ResultType.Ok : CommandResult.ResultType.Error }; } diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/UI/Commands/TransferOrdersToErpCommand.cs b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/UI/Commands/TransferOrdersToErpCommand.cs index cc06e03..e6c30f8 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/UI/Commands/TransferOrdersToErpCommand.cs +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/UI/Commands/TransferOrdersToErpCommand.cs @@ -89,12 +89,12 @@ private static string GetExportedOrdersMessage(List orders, List output += $"Orders with IDs [{string.Join(",", orders .Where(o => !(exportedOrders.Contains(o.Id) || alreadyExportedOrders.Contains(o.Id))) - .Select(o => o.Id).Distinct().ToArray())}] were not transferred to ERP. Check the LiveIntegration log for details"; + .Select(o => o.Id).Distinct().ToArray())}] were not transferred to ERP. Check the Order logs and LiveIntegration log for details"; } } else { - output = "None of the selected orders were transferred to ERP. Check the LiveIntegration log for details."; + output = "None of the selected orders were transferred to ERP. Check the Order logs and LiveIntegration log for details."; } return output;