Skip to content

Commit 2d8a428

Browse files
authored
Merge pull request #50 from dynamicweb/dbe/261-Improved-order-create-status-with-Live-Connection
Improved order create status with Live Connection
2 parents abe9116 + 6fce612 commit 2d8a428

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Connectors/Connector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ private static XmlDocument Communicate(Settings settings, string request, string
243243
if (!Helpers.ParseResponseToXml(erpXmlResponse, logger, out result))
244244
{
245245
result = null;
246-
exception = new Exception("Response is not valid XML");
246+
exception = new Exception($"Response is not valid XML: {erpXmlResponse}");
247247
}
248248
if (result != null && !LicenseService.ValidateLicense(url, result, logger))
249249
{

src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<Version>10.4.25</Version>
3+
<Version>10.4.26</Version>
44
<AssemblyVersion>1.0.0.0</AssemblyVersion>
55
<Title>Live Integration</Title>
66
<Description>Live Integration</Description>

src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/OrderHandler.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private static ResponseCacheLevel GetOrderCacheLevel(Settings settings)
130130

131131
// save this hash for next calls
132132
SaveOrderHash(settings, currentHash);
133-
133+
134134
XmlDocument response = GetResponse(settings, requestXml, order, createOrder, logger, out bool? requestCancelled, liveIntegrationSubmitType);
135135
if (response != null && !string.IsNullOrWhiteSpace(response.InnerXml))
136136
{
@@ -143,8 +143,7 @@ private static ResponseCacheLevel GetOrderCacheLevel(Settings settings)
143143
// error occurred
144144
if (createOrder && (!requestCancelled.HasValue || !requestCancelled.Value))
145145
{
146-
HandleIntegrationFailure(settings, order, failedOrderStateId, orderId, null, logger);
147-
Services.OrderDebuggingInfos.Save(order, $"ERP communication failed with null response returned.", OrderErpCallFailed, DebuggingInfoType.Undefined);
146+
HandleIntegrationFailure(settings, order, failedOrderStateId, orderId, null, logger);
148147
}
149148

150149
Diagnostics.ExecutionTable.Current.Add("DynamicwebLiveIntegration.OrderHandler.UpdateOrder END");
@@ -268,7 +267,7 @@ private static OrderLine CreateOrderLine(Order order, string productNumber, Logg
268267
private static XmlDocument GetResponse(Settings settings, string requestXml, Order order, bool createOrder, Logger logger, out bool? requestCancelled, SubmitType submitType)
269268
{
270269
XmlDocument response = null;
271-
requestCancelled = null;
270+
requestCancelled = null;
272271

273272
string orderIdentifier = Helpers.OrderIdentifier(order);
274273

@@ -289,7 +288,8 @@ private static XmlDocument GetResponse(Settings settings, string requestXml, Ord
289288

290289
if (createOrder && error != null)
291290
{
292-
Services.OrderDebuggingInfos.Save(order, $"ERP communication failed with error: {error}", OrderErpCallFailed, DebuggingInfoType.Undefined);
291+
string msg = !string.IsNullOrEmpty(error.Message) ? error.Message : error.ToString();
292+
Services.OrderDebuggingInfos.Save(order, $"ERP communication failed with error: {msg}", OrderErpCallFailed, DebuggingInfoType.Undefined);
293293
}
294294

295295
NotificationManager.Notify(Notifications.Order.OnAfterSendingOrderToErp, new Notifications.Order.OnAfterSendingOrderToErpArgs(order, createOrder, response, error, settings, logger));

src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/UI/Commands/TransferOrderToErpCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public override CommandResult Handle()
3434
bool result = OrderHandler.UpdateOrder(settings, order, SubmitType.ManualSubmit) ?? false;
3535
return new CommandResult
3636
{
37-
Message = result ? "Order successfully transferred to ERP" : "Error creating order in ERP. Check the LiveIntegration log for details",
37+
Message = result ? "Order successfully transferred to ERP" : "Error creating order in ERP. Check the Order log and LiveIntegration log for details",
3838
Status = result ? CommandResult.ResultType.Ok : CommandResult.ResultType.Error
3939
};
4040
}

src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/UI/Commands/TransferOrdersToErpCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ private static string GetExportedOrdersMessage(List<Order> orders, List<string>
8989
output += $"Orders with IDs [{string.Join(",", orders
9090
.Where(o => !(exportedOrders.Contains(o.Id) ||
9191
alreadyExportedOrders.Contains(o.Id)))
92-
.Select(o => o.Id).Distinct().ToArray())}] were not transferred to ERP. Check the LiveIntegration log for details";
92+
.Select(o => o.Id).Distinct().ToArray())}] were not transferred to ERP. Check the Order logs and LiveIntegration log for details";
9393
}
9494
}
9595
else
9696
{
97-
output = "None of the selected orders were transferred to ERP. Check the LiveIntegration log for details.";
97+
output = "None of the selected orders were transferred to ERP. Check the Order logs and LiveIntegration log for details.";
9898
}
9999

100100
return output;

0 commit comments

Comments
 (0)