diff --git a/FileProcessor.BusinessLogic/EventHandling/FileDomainEventHandler.cs b/FileProcessor.BusinessLogic/EventHandling/FileDomainEventHandler.cs index ecff6dd..ac17ed7 100644 --- a/FileProcessor.BusinessLogic/EventHandling/FileDomainEventHandler.cs +++ b/FileProcessor.BusinessLogic/EventHandling/FileDomainEventHandler.cs @@ -65,8 +65,6 @@ public async Task Handle(IDomainEvent domainEvent, return await this.HandleSpecificDomainEvent((dynamic)domainEvent, cancellationToken); } - //private static Int32 TransactionNumber = 0; - /// /// Handles the specific domain event. /// diff --git a/FileProcessor.BusinessLogic/Services/FileProcessorDomainService.cs b/FileProcessor.BusinessLogic/Services/FileProcessorDomainService.cs index 1a1931b..0d0dbef 100644 --- a/FileProcessor.BusinessLogic/Services/FileProcessorDomainService.cs +++ b/FileProcessor.BusinessLogic/Services/FileProcessorDomainService.cs @@ -310,7 +310,7 @@ public async Task ProcessTransactionForFileLine(FileCommands.ProcessTran // need to now parse the line (based on the file format), this builds the metadata Dictionary transactionMetadata = this.ParseFileLine(fileLine.LineData, fileProfile.FileFormatHandler); - if (transactionMetadata == null) + if (transactionMetadata.Any() == false) { // Line failed to parse so record this fileAggregate.RecordFileLineAsRejected(fileLine.LineNumber, "Invalid Format"); @@ -566,7 +566,7 @@ private Dictionary ParseFileLine(String domainEventFileLine, catch (InvalidDataException iex) { Logger.LogWarning(iex.Message); - return null; + return new Dictionary(); } } diff --git a/FileProcessor.Client/FileProcessorClient.cs b/FileProcessor.Client/FileProcessorClient.cs index f6045ee..726ab88 100644 --- a/FileProcessor.Client/FileProcessorClient.cs +++ b/FileProcessor.Client/FileProcessorClient.cs @@ -59,8 +59,6 @@ public async Task> GetFile(String accessToken, Guid estateId, Guid fileId, CancellationToken cancellationToken) { - FileDetails response = null; - String requestUri = this.BuildRequestUrl($"/api/files/{fileId}?estateId={estateId}"); try { @@ -81,7 +79,7 @@ public async Task> GetFile(String accessToken, HandleResponseContent(result.Data); // call was successful so now deserialise the body to the response object - response = responseData.Data; + return Result.Success(responseData.Data); } catch (Exception ex) { // An exception has occurred, add some additional information to the message @@ -89,8 +87,6 @@ public async Task> GetFile(String accessToken, throw exception; } - - return Result.Success(response); } /// @@ -107,8 +103,6 @@ public async Task> GetFileImportLog(String accessToken, Guid estateId, Guid? merchantId, CancellationToken cancellationToken) { - FileImportLog response = null; - String requestUri = this.BuildRequestUrl($"/api/fileImportLogs/{fileImportLogId}?estateId={estateId}"); if (merchantId.HasValue) { @@ -133,7 +127,7 @@ public async Task> GetFileImportLog(String accessToken, HandleResponseContent(result.Data); // call was successful so now deserialise the body to the response object - response = responseData.Data; + return Result.Success(responseData.Data); } catch (Exception ex) { // An exception has occurred, add some additional information to the message @@ -141,8 +135,6 @@ public async Task> GetFileImportLog(String accessToken, throw exception; } - - return Result.Success(response); } /// @@ -161,8 +153,6 @@ public async Task> GetFileImportLogs(String accessToke DateTime endDateTime, Guid? merchantId, CancellationToken cancellationToken) { - FileImportLogList response = null; - String requestUri = this.BuildRequestUrl( $"/api/fileImportLogs?estateId={estateId}&startDateTime={startDateTime.Date:yyyy-MM-dd}&endDateTime={endDateTime.Date:yyyy-MM-dd}"); @@ -188,7 +178,7 @@ public async Task> GetFileImportLogs(String accessToke HandleResponseContent(result.Data); // call was successful so now deserialise the body to the response object - response = responseData.Data; + return Result.Success(responseData.Data); } catch (Exception ex) { // An exception has occurred, add some additional information to the message @@ -196,8 +186,6 @@ public async Task> GetFileImportLogs(String accessToke throw exception; } - - return Result.Success(response); } /// @@ -214,7 +202,6 @@ public async Task> UploadFile(String accessToken, Byte[] fileData, UploadFileRequest uploadFileRequest, CancellationToken cancellationToken) { - Guid response = Guid.Empty; try { String requestUri = this.BuildRequestUrl("/api/files"); @@ -246,7 +233,7 @@ public async Task> UploadFile(String accessToken, HandleResponseContent(result.Data); // call was successful so now deserialise the body to the response object - response = responseData.Data; + return Result.Success(responseData.Data); } catch (Exception ex) { // An exception has occurred, add some additional information to the message @@ -254,8 +241,6 @@ public async Task> UploadFile(String accessToken, throw exception; } - - return Result.Success(response); } /// diff --git a/FileProcessor/Bootstrapper/ClientRegistry.cs b/FileProcessor/Bootstrapper/ClientRegistry.cs index 80467dc..0049793 100644 --- a/FileProcessor/Bootstrapper/ClientRegistry.cs +++ b/FileProcessor/Bootstrapper/ClientRegistry.cs @@ -24,7 +24,6 @@ public ClientRegistry() { this.RegisterHttpClient(); this.RegisterHttpClient(); - //this.AddSingleton>(container => serviceName => { return ConfigurationReader.GetBaseServerUri(serviceName).OriginalString; }); Func resolver(IServiceProvider container) => serviceName => { return ConfigurationReader.GetBaseServerUri(serviceName).OriginalString; }; this.AddSingleton>(resolver); diff --git a/FileProcessor/Bootstrapper/MiddlewareRegistry.cs b/FileProcessor/Bootstrapper/MiddlewareRegistry.cs index 6197f84..1fc129e 100644 --- a/FileProcessor/Bootstrapper/MiddlewareRegistry.cs +++ b/FileProcessor/Bootstrapper/MiddlewareRegistry.cs @@ -55,9 +55,7 @@ public MiddlewareRegistry() } }); // add a custom operation filter which sets default values - //c.OperationFilter(); - //c.ExampleFilters(); - + //Locate the XML files being generated by ASP.NET... var directory = new DirectoryInfo(AppContext.BaseDirectory); var xmlFiles = directory.GetFiles("*.xml"); @@ -69,7 +67,6 @@ public MiddlewareRegistry() } }); - //services.AddSwaggerExamplesFromAssemblyOf(); this.AddAuthentication(options => { diff --git a/FileProcessor/Common/Extensions.cs b/FileProcessor/Common/Extensions.cs index deadea3..359788a 100644 --- a/FileProcessor/Common/Extensions.cs +++ b/FileProcessor/Common/Extensions.cs @@ -58,6 +58,9 @@ public static IServiceCollection AddInSecureEventStoreClient( case TraceEventType.Verbose: Logger.LogDebug(logMessage); break; + default: + Logger.LogInformation(logMessage); + break; } }; @@ -102,9 +105,7 @@ public static void PreWarm(this IApplicationBuilder applicationBuilder){ }; Func subscriptionRepositoryResolver = Startup.Container.GetInstance>(); - - EventStoreClientSettings eventStoreClientSettings = EventStoreClientSettings.Create(eventStoreConnectionString); - + applicationBuilder.ConfigureSubscriptionService(subscriptionWorkersRoot, eventStoreConnectionString, eventHandlerResolvers,