Skip to content

Commit

Permalink
changes after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfbluesoftcz committed Feb 13, 2024
1 parent 739267d commit 75d08f0
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using CMS.ContactManagement;
using Kentico.Xperience.CRM.Common.Mapping;
using Kentico.Xperience.CRM.Common.Mapping.Implementations;
using Kentico.Xperience.CRM.Common.Services;
using Microsoft.Extensions.DependencyInjection;

Expand All @@ -11,8 +10,7 @@ public abstract class ContactMappingBuilder<TBuilder>
{
private readonly IServiceCollection serviceCollection;
protected readonly List<ContactFieldToCRMMapping> fieldMappings = new();
protected readonly List<Type> converters = new();


protected ContactMappingBuilder(IServiceCollection serviceCollection)
{
this.serviceCollection = serviceCollection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Kentico.Xperience.CRM.Common.Mapping.Implementations;
using Kentico.Xperience.CRM.Common.Mapping;

namespace Kentico.Xperience.CRM.Common.Configuration;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using CMS.ContactManagement;

namespace Kentico.Xperience.CRM.Common.Mapping.Implementations;
namespace Kentico.Xperience.CRM.Common.Mapping;

public class ContactFieldMappingFunction : IContactFieldMapping
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using CMS.ContactManagement;

namespace Kentico.Xperience.CRM.Common.Mapping.Implementations;
namespace Kentico.Xperience.CRM.Common.Mapping;

/// <summary>
/// Contact Info item field mapping based on form field name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Kentico.Xperience.CRM.Common.Mapping.Implementations;
namespace Kentico.Xperience.CRM.Common.Mapping;

/// <summary>
/// Mapping wrapper for BizForm field mapping and Crm entity field mapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ protected override void OnInit(ModuleInitParameters parameters)
ContactInfo.TYPEINFO.Events.Insert.After += ContactSync;
ContactInfo.TYPEINFO.Events.Update.After += ContactSync;

Service.Resolve<ICRMModuleInstaller>().Install(CRMType.Dynamics);

RequestEvents.RunEndRequestTasks.Execute += (_, _) =>
{
DynamicsSyncQueueWorker.Current.EnsureRunningThread();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Kentico.Xperience.CRM.Common.Constants;
using Kentico.Xperience.CRM.Common.Converters;
using Kentico.Xperience.CRM.Common.Mapping;
using Kentico.Xperience.CRM.Common.Mapping.Implementations;
using Kentico.Xperience.CRM.Common.Services;
using Kentico.Xperience.CRM.Common.Synchronization;
using Kentico.Xperience.CRM.Dynamics.Configuration;
Expand All @@ -17,7 +16,7 @@

namespace Kentico.Xperience.CRM.Dynamics.Synchronization;

public class DynamicsContactsIntegrationService : IDynamicsContactsIntegrationService
internal class DynamicsContactsIntegrationService : IDynamicsContactsIntegrationService
{
private readonly DynamicsContactMappingConfiguration contactMapping;
private readonly IContactsIntegrationValidationService validationService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Kentico.Xperience.CRM.Common.Configuration;
using Kentico.Xperience.CRM.Common.Converters;
using Kentico.Xperience.CRM.Common.Mapping;
using Kentico.Xperience.CRM.Common.Mapping.Implementations;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Salesforce.OpenApi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal class SalesforceApiService : ISalesforceApiService
private readonly IOptionsSnapshot<SalesforceIntegrationSettings> integrationSettings;
private readonly SalesforceApiClient apiClient;

private static JsonSerializerOptions SerializerOptions = new(JsonSerializerDefaults.General)
private static readonly JsonSerializerOptions SerializerOptions = new(JsonSerializerDefaults.General)
{
Converters = { new DateTimeOffsetConverter() }
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Kentico.Xperience.CRM.Common.Constants;
using Kentico.Xperience.CRM.Common.Converters;
using Kentico.Xperience.CRM.Common.Mapping;
using Kentico.Xperience.CRM.Common.Mapping.Implementations;
using Kentico.Xperience.CRM.Common.Services;
using Kentico.Xperience.CRM.Common.Synchronization;
using Kentico.Xperience.CRM.Salesforce.Configuration;
Expand Down Expand Up @@ -142,9 +141,9 @@ public async Task SynchronizeContactToContactsAsync(ContactInfo contactInfo)
existingContact =
await apiService.GetContactById(syncItem.CRMSyncItemCRMID, nameof(ContactSObject.Id));
}
catch (Exception)
catch (ApiException e) when (e.StatusCode == 404)
{
//exception means de-facto 404-NotFound status
//supress exception on 404-NotFound status
}

if (existingContact is null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ private async Task SynchronizeLeadAsync(BizFormItem bizFormItem,
{
existingLead = await apiService.GetLeadById(syncItem.CRMSyncItemCRMID, nameof(LeadSObject.Id));
}
catch (Exception)
catch (ApiException e) when (e.StatusCode == 404)
{
//exception means de-facto 404-NotFound status
//suppress exception on 404-NotFound status
}
if (existingLead is null)
{
Expand Down

0 comments on commit 75d08f0

Please sign in to comment.