internal MessageResponse ProcessHttpRequest(InputFileProperties inputFile)
        {
            try
            {
                if (inputFile == null)
                {
                    return(MessageResponse.error("File Not Found"));
                }

                var inputContent = GetInputFileContentAndLogRequest(inputFile);

                var sb = _psTool.ProcessDataFile(inputContent);

                var errorList = _psTool.GetErrors();
                if (errorList.Any())
                {
                    return(MessageResponse.error(errorList));
                }

                var encryptedData = AESHelper.EncryptAES(sb.ToString(), _configuration["AESKeyBLOB"]);
                return(MessageResponse.ok(encryptedData));
            }
            catch (Exception e)
            {
                Logger.Error(e);
                return(MessageResponse.error(e.Message));
            }
        }
        public async Task <MessageResponse> ProcessHttpRequest(HttpRequestMessage request)
        {
            if (!request.Content.IsMimeMultipartContent())
            {
                return(MessageResponse.info("Invalid media type - multipart"));
            }

            var provider = new MultipartFormDataMemoryStreamProvider();
            await request.Content.ReadAsMultipartAsync(provider);

            var inputFiles = provider.FileData;

            var primaryFilter = "*.*"; //TODO: get from httpRequest
            var primaryFiles  = GetInputFiles(provider, primaryFilter);

            var remitFilter     = "*.*"; //TODO: get from httpRequest
            var remittanceFiles = GetInputFiles(provider, remitFilter);

            var sbStandardFile = _psTool.ProcessMultiDataFile(primaryFiles, remittanceFiles);
            var listErrors     = _psTool.GetErrors();

            if (listErrors.Any())
            {
                return(MessageResponse.error(listErrors));
            }

            //Upload to storage
            var storageConnString = Vault.Current.StorageConnectionString;
            var decryptKey        = Vault.Current.AESKeyBLOB;
            var containerName     = "containerName";  //TODO: where?
            var blobOutputName    = "blobOutputName"; //TODO: how?

            BlobHelper.UploadFile(storageConnString, containerName, blobOutputName, sbStandardFile, decryptKey);

            //Send msg to importWorker
            var messageProperties = new BrokeredMessageProperties();

            messageProperties.Add("siteName", "SiteName");
            var sbConnectionString = Vault.Current.ServiceBusConnectionString;
            var queueName          = "queueName";//TODO:Where?

            MessageHelper.SendMessageToServiceBus(sbConnectionString, queueName, messageProperties);

            return(MessageResponse.ok(null));
        }
        // request nay la send từ postman, qua hàm này request.Content.ReadAsMultipartAsync
        // nó sẽ lầy tên file từ body truyền trên postman
        // System.net.http ko xa2i tre6n .netcore
        // Doc them phan Upload large files with streaming
        // https://docs.microsoft.com/en-us/aspnet/core/mvc/models/file-uploads?view=aspnetcore-3.0
        internal MessageResponse ProcessHttpRequest(MasterConversionRequest request)
        {
            try
            {
                // coi them vd cho .net framework
                // https://stackoverflow.com/questions/14937926/file-name-from-httprequestmessage-content

                //if (!request.Content.IsMimeMultipartContent())
                //    return MessageResponse.info("Invalid media type - multipart");
                //var provider = new MultipartFormDataMemoryStreamProvider();
                //await request.Content.ReadAsMultipartAsync(provider);
                //var inputContent = GetInputFileContentAndLogRequest(provider);
                if (request is null || request.FileData.Length == 0) //TODO length > maximum length
                {
                    return(MessageResponse.error("Bad request. File not found!"));
                }

                var inputContent = GetInputFileContentAndLogRequest(request);

                var sb = _psTool.ProcessDataFile(inputContent);

                var errorList = _psTool.GetErrors();
                if (errorList.Any())
                {
                    return(MessageResponse.error(errorList));
                }

                var encryptedData = AESHelper.EncryptAES(sb, AzureKeyVaultProvider.AESKeyBLOB);
                return(MessageResponse.ok(encryptedData));
            }
            catch (Exception e)
            {
                _logger.Error(e.Message);
                return(MessageResponse.error(e.Message));
            }
        }