When Litium starts, IConnectorSetup classes will run, to set up the necessary infrastructure for marketing automation add-ons. They are configured during App building, which is described in the next article .
In the Voyado connector, this interface is implemented in:
- \src\Litium.AddOns.VoyadoConnector\Setups\InstallStore.cs
- \src\Litium.AddOns.VoyadoConnector\Setups\InstallConsents.cs, through base class ConsentsInstallerBase<string, Consent>.
Install store
InstallStore.cs implements the Voyado store API, caling Voyado to update or create the store.
Install consents
User concents are end-user agreements to accept newletters and other communication, as well as general terms and conditions. The list is related to GDPR agreements between end-customers and merchant. The list of concents are set up by Voyado during tenant setup.
During Litium start-up, this list of consents are fetched and Litium customer field template is updated by creating new boolean fields to store these consents. The list of consents should either be presented to end customers for explicit agreement as checkboxes, or end customer should be made aware of the implicit agreement to these concents, depending on business and legal requirements.
Default behaviour
When a logged-in user in Litium is synced to Voyado, the default behaviour is to get the concents from the users Litium fields. See \src\Litium.AddOns.VoyadoConnector\Converters\PersonConverter.cs
var consents = _consentService.GetAllFromCache();
foreach (var item in consents)
{
var fieldName = $"{Constants.Customer.Fields.CustomerConsentPrefix}{item.Id}";
var field = person.CustomFields.GetField(fieldName) as BooleanField;
if (field != null)
{
if (contact.Consents == null)
{
contact.Consents = new List<ContactConsent>();
}
contact.Consents.Add(new ContactConsent()
{
Id = item.Id,
Value = field.Value,
Date = DateTime.Now,
Source = "Litium",
Comment = string.Empty
});
}
}
When an anonymous user is synced to Voyado as a guest (for order processing), the default behaviour is to set all consents to false. See src\Litium.AddOns.VoyadoConnector\Converters\EcomPersonInfoConverter.cs
var consents = _consentService.GetAllFromCache();
foreach (var item in consents)
{
if (contact.Consents == null)
{
contact.Consents = new List<ContactConsent>();
}
contact.Consents.Add(new ContactConsent()
{
Id = item.Id,
Value = false, //TODO: we set as user has not concented to anything. The default concents would be in merchant terms of use agreement. So I suppose the project will need to change here?
Date = DateTime.Now,
Source = "Litium",
Comment = string.Empty
});
}