Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ public interface ISettings
/// <value>The website identifier.</value>
int AreaId { get; set; }

/// <summary>
/// Gets or sets LCY Currency
/// </summary>
/// <value>The LCY currency identifier.</value>
string LcyCurrency { get; set; }

/// <summary>
/// Gets or sets the text for product discounts.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Settings()
CalculateOrderUsingProductNumber = true;
AutoPingInterval = Constants.DefaultPingInterval;
ConnectionTimeout = Constants.DefaultConnectionTimeout;
CartCommunicationType = Constants.CartCommunicationType.Full;
CartCommunicationType = Constants.CartCommunicationType.Full;
}

/// <summary>
Expand Down Expand Up @@ -118,6 +118,12 @@ public string InstanceName
/// <value>The website identifier.</value>
public int AreaId { get; set; }

/// <summary>
/// Gets or sets LCY Currency
/// </summary>
/// <value>The LCY currency identifier.</value>
public string LcyCurrency { get; set; }

/// <summary>
/// Global tag for connection availability
/// </summary>
Expand Down Expand Up @@ -432,6 +438,7 @@ public static void UpdateFrom(ISettings source, ISettings target)
target.Endpoint = source.Endpoint;
target.ShopId = source.ShopId;
target.AreaId = source.AreaId;
target.LcyCurrency = source.LcyCurrency;
target.SecurityKey = source.SecurityKey;
target.ConnectionTimeout = source.ConnectionTimeout;
target.AutoPingInterval = source.AutoPingInterval < Constants.MinPingInterval ? Constants.MinPingInterval : source.AutoPingInterval;
Expand Down Expand Up @@ -494,8 +501,8 @@ public static void UpdateFrom(ISettings source, ISettings target)
}
target.InstanceId = source.InstanceId;
target.InstanceLabel = source.InstanceLabel;
target.SettingsFile = source.SettingsFile;
if(source is Settings sourceSettings)
target.SettingsFile = source.SettingsFile;
if (source is Settings sourceSettings)
{
sourceSettings._notificationRecipients = null;
}
Expand Down Expand Up @@ -526,12 +533,12 @@ internal List<string> NotificationRecipients
}

private List<string> GetNotificationRecipients()
{
{
var recipients = new List<string>();
if (!string.IsNullOrEmpty(NotificationEmail) && StringHelper.IsValidEmailAddress(NotificationEmail))
recipients.Add(NotificationEmail);
if (!string.IsNullOrEmpty(RecipientGroups))
{
{
recipients.AddRange(GetRecipients(RecipientGroups.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(id => Converter.ToInt32(id))));
}
return recipients.Distinct().ToList();
Expand Down Expand Up @@ -570,6 +577,6 @@ private static List<string> GetRecipients(IEnumerable<int> groupIds)
result.Add(user.Email);
}
return result;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.4.32</Version>
<Version>10.4.33</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>Live Integration</Title>
<Description>Live Integration</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ public LiveIntegrationAddIn()
[AddInParameterOrder(43)]
public int AreaId { get; set; }

/// <summary>
/// Gets or sets LCY Currency
/// </summary>
/// <value>The LCY currency identifier.</value>
[AddInParameter("ERP Local Currency")]
[AddInParameterEditor(typeof(DropDownParameterEditor), "none=true;explanation=When DynamicWeb currency is selected the integration will send an empty string for the Currency Code in the Live Integration requests, allowing ERP apply its default local currency behavior automatically")]
[AddInParameterGroup("General")]
[AddInParameterOrder(45)]
public string LcyCurrency { get; set; }

/// <summary>
/// Number format culture
/// </summary>
Expand Down Expand Up @@ -734,6 +744,12 @@ IEnumerable<ParameterOption> IParameterOptions.GetParameterOptions(string dropdo
options.Add(new(nameof(ConnectionType.Endpoint), ConnectionType.Endpoint));
options.Add(new("Dynamicweb connector web service", ConnectionType.WebService));
break;
case "ERP Local Currency":
foreach (var currency in Services.Currencies.GetAllCurrencies())
{
options.Add(new($"{currency.GetName(Services.Languages.GetDefaultLanguageId())} - {currency.Code}", currency.Code));
}
break;
default:
throw new ArgumentException($"Unsupported dropdown: {dropdownName}", nameof(dropdownName));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Dynamicweb.Ecommerce.Orders;
using Dynamicweb.Extensibility.Notifications;
using Dynamicweb.Security.UserManagement;
using System;
using System.Linq;
using System.Xml;

Expand Down Expand Up @@ -201,6 +202,11 @@ private XmlNode BuildOrderXml(Settings currentSettings, XmlDocument xmlDocument,
var tableNode = CreateTableNode(xmlDocument, "EcomOrders");
var itemNode = CreateAndAppendItemNode(tableNode, "EcomOrders");
var user = UserManagementServices.Users.GetUserById(order.CustomerAccessUserId);
var currencyCode = order.CurrencyCode;
if (string.Equals(currentSettings.LcyCurrency, currencyCode, StringComparison.OrdinalIgnoreCase))
{
currencyCode = "";
}

AddCustomerInformation(currentSettings, itemNode, order, user);
AddOrderDeliveryInformation(settings, itemNode, order, user);
Expand All @@ -210,7 +216,7 @@ private XmlNode BuildOrderXml(Settings currentSettings, XmlDocument xmlDocument,
AddChildXmlNode(itemNode, "OrderId", order.Id);
AddChildXmlNode(itemNode, "OrderAutoId", order.AutoId.ToString());
AddChildXmlNode(itemNode, "OrderIntegrationOrderId", order.IntegrationOrderId);
AddChildXmlNode(itemNode, "OrderCurrencyCode", order.CurrencyCode);
AddChildXmlNode(itemNode, "OrderCurrencyCode", currencyCode);
AddChildXmlNode(itemNode, "OrderDate", order.Date.ToIntegrationString());
if (!settings.GenerateXmlForHash)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ private XmlNode BuildProductInfoXml(Settings currentSettings, XmlDocument xmlDoc
}

var currencyCode = settings.Context?.Currency?.Code;
if(string.Equals(currentSettings.LcyCurrency, currencyCode, StringComparison.OrdinalIgnoreCase))
{
currencyCode = "";
}

var tableNode = xmlDocument.CreateElement("Products");
tableNode.SetAttribute("type", "filter");
Expand Down
Loading