diff --git a/CallbackHander.Testing/TestData.cs b/CallbackHander.Testing/TestData.cs index 62c4eac..c4adb75 100644 --- a/CallbackHander.Testing/TestData.cs +++ b/CallbackHander.Testing/TestData.cs @@ -1,13 +1,13 @@ using CallbackHandlers.Models; using System; using System.Collections.Generic; +using SecurityService.DataTransferObjects; using Xunit; namespace CallbackHander.Testing; using CallbackHandler.BusinessLogic.Requests; using CallbackHandler.CallbackMessageAggregate; -using SecurityService.DataTransferObjects.Responses; public class TestData { @@ -26,7 +26,7 @@ public class TestData public static Guid MerchantReference = Guid.Parse("9D20A396-1CF6-45ED-AA7B-DD436318BA29"); public static TokenResponse TokenResponse() { - return SecurityService.DataTransferObjects.Responses.TokenResponse.Create("AccessToken", string.Empty, 100); + return SecurityService.DataTransferObjects.TokenResponse.Create("AccessToken", string.Empty, 100); } public static IReadOnlyDictionary DefaultAppSettings => diff --git a/CallbackHandler.BusinessLogic.Tests/CallbackHandler.BusinessLogic.Tests.csproj b/CallbackHandler.BusinessLogic.Tests/CallbackHandler.BusinessLogic.Tests.csproj index 71af2b0..375ddeb 100644 --- a/CallbackHandler.BusinessLogic.Tests/CallbackHandler.BusinessLogic.Tests.csproj +++ b/CallbackHandler.BusinessLogic.Tests/CallbackHandler.BusinessLogic.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/CallbackHandler.BusinessLogic.Tests/Services/CallbackDomainServiceTests.cs b/CallbackHandler.BusinessLogic.Tests/Services/CallbackDomainServiceTests.cs index 6ec1c57..673ae23 100644 --- a/CallbackHandler.BusinessLogic.Tests/Services/CallbackDomainServiceTests.cs +++ b/CallbackHandler.BusinessLogic.Tests/Services/CallbackDomainServiceTests.cs @@ -1,5 +1,4 @@ using SecurityService.Client; -using SecurityService.DataTransferObjects.Responses; using Shared.General; using SimpleResults; using System; diff --git a/CallbackHandler.BusinessLogic/CallbackHandler.BusinessLogic.csproj b/CallbackHandler.BusinessLogic/CallbackHandler.BusinessLogic.csproj index f54ea6f..a0563e0 100644 --- a/CallbackHandler.BusinessLogic/CallbackHandler.BusinessLogic.csproj +++ b/CallbackHandler.BusinessLogic/CallbackHandler.BusinessLogic.csproj @@ -5,11 +5,11 @@ - - - - - + + + + + diff --git a/CallbackHandler.BusinessLogic/Services/CallbackDomainService.cs b/CallbackHandler.BusinessLogic/Services/CallbackDomainService.cs index 41b3d1c..b351e63 100644 --- a/CallbackHandler.BusinessLogic/Services/CallbackDomainService.cs +++ b/CallbackHandler.BusinessLogic/Services/CallbackDomainService.cs @@ -1,4 +1,5 @@ using SecurityService.Client; +using SecurityService.DataTransferObjects; using Shared.EventStore.Helpers; using Shared.Logger; using SimpleResults; @@ -9,7 +10,6 @@ namespace CallbackHandler.BusinessLogic.Services; using CallbackMessageAggregate; using Requests; -using SecurityService.DataTransferObjects.Responses; using Shared.DomainDrivenDesign.EventSourcing; using Shared.EventStore.Aggregate; using Shared.General; diff --git a/CallbackHandler.CallbackMessage.DomainEvents/CallbackHandler.CallbackMessage.DomainEvents.csproj b/CallbackHandler.CallbackMessage.DomainEvents/CallbackHandler.CallbackMessage.DomainEvents.csproj index 78b5b66..ec15f59 100644 --- a/CallbackHandler.CallbackMessage.DomainEvents/CallbackHandler.CallbackMessage.DomainEvents.csproj +++ b/CallbackHandler.CallbackMessage.DomainEvents/CallbackHandler.CallbackMessage.DomainEvents.csproj @@ -5,7 +5,7 @@ None - - + + \ No newline at end of file diff --git a/CallbackHandler.CallbackMessageAggregate.Tests/CallbackHandler.CallbackMessageAggregate.Tests.csproj b/CallbackHandler.CallbackMessageAggregate.Tests/CallbackHandler.CallbackMessageAggregate.Tests.csproj index d171735..0565ac9 100644 --- a/CallbackHandler.CallbackMessageAggregate.Tests/CallbackHandler.CallbackMessageAggregate.Tests.csproj +++ b/CallbackHandler.CallbackMessageAggregate.Tests/CallbackHandler.CallbackMessageAggregate.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/CallbackHandler.CallbackMessageAggregate/CallbackHandler.CallbackMessageAggregate.csproj b/CallbackHandler.CallbackMessageAggregate/CallbackHandler.CallbackMessageAggregate.csproj index cff39ac..7b19bd3 100644 --- a/CallbackHandler.CallbackMessageAggregate/CallbackHandler.CallbackMessageAggregate.csproj +++ b/CallbackHandler.CallbackMessageAggregate/CallbackHandler.CallbackMessageAggregate.csproj @@ -10,8 +10,8 @@ - - - + + + \ No newline at end of file diff --git a/CallbackHandler.DataTransferObjects/CallbackHandler.DataTransferObjects.csproj b/CallbackHandler.DataTransferObjects/CallbackHandler.DataTransferObjects.csproj index 47d2b0f..e3a63c7 100644 --- a/CallbackHandler.DataTransferObjects/CallbackHandler.DataTransferObjects.csproj +++ b/CallbackHandler.DataTransferObjects/CallbackHandler.DataTransferObjects.csproj @@ -6,7 +6,7 @@ - + diff --git a/CallbackHandler.DataTransferObjects/CallbackMessage.cs b/CallbackHandler.DataTransferObjects/CallbackMessage.cs index 0fd56c5..467bbe2 100644 --- a/CallbackHandler.DataTransferObjects/CallbackMessage.cs +++ b/CallbackHandler.DataTransferObjects/CallbackMessage.cs @@ -3,8 +3,8 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; +using System.Text.Json.Serialization; using System.Threading.Tasks; -using Newtonsoft.Json; namespace CallbackHandler.DataTransferObjects { @@ -19,7 +19,6 @@ public class CallbackMessage } public class CallbackResponse { - [JsonProperty("callback_id")] public Guid CallbackId { get; set; } } diff --git a/CallbackHandler.DataTransferObjects/Deposit.cs b/CallbackHandler.DataTransferObjects/Deposit.cs index 76077e0..b66196d 100644 --- a/CallbackHandler.DataTransferObjects/Deposit.cs +++ b/CallbackHandler.DataTransferObjects/Deposit.cs @@ -2,34 +2,22 @@ { using System; using System.Diagnostics.CodeAnalysis; - using Newtonsoft.Json; - + [ExcludeFromCodeCoverage] public class Deposit { - #region Properties - - [JsonProperty("account_number")] public String AccountNumber { get; set; } - [JsonProperty("amount")] public Decimal Amount { get; set; } - [JsonProperty("date_time")] public DateTime DateTime { get; set; } - [JsonProperty("deposit_id")] public Guid DepositId { get; set; } - [JsonProperty("host_identifier")] public Guid HostIdentifier { get; set; } - [JsonProperty("reference")] public String Reference { get; set; } - [JsonProperty("sort_code")] public String SortCode { get; set; } - - #endregion } } \ No newline at end of file diff --git a/CallbackHandler.IntegrationTests/CallbackHandler.IntegrationTests.csproj b/CallbackHandler.IntegrationTests/CallbackHandler.IntegrationTests.csproj index 78d4e3a..10cd74d 100644 --- a/CallbackHandler.IntegrationTests/CallbackHandler.IntegrationTests.csproj +++ b/CallbackHandler.IntegrationTests/CallbackHandler.IntegrationTests.csproj @@ -16,12 +16,12 @@ - - - - - - + + + + + + diff --git a/CallbackHandler.IntegrationTests/Common/DockerHelper.cs b/CallbackHandler.IntegrationTests/Common/DockerHelper.cs index c6a3202..9cbd432 100644 --- a/CallbackHandler.IntegrationTests/Common/DockerHelper.cs +++ b/CallbackHandler.IntegrationTests/Common/DockerHelper.cs @@ -1,19 +1,17 @@ using EventStore.Client; -using Newtonsoft.Json.Bson; using SecurityService.Client; using Shared.IntegrationTesting; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; +using Shared.Serialisation; using TransactionProcessor.Client; namespace CallbackHandler.IntegrationTests.Common; public class DockerHelper : global::Shared.IntegrationTesting.TestContainers.DockerHelper { + public DockerHelper() { + StringSerialiser.Initialise(new SystemTextJsonSerializer(SystemTextJsonSerializer.GetDefaultJsonSerializerOptions())); + } + public ISecurityServiceClient SecurityServiceClient; public ITransactionProcessorClient TransactionProcessorClient; public EventStoreProjectionManagementClient ProjectionManagementClient; @@ -67,10 +65,20 @@ public override async Task StartContainersForScenarioRun(String scenarioName, } }; HttpClient httpClient = new HttpClient(clientHandler); - this.SecurityServiceClient = new SecurityServiceClient(SecurityServiceBaseAddressResolver, httpClient); - this.TransactionProcessorClient = new TransactionProcessorClient(TransactionProcessorBaseAddressResolver, httpClient); + this.SecurityServiceClient = new SecurityServiceClient(SecurityServiceBaseAddressResolver, httpClient, Serialise, Deserialise); + this.TransactionProcessorClient = new TransactionProcessorClient(TransactionProcessorBaseAddressResolver, httpClient, Serialise, Deserialise); this.ProjectionManagementClient = new EventStoreProjectionManagementClient(ConfigureEventStoreSettings()); this.TestHostHttpClient = new HttpClient(clientHandler); this.TestHostHttpClient.BaseAddress = new Uri($"http://127.0.0.1:{this.TestHostServicePort}"); } + + String Serialise(Object arg) + { + return StringSerialiser.Serialise(arg, new SerialiserOptions(SerialiserPropertyFormat.SnakeCase)); + } + + Object Deserialise(String arg, Type type) + { + return StringSerialiser.DeserializeObject(arg, type, new SerialiserOptions(SerialiserPropertyFormat.SnakeCase)); + } } \ No newline at end of file diff --git a/CallbackHandler.IntegrationTests/Common/TestingContext.cs b/CallbackHandler.IntegrationTests/Common/TestingContext.cs index a07ac56..444c454 100644 --- a/CallbackHandler.IntegrationTests/Common/TestingContext.cs +++ b/CallbackHandler.IntegrationTests/Common/TestingContext.cs @@ -1,7 +1,8 @@ -using CallbackHandler.DataTransferObjects; +using System.Text.Json; +using CallbackHandler.DataTransferObjects; using Reqnroll; -using SecurityService.DataTransferObjects.Responses; using Shared.Logger; +using Shared.Serialisation; using Shouldly; using TransactionProcessor.DataTransferObjects.Responses.Merchant; using TransactionProcessor.IntegrationTesting.Helpers; @@ -10,7 +11,6 @@ namespace CallbackHandler.IntegrationTests.Common; public class TestingContext { - public DockerHelper DockerHelper { get; set; } public NlogLogger Logger { get; set; } @@ -174,4 +174,5 @@ public static ClientDetails Create(String clientId, } #endregion -} \ No newline at end of file +} + diff --git a/CallbackHandler.IntegrationTests/Features/BankDepositCallback.feature.cs b/CallbackHandler.IntegrationTests/Features/BankDepositCallback.feature.cs index eee5b03..8cab40a 100644 --- a/CallbackHandler.IntegrationTests/Features/BankDepositCallback.feature.cs +++ b/CallbackHandler.IntegrationTests/Features/BankDepositCallback.feature.cs @@ -202,6 +202,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "AddressLine1", "Town", "Region", + "PostalCode", "Country", "ContactName", "EmailAddress", @@ -211,6 +212,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Address Line 1", "TestTown", "Test Region", + "TE57 1NG", "United Kingdom", "Test Contact 1", "testcontact1@merchant1.co.uk", diff --git a/CallbackHandler.IntegrationTests/Shared/SharedSteps.cs b/CallbackHandler.IntegrationTests/Shared/SharedSteps.cs index 28d8b13..1288db7 100644 --- a/CallbackHandler.IntegrationTests/Shared/SharedSteps.cs +++ b/CallbackHandler.IntegrationTests/Shared/SharedSteps.cs @@ -1,18 +1,12 @@ using CallbackHandler.IntegrationTests.Common; using Reqnroll; -using System; -using System.Collections.Generic; -using System.Linq; using System.Net; using System.Net.Http.Headers; -using System.Runtime.CompilerServices; using System.Text; -using System.Threading.Tasks; using CallbackHandler.DataTransferObjects; -using Newtonsoft.Json; -using SecurityService.DataTransferObjects.Requests; -using SecurityService.DataTransferObjects.Responses; +using SecurityService.DataTransferObjects; using SecurityService.IntegrationTesting.Helpers; +using Shared.Serialisation; using Shouldly; using TransactionProcessor.DataTransferObjects.Requests.Estate; using TransactionProcessor.DataTransferObjects.Requests.Merchant; @@ -73,7 +67,7 @@ public async Task WhenISendTheRequestsToTheCallbackHandlerForDeposits() String requestUri = $"http://localhost:{this.TestingContext.DockerHelper.GetCallbackHandlerPort()}/api/callbacks"; HttpRequestMessage msg = new(HttpMethod.Post, requestUri); - var payload = JsonConvert.SerializeObject(testingContextDeposit); + var payload = StringSerialiser.Serialise(testingContextDeposit); msg.Content = new StringContent(payload, Encoding.UTF8, MediaTypeHeaderValue.Parse("application/json")); @@ -81,7 +75,7 @@ public async Task WhenISendTheRequestsToTheCallbackHandlerForDeposits() response.StatusCode.ShouldBe(HttpStatusCode.OK); var content = await response.Content.ReadAsStringAsync(); CallbackResponse responseData = - JsonConvert.DeserializeObject(content); + StringSerialiser.Deserialise(content); this.TestingContext.SentCallbacks.Add(responseData.CallbackId, payload); } @@ -99,15 +93,14 @@ public async Task ThenTheDepositRecordsAreRecorded() var response = await client.SendAsync(msg); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var originalDeposit = JsonConvert.DeserializeObject(sentCallback.Value); + var originalDeposit = StringSerialiser.Deserialise(sentCallback.Value); var content = await response.Content.ReadAsStringAsync(); CallbackMessage responseData = - JsonConvert.DeserializeObject(content); - + StringSerialiser.Deserialise(content); responseData.Reference.ShouldBe(originalDeposit.Reference); - var callbackDeposit = JsonConvert.DeserializeObject(responseData.Message); + var callbackDeposit = StringSerialiser.Deserialise(responseData.Message); callbackDeposit.AccountNumber.ShouldBe(originalDeposit.AccountNumber); } } diff --git a/CallbackHandler/Bootstrapper/ClientRegistry.cs b/CallbackHandler/Bootstrapper/ClientRegistry.cs index 8d8e3a8..4b9f0b9 100644 --- a/CallbackHandler/Bootstrapper/ClientRegistry.cs +++ b/CallbackHandler/Bootstrapper/ClientRegistry.cs @@ -2,9 +2,17 @@ using Lamar; using Microsoft.Extensions.DependencyInjection; using SecurityService.Client; +using Shared.General; +using Shared.Serialisation; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Shared.General; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Metadata; +using NLog; +using Shared.DomainDrivenDesign.EventSourcing; using TransactionProcessor.Client; namespace CallbackHandler.Bootstrapper; @@ -20,4 +28,16 @@ public ClientRegistry() { Func resolver(IServiceProvider container) => serviceName => ConfigurationReader.GetBaseServerUri(serviceName).OriginalString; this.AddSingleton>(resolver); } +} + +[ExcludeFromCodeCoverage] +public class SerialiserRegistry : ServiceRegistry +{ + public SerialiserRegistry() + { + this.AddSingleton(); + this.AddSingleton>(_ => obj => StringSerialiser.Serialise(obj)); + this.AddSingleton>(_ => (str,type) => StringSerialiser.DeserializeObject(str, type)); + this.AddSingleton(SystemTextJsonSerializer.GetDefaultJsonSerializerOptions()); + } } \ No newline at end of file diff --git a/CallbackHandler/Bootstrapper/MiddlewareRegistry.cs b/CallbackHandler/Bootstrapper/MiddlewareRegistry.cs index 7a13701..67c6d18 100644 --- a/CallbackHandler/Bootstrapper/MiddlewareRegistry.cs +++ b/CallbackHandler/Bootstrapper/MiddlewareRegistry.cs @@ -1,30 +1,23 @@ using KurrentDB.Client; using Microsoft.Extensions.Logging; using Microsoft.OpenApi; -using Shared.Extensions; using Swashbuckle.AspNetCore.SwaggerGen; namespace CallbackHandler.Bootstrapper; using Common; -using EventStore.Client; using Lamar; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; using Shared.EventStore.Extensions; using Shared.General; using Shared.Middleware; using Swashbuckle.AspNetCore.Filters; using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; -using System.Linq; using System.Reflection; -using System.Text.Json; [ExcludeFromCodeCoverage] public class MiddlewareRegistry :ServiceRegistry @@ -40,14 +33,7 @@ public MiddlewareRegistry() this.AddSwaggerGen(AddSwaggerAction); this.AddSwaggerExamples(); - this.AddControllers().AddNewtonsoftJson(options => - { - options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; - options.SerializerSettings.TypeNameHandling = TypeNameHandling.None; - options.SerializerSettings.Formatting = Formatting.Indented; - options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc; - options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); - }); + this.AddControllers(); Assembly assembly = this.GetType().GetTypeInfo().Assembly; this.AddMvcCore().AddApplicationPart(assembly).AddControllersAsServices(); @@ -58,10 +44,7 @@ public MiddlewareRegistry() this.AddSingleton(new RequestResponseMiddlewareLoggingConfig(middlewareLogLevel, logRequests, logResponses)); - this.ConfigureHttpJsonOptions(options => { - options.SerializerOptions.PropertyNamingPolicy = new SnakeCaseNamingPolicy(); - options.SerializerOptions.PropertyNameCaseInsensitive = true; // optional, but safer - }); + this.ConfigureHttpJsonOptions(jsonOptions => JsonSerializerConfiguration.ConfigureMinimalApi(jsonOptions.SerializerOptions)); } private void AddSwaggerAction(SwaggerGenOptions c) { diff --git a/CallbackHandler/CallbackHandler.csproj b/CallbackHandler/CallbackHandler.csproj index ec14b4c..e9bfa17 100644 --- a/CallbackHandler/CallbackHandler.csproj +++ b/CallbackHandler/CallbackHandler.csproj @@ -13,8 +13,8 @@ - - + + @@ -22,7 +22,6 @@ - @@ -37,8 +36,4 @@ - - - - diff --git a/CallbackHandler/Common/JsonSerializerConfiguration.cs b/CallbackHandler/Common/JsonSerializerConfiguration.cs new file mode 100644 index 0000000..6309bd0 --- /dev/null +++ b/CallbackHandler/Common/JsonSerializerConfiguration.cs @@ -0,0 +1,58 @@ +using System; +using System.Text.Json; +using Shared.Serialisation; + +namespace CallbackHandler.Common; + +public static class JsonSerializerConfiguration +{ + public static void ConfigureMinimalApi(JsonSerializerOptions serializerOptions) + { + var defaultOptions = SystemTextJsonSerializer.GetDefaultJsonSerializerOptions(); + serializerOptions.PropertyNamingPolicy = defaultOptions.PropertyNamingPolicy; + serializerOptions.DictionaryKeyPolicy = defaultOptions.DictionaryKeyPolicy; + serializerOptions.ReferenceHandler = defaultOptions.ReferenceHandler; + serializerOptions.WriteIndented = defaultOptions.WriteIndented; + serializerOptions.Converters.Add(new UtcDateTimeJsonConverter()); + serializerOptions.Converters.Add(new NullableUtcDateTimeJsonConverter()); + } + + private sealed class UtcDateTimeJsonConverter : System.Text.Json.Serialization.JsonConverter + { + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var value = reader.GetDateTime(); + return value.Kind == DateTimeKind.Utc ? value : value.ToUniversalTime(); + } + + public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) + { + writer.WriteStringValue(value.Kind == DateTimeKind.Utc ? value : value.ToUniversalTime()); + } + } + + private sealed class NullableUtcDateTimeJsonConverter : System.Text.Json.Serialization.JsonConverter + { + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType == JsonTokenType.Null) + { + return null; + } + + var value = reader.GetDateTime(); + return value.Kind == DateTimeKind.Utc ? value : value.ToUniversalTime(); + } + + public override void Write(Utf8JsonWriter writer, DateTime? value, JsonSerializerOptions options) + { + if (value.HasValue == false) + { + writer.WriteNullValue(); + return; + } + + writer.WriteStringValue(value.Value.Kind == DateTimeKind.Utc ? value.Value : value.Value.ToUniversalTime()); + } + } +} \ No newline at end of file diff --git a/CallbackHandler/Common/SwaggerDefaultValues.cs b/CallbackHandler/Common/SwaggerDefaultValues.cs index ca0fe01..95abb4a 100644 --- a/CallbackHandler/Common/SwaggerDefaultValues.cs +++ b/CallbackHandler/Common/SwaggerDefaultValues.cs @@ -2,10 +2,10 @@ namespace CallbackHandler.Common { - using System.Diagnostics.CodeAnalysis; - using System.Linq; using Microsoft.AspNetCore.Mvc.ApiExplorer; using Swashbuckle.AspNetCore.SwaggerGen; + using System.Diagnostics.CodeAnalysis; + using System.Linq; [ExcludeFromCodeCoverage] public class SwaggerDefaultValues : IOperationFilter diff --git a/CallbackHandler/Handlers/CallbackHandlers.cs b/CallbackHandler/Handlers/CallbackHandlers.cs index f4ff1a9..97b5c6d 100644 --- a/CallbackHandler/Handlers/CallbackHandlers.cs +++ b/CallbackHandler/Handlers/CallbackHandlers.cs @@ -3,19 +3,12 @@ using CallbackHandlers.Models; using MediatR; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.HttpResults; -using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; -using Sentry; -using Shared.Results; using Shared.Results.Web; using SimpleResults; using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; using System.Threading; using System.Threading.Tasks; +using Shared.Serialisation; namespace CallbackHandler.Handlers; @@ -29,7 +22,7 @@ public static async Task RecordCallback(Deposit depositCallback, CallbackCommands.RecordCallbackCommand request = new( callbackId, - JsonConvert.SerializeObject(depositCallback), + StringSerialiser.Serialise(depositCallback), new[] { "TransactionProcessor" }, MessageFormat.JSON, depositCallback.GetType().ToString(), diff --git a/CallbackHandler/Startup.cs b/CallbackHandler/Startup.cs index 309b04a..9f22476 100644 --- a/CallbackHandler/Startup.cs +++ b/CallbackHandler/Startup.cs @@ -10,6 +10,7 @@ namespace CallbackHandler using HealthChecks.UI.Client; using Lamar; using Microsoft.AspNetCore.Diagnostics.HealthChecks; + using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Sentry; using Shared.EventStore.Aggregate; @@ -17,6 +18,7 @@ namespace CallbackHandler using Shared.General; using Shared.Logger; using Shared.Middleware; + using Shared.Serialisation; using System.Diagnostics.CodeAnalysis; using ILogger = Microsoft.Extensions.Logging.ILogger; @@ -54,10 +56,13 @@ public void ConfigureContainer(ServiceRegistry services) services.IncludeRegistry(); services.IncludeRegistry(); services.IncludeRegistry(); + services.IncludeRegistry(); TypeProvider.LoadDomainEventsTypeDynamically(); Startup.Container = new Container(services); + var serialiser = Container.GetRequiredService(); + StringSerialiser.Initialise(serialiser); }